Skip to content

Commit

Permalink
job-manager: add alloc_acct_fudge_free()
Browse files Browse the repository at this point in the history
Problem: the housekeeping subsystem will need a way to adjust
R accounting when handling RFC 27 hello responses, since partial
release is not yet supported.

Add alloc_acct_fudge_free() for that purpose, and make acct_free()
able to handle a NULL R now that it no longer purely an internal
function.
  • Loading branch information
garlick committed Mar 21, 2024
1 parent b25954b commit 92b4396
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/modules/job-manager/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ static int acct_free (struct alloc *alloc, json_t *R, flux_error_t *error)

acct_restart (alloc);

if (!R) {
errprintf (error, "resource accounting error (free): R is NULL");
goto done;
}
if (!(rl = rlist_from_json (R, NULL))) {
errprintf (error, "resource accounting error (free): %s", jerror.text);
goto done;
Expand All @@ -137,6 +141,13 @@ static int acct_free (struct alloc *alloc, json_t *R, flux_error_t *error)
return rc;
}

void alloc_acct_fudge_free (struct alloc *alloc, json_t *R, const char *who)
{
flux_error_t error;
if (acct_free (alloc, R, &error) < 0)
flux_log (alloc->ctx->h, LOG_ERR, "%s: %s", who, error.text);
}

static void requeue_pending (struct alloc *alloc, struct job *job)
{
struct job_manager *ctx = alloc->ctx;
Expand Down
5 changes: 5 additions & 0 deletions src/modules/job-manager/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ void alloc_disconnect_rpc (flux_t *h,

bool alloc_sched_ready (struct alloc *alloc);

/* Hook for marking resources free without going through normal channels.
* N.B. Required for RFC 27 workaround in housekeeping_hello_respond().
*/
void alloc_acct_fudge_free (struct alloc *alloc, json_t *R, const char *who);

#endif /* ! _FLUX_JOB_MANAGER_ALLOC_H */

/*
Expand Down

0 comments on commit 92b4396

Please sign in to comment.