Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for resource matching service #386

Merged
merged 18 commits into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ addons:
- cmake
- cmake-data
- clang-3.8
- gcc-4.9
- g++-4.9
- gcc-8
- g++-8
- uuid-dev
- aspell
- libopenmpi-dev
Expand All @@ -52,7 +52,7 @@ addons:
before_install:
- rm -rf $HOME/.luarocks
- wget https://raw.githubusercontent.com/flux-framework/flux-core/master/src/test/travis-dep-builder.sh
- eval $(bash ./travis-dep-builder.sh --printenv)
- $(bash ./travis-dep-builder.sh --printenv)
- export PKG_CONFIG_PATH=$HOME/local2/lib/pkgconfig:${PKG_CONFIG_PATH}
- test "$TRAVIS_PULL_REQUEST" == "false" || export CCACHE_READONLY=1
- if test "$CC" = "clang"; then export CCACHE_CPP2=1; fi
Expand Down Expand Up @@ -98,6 +98,7 @@ after_success:
- ccache -s
- if test "$COVERAGE" = "t"; then coveralls-lcov flux*-coverage.info; bash <(curl -s https://codecov.io/bash); fi
after_failure:
- find . -name test-suite.log | xargs -i sh -c 'printf "===XXX {} XXX===";cat {}'
- find . -name t[0-9]*.output -print0 | xargs -0 -I'{}' sh -c 'printf "\033[31mFound {}\033[39m\n";cat {}'
- find . -name *.broker.log -print0 | xargs -0 -I'{}' sh -c 'printf "\033[31mFound {}\033[39m\n";cat {}'
- src/test/backtrace-all.sh
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ AC_CONFIG_FILES([Makefile
resource/Makefile
resource/planner/Makefile
resource/planner/test/Makefile
resource/modules/Makefile
sched/Makefile
sched/priority/Makefile
sched/priority/modified_fair_tree/Makefile
Expand Down
67 changes: 42 additions & 25 deletions resource/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,21 @@ AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) \
AM_CPPFLAGS = -I$(top_srcdir) $(CZMQ_CFLAGS) $(FLUX_CORE_CFLAGS) \
$(BOOST_CPPFLAGS)

SUBDIRS = planner .
SUBDIRS = planner . modules

noinst_LTLIBRARIES = libresource.la

noinst_PROGRAMS = utilities/grug2dot utilities/resource-query

EXTRA_DIST= \
utilities/conf

#
# grug2dot
#
utilities_grug2dot_SOURCES = \
utilities/grug2dot.cpp \
generators/spec.cpp \
generators/spec.hpp
utilities_grug2dot_CXXFLAGS = \
$(AM_CXXFLAGS)
utilities_grug2dot_LDADD = \
$(BOOST_SYSTEM_LIB) \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_GRAPH_LIB) \
$(BOOST_REGEX_LIB)

#.
# resource-query
#
utilities_resource_query_SOURCES = \
utilities/resource-query.cpp \
utilities/command.cpp \
libresource_la_SOURCES = \
policies/dfu_match_high_id_first.cpp \
policies/dfu_match_low_id_first.cpp \
policies/dfu_match_locality.cpp \
policies/dfu_match_policy_factory.cpp \
jobinfo/jobinfo.cpp \
schema/resource_data.cpp \
schema/infra_data.cpp \
schema/sched_data.cpp \
Expand All @@ -59,6 +43,8 @@ utilities_resource_query_SOURCES = \
policies/dfu_match_high_id_first.hpp \
policies/dfu_match_low_id_first.hpp \
policies/dfu_match_locality.hpp \
policies/dfu_match_policy_factory.hpp \
jobinfo/jobinfo.hpp \
schema/resource_graph.hpp \
schema/data_std.hpp \
schema/infra_data.hpp \
Expand All @@ -76,15 +62,46 @@ utilities_resource_query_SOURCES = \
evaluators/fold.hpp \
config/system_defaults.hpp \
planner/planner.h
utilities_resource_query_CXXFLAGS = \

libresource_la_CXXFLAGS = \
$(WARNING_CXXFLAGS) \
$(CODE_COVERAGE_CFLAGS) \
$(AM_CXXFLAGS) \
$(JOBSPEC_CFLAGS)
utilities_resource_query_LDADD = \

libresource_la_LIBADD = \
$(top_builddir)/resource/planner/libplanner.la \
$(JOBSPEC_LIBS) \
$(READLINE_LIBS) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_GRAPH_LIB) \
$(BOOST_REGEX_LIB)

