-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testsuite: cover python kvslookup
base
option
Problem: There is no coverage for the 'base' option and the "R" key in job kvs lookup via Python. Add some coverage in python/t0014-job-kvslookup.py. Use a jobtap plugin to generate resource-update event for tests.
- Loading branch information
Showing
3 changed files
with
176 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/************************************************************\ | ||
* Copyright 2023 Lawrence Livermore National Security, LLC | ||
* (c.f. AUTHORS, NOTICE.LLNS, COPYING) | ||
* | ||
* This file is part of the Flux resource manager framework. | ||
* For details, see https://github.com/flux-framework. | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0 | ||
\************************************************************/ | ||
|
||
/* jobspec-update-job-list.c - test jobspec-update event in job-list | ||
* module | ||
*/ | ||
|
||
#include <flux/core.h> | ||
#include <flux/jobtap.h> | ||
|
||
#include "ccan/str/str.h" | ||
#include "src/common/libutil/errprintf.h" | ||
|
||
static int run_cb (flux_plugin_t *p, | ||
const char *topic, | ||
flux_plugin_arg_t *args, | ||
void *data) | ||
{ | ||
double expiration; | ||
flux_jobid_t id; | ||
|
||
if (flux_plugin_arg_unpack (args, | ||
FLUX_PLUGIN_ARG_IN, | ||
"{s:I s:{s:{s:F}}}", | ||
"id", &id, | ||
"R", | ||
"execution", | ||
"expiration", &expiration) < 0) { | ||
flux_jobtap_raise_exception (p, | ||
FLUX_JOBTAP_CURRENT_JOB, | ||
"resource-update", 0, | ||
"unpack failure"); | ||
return -1; | ||
} | ||
|
||
if (flux_jobtap_event_post_pack (p, | ||
id, | ||
"resource-update", | ||
"{s:f}", | ||
"expiration", expiration + 3600.) < 0) { | ||
flux_jobtap_raise_exception (p, | ||
FLUX_JOBTAP_CURRENT_JOB, | ||
"resource-update", 0, | ||
"update failure"); | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
|
||
static const struct flux_plugin_handler tab[] = { | ||
{ "job.state.run", run_cb, NULL }, | ||
{ 0 }, | ||
}; | ||
|
||
int flux_plugin_init (flux_plugin_t *p) | ||
{ | ||
if (flux_plugin_register (p, "resource-update-expiration", tab) < 0) | ||
return -1; | ||
return 0; | ||
} | ||
|
||
// vi:ts=4 sw=4 expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters