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

modules: Move feasibility/satisfiability checking into a new module #1285

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 12 additions & 4 deletions etc/rc1.d/01-sched-fluxion
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
#!/bin/sh -e

test $(flux getattr rank) -eq 0 || exit 0
if [ -z ${FLUXION_RESOURCE_RC_NOOP} ]; then
if [ $(flux getattr rank) -eq 0 ]; then
flux module reload -f sched-fluxion-resource \
${FLUXION_RESOURCE_OPTIONS:-"load-allowlist=node,core,gpu"}
fi
fi

if [ -z ${FLUXION_RESOURCE_RC_NOOP} ]; then
flux module reload -f sched-fluxion-resource \
if [ $(flux getattr rank) -eq 0 ]; then
flux module reload -f sched-fluxion-feasibility \
${FLUXION_RESOURCE_OPTIONS:-"load-allowlist=node,core,gpu"}
fi
fi

if [ -z ${FLUXION_QMANAGER_RC_NOOP} ]; then
flux module reload -f sched-fluxion-qmanager ${FLUXION_QMANAGER_OPTIONS}
if [ $(flux getattr rank) -eq 0 ]; then
flux module reload -f sched-fluxion-qmanager ${FLUXION_QMANAGER_OPTIONS}
fi
fi

10 changes: 7 additions & 3 deletions etc/rc3.d/01-sched-fluxion
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/sh

test $(flux getattr rank) -eq 0 || exit 0
# Can be loaded on multiple ranks
flux module remove -f sched-fluxion-feasibility

if [ $(flux getattr rank) -eq 0 ]; then
flux module remove -f sched-fluxion-qmanager
flux module remove -f sched-fluxion-resource
fi

flux module remove -f sched-fluxion-qmanager
flux module remove -f sched-fluxion-resource
37 changes: 0 additions & 37 deletions qmanager/modules/qmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,42 +305,6 @@ static void status_request_cb (flux_t *h, flux_msg_handler_t *w, const flux_msg_
flux_log_error (h, "%s: flux_respond_error", __FUNCTION__);
}

static void feasibility_request_cb (flux_t *h,
flux_msg_handler_t *w,
const flux_msg_t *msg,
void *arg)
{
size_t size = 0;
flux_future_t *f = nullptr;
const char *data = nullptr;

if (flux_request_decode_raw (msg, nullptr, (const void **)&data, &size) < 0)
goto error;
if (!(f = flux_rpc_raw (h,
"sched-fluxion-resource.satisfiability",
data,
size,
FLUX_NODEID_ANY,
0))) {
flux_log_error (h, "%s: flux_rpc (sched-fluxion-resource.satisfiability)", __FUNCTION__);
goto error;
}
if (flux_rpc_get_raw (f, (const void **)&data, &size) < 0)
goto error;
if (flux_respond_raw (h, msg, (const void *)data, size) < 0) {
flux_log_error (h, "%s: flux_respond_raw", __FUNCTION__);
goto error;
}
flux_log (h, LOG_DEBUG, "%s: feasibility succeeded", __FUNCTION__);
flux_future_destroy (f);
return;

error:
if (flux_respond_error (h, msg, errno, flux_future_error_string (f)) < 0)
flux_log_error (h, "%s: flux_respond_error", __FUNCTION__);
flux_future_destroy (f);
}

static void params_request_cb (flux_t *h, flux_msg_handler_t *w, const flux_msg_t *msg, void *arg)
{
int saved_errno;
Expand Down Expand Up @@ -599,7 +563,6 @@ static void qmanager_destroy (std::shared_ptr<qmanager_ctx_t> &ctx)

static const struct flux_msg_handler_spec htab[] = {
{FLUX_MSGTYPE_REQUEST, "sched.resource-status", status_request_cb, FLUX_ROLE_USER},
{FLUX_MSGTYPE_REQUEST, "*.feasibility", feasibility_request_cb, FLUX_ROLE_USER},
{FLUX_MSGTYPE_REQUEST, "*.params", params_request_cb, FLUX_ROLE_USER},
FLUX_MSGHANDLER_TABLE_END,
};
Expand Down
20 changes: 18 additions & 2 deletions resource/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
flux_add_plugin ( sched-fluxion-resource MODULE
add_library(sched-fluxion-resource-module SHARED
${CMAKE_CURRENT_SOURCE_DIR}/resource_match.cpp
${CMAKE_CURRENT_SOURCE_DIR}/resource_match.hpp
${CMAKE_CURRENT_SOURCE_DIR}/resource_match_opts.cpp
${CMAKE_CURRENT_SOURCE_DIR}/resource_match_opts.hpp
)
target_link_libraries (sched-fluxion-resource PRIVATE
target_link_libraries (sched-fluxion-resource-module PUBLIC
resource
PkgConfig::JANSSON
PkgConfig::UUID
cppwrappers
)
install(TARGETS sched-fluxion-resource-module LIBRARY)

flux_add_plugin ( sched-fluxion-resource MODULE
${CMAKE_CURRENT_SOURCE_DIR}/resource.cpp
)
flux_add_plugin ( sched-fluxion-feasibility MODULE
${CMAKE_CURRENT_SOURCE_DIR}/feasibility.cpp
)

target_link_libraries (sched-fluxion-resource PRIVATE
sched-fluxion-resource-module
)
target_link_libraries (sched-fluxion-feasibility PRIVATE
sched-fluxion-resource-module
)
Loading