#
# grug2dot
#
utilities_grug2dot_SOURCES = \
utilities/grug2dot.cpp \
generators/spec.cpp \
generators/spec.hpp
utilities_grug2dot_CXXFLAGS = \
$(AM_CXXFLAGS)
utilities_grug2dot_LDADD = \
$(BOOST_SYSTEM_LIB) \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_GRAPH_LIB) \
$(BOOST_REGEX_LIB)

#
# resource-query
#
utilities_resource_query_SOURCES = \
utilities/resource-query.cpp \
utilities/command.cpp
utilities_resource_query_CXXFLAGS = \
$(AM_CXXFLAGS) \
$(JOBSPEC_CFLAGS) \
$(READLINE_LIBS)
utilities_resource_query_LDADD = \
libresource.la

2 changes: 1 addition & 1 deletion resource/evaluators/edge_eval_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* See also: http://www.gnu.org/licenses/
\*****************************************************************************/

#include "evaluators/edge_eval_api.hpp"
#include "resource/evaluators/edge_eval_api.hpp"

namespace Flux {
namespace resource_model {
Expand Down
2 changes: 1 addition & 1 deletion resource/evaluators/edge_eval_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <vector>
#include <string>
#include "schema/resource_graph.hpp"
#include "resource/schema/resource_graph.hpp"

namespace Flux {
namespace resource_model {
Expand Down
2 changes: 1 addition & 1 deletion resource/evaluators/fold.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <boost/icl/interval.hpp>
#include <boost/icl/interval_set.hpp>
#include "evaluators/edge_eval_api.hpp"
#include "resource/evaluators/edge_eval_api.hpp"

namespace Flux {
namespace resource_model {
Expand Down
2 changes: 1 addition & 1 deletion resource/evaluators/scoring_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* See also: http://www.gnu.org/licenses/
\*****************************************************************************/

#include "evaluators/scoring_api.hpp"
#include "resource/evaluators/scoring_api.hpp"

namespace Flux {
namespace resource_model {
Expand Down
6 changes: 3 additions & 3 deletions resource/evaluators/scoring_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include <numeric>
#include <functional>
#include <algorithm>
#include "schema/resource_graph.hpp"
#include "evaluators/edge_eval_api.hpp"
#include "evaluators/fold.hpp"
#include "resource/schema/resource_graph.hpp"
#include "resource/evaluators/edge_eval_api.hpp"
#include "resource/evaluators/fold.hpp"

namespace Flux {
namespace resource_model {
Expand Down
6 changes: 3 additions & 3 deletions resource/generators/gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include <vector>
#include <cstdint>
#include <boost/algorithm/string.hpp>
#include "generators/gen.hpp"
#include "planner/planner.h"
#include "resource/generators/gen.hpp"
#include "resource/planner/planner.h"

extern "C" {
#if HAVE_CONFIG_H
Expand Down Expand Up @@ -431,7 +431,7 @@ const std::string &resource_generator_t::err_message () const
/*
* Read a subsystem spec graphml file and generate resource database
*
* \param sfile generator spec file in graphml
* \param sn generator spec file in graphml
* \param db graph database consisting of resource graph and various indices
* \return 0 on success; non-zero integer on an error
*/
Expand Down
4 changes: 2 additions & 2 deletions resource/generators/gen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

#include <string>
#include <boost/graph/depth_first_search.hpp>
#include "schema/resource_graph.hpp"
#include "generators/spec.hpp"
#include "resource/schema/resource_graph.hpp"
#include "resource/generators/spec.hpp"

namespace Flux {
namespace resource_model {
Expand Down
2 changes: 1 addition & 1 deletion resource/generators/spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <boost/graph/graphviz.hpp>
#include <boost/graph/graphml.hpp>
#include <boost/filesystem.hpp>
#include "generators/spec.hpp"
#include "resource/generators/spec.hpp"

extern "C" {
#if HAVE_CONFIG_H
Expand Down
75 changes: 75 additions & 0 deletions resource/jobinfo/jobinfo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*****************************************************************************\
* Copyright (c) 2014 Lawrence Livermore National Security, LLC. Produced at
* the Lawrence Livermore National Laboratory (cf, AUTHORS, DISCLAIMER.LLNS).
* LLNL-CODE-658032 All rights reserved.
*
* This file is part of the Flux resource manager framework.
* For details, see https://github.com/flux-framework.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the license, or (at your option)
* any later version.
*
* Flux is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the terms and conditions of the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* See also: http://www.gnu.org/licenses/
\*****************************************************************************/

#include <string>
#include "resource/jobinfo/jobinfo.hpp"

namespace Flux {
namespace resource_model {

job_info_t::job_info_t (uint64_t j, job_lifecycle_t s, int64_t at, const std::string &fn,
const std::string &jstr, const std::string &R_str, double o)
: jobid (j), state (s), scheduled_at (at), jobspec_fn (fn), jobspec_str (jstr),
R (R_str), overhead (o)
{

}

job_info_t::job_info_t (uint64_t j, job_lifecycle_t s, int64_t at, const std::string &fn,
const std::string &jstr, double o)
: jobid (j), state (s), scheduled_at (at), jobspec_fn (fn), jobspec_str (jstr),
overhead (o)
{

}

void get_jobstate_str (job_lifecycle_t state, std::string &status)
{
switch (state) {
case job_lifecycle_t::ALLOCATED:
status = "ALLOCATED";
break;
case job_lifecycle_t::RESERVED:
status = "RESERVED";
break;
case job_lifecycle_t::CANCELLED:
status = "CANCELLED";
break;
case job_lifecycle_t::ERROR:
status = "ERROR";
break;
case job_lifecycle_t::INIT:
default:
status = "INIT";
break;
}
return;
}

}
}

/*
* vi:tabstop=4 shiftwidth=4 expandtab
*/
61 changes: 61 additions & 0 deletions resource/jobinfo/jobinfo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*****************************************************************************\
* Copyright (c) 2014 Lawrence Livermore National Security, LLC. Produced at
* the Lawrence Livermore National Laboratory (cf, AUTHORS, DISCLAIMER.LLNS).
* LLNL-CODE-658032 All rights reserved.
*
* This file is part of the Flux resource manager framework.
* For details, see https://github.com/flux-framework.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the license, or (at your option)
* any later version.
*
* Flux is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the terms and conditions of the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* See also: http://www.gnu.org/licenses/
\*****************************************************************************/

#ifndef JOBINFO_HPP
#define JOBINFO_HPP

#include <string>

namespace Flux {
namespace resource_model {

enum class job_lifecycle_t { INIT, ALLOCATED, RESERVED, CANCELLED, ERROR };

struct job_info_t {
job_info_t (uint64_t j, job_lifecycle_t s, int64_t at,
const std::string &j_fn, const std::string &jstr,
const std::string &R_str, double o);

job_info_t (uint64_t j, job_lifecycle_t s, int64_t at,
const std::string &j_fn, const std::string &jstr, double o);

uint64_t jobid = UINT64_MAX;
job_lifecycle_t state = job_lifecycle_t::INIT;
int64_t scheduled_at = -1;
std::string jobspec_fn;
std::string jobspec_str;
std::string R;
double overhead = 0.0f;
};

void get_jobstate_str (job_lifecycle_t state, std::string &status);

} // namespace resource_model
} // namespace Flux

#endif // JOBINFO_HPP

/*
* vi:tabstop=4 shiftwidth=4 expandtab
*/
Loading