fix(harness): jobrun and setpend report an unknown job as not found (bug-1907)
The controller acknowledges job dispatch and pend-reason requests with status 0 before looking the job up, and the scheduler relies on that early acknowledgement, so the harness now looks the job up first (job_exists_or_report) and reports "not found" like the other single-job commands (job-array-one-based-index Req 4.7, 5.13). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0f4effe7df
commit
47551fb21d
1 changed files with 54 additions and 0 deletions
|
|
@ -3257,6 +3257,49 @@ static int jobinfo_thunk(void* ctxp)
|
|||
return call->rc;
|
||||
}
|
||||
|
||||
/* bug-1907: the controller acknowledges jobrun (job dispatch) and setpend
|
||||
* (pend reason) with status 0 before it looks the job up -- the scheduler
|
||||
* relies on that early acknowledgement -- so those commands look the job
|
||||
* up first and report "not found" like every other single-job command
|
||||
* (job-array-one-based-index Req 4.7, 5.13). Returns 0 when the job
|
||||
* exists, -ENOENT after reporting it missing, or the RPC error. */
|
||||
static int job_exists_or_report(const char* cmd, uint64_t jobid,
|
||||
const char* arg, int had_index)
|
||||
{
|
||||
jobinfo_call_t* call = (jobinfo_call_t*)calloc(1, sizeof(*call));
|
||||
xce_job_t* job;
|
||||
int rc;
|
||||
|
||||
if (call == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
call->conn = active_ctx->ctx;
|
||||
call->jobid = jobid;
|
||||
|
||||
rc = xcetest_run_interruptible(jobinfo_thunk, call);
|
||||
if (rc == -EINTR) {
|
||||
/* `call` now belongs to the still-running worker thread */
|
||||
errno = EINTR;
|
||||
perror(cmd);
|
||||
return rc;
|
||||
}
|
||||
|
||||
job = call->job;
|
||||
free(call);
|
||||
|
||||
rc = cmdutil_job_lookup_report(stderr, cmd, rc, job, arg, had_index);
|
||||
if (rc == -ENOENT) {
|
||||
errno = ENOENT;
|
||||
} else if (rc < 0) {
|
||||
cmdutil_rpc_error("xcecli_jobinfo", rc);
|
||||
}
|
||||
if (job != NULL) {
|
||||
free_Job_ptr(&job);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int cmd_jobinfo(int argc, char* argv[])
|
||||
{
|
||||
int opt;
|
||||
|
|
@ -3512,6 +3555,11 @@ int cmd_jobrun(int argc, char* argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
rc = job_exists_or_report("jobrun", jobid, jobarg, had_index);
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
{
|
||||
jobrun_call_t* call = (jobrun_call_t*)calloc(1, sizeof(*call));
|
||||
|
||||
|
|
@ -5165,6 +5213,12 @@ int cmd_setpend(int argc, char* argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
rc = job_exists_or_report("setpend", preason.jobid, jobarg, had_index);
|
||||
if (rc < 0) {
|
||||
erase_job_preason(&jreasons);
|
||||
return rc;
|
||||
}
|
||||
|
||||
{
|
||||
setpend_call_t* call = (setpend_call_t*)calloc(1, sizeof(*call));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue