diff --git a/docs/design/job_architecture.md b/docs/design/job_architecture.md index ae41d08abc..9e4901d441 100644 --- a/docs/design/job_architecture.md +++ b/docs/design/job_architecture.md @@ -315,10 +315,16 @@ Bundled job status information for one or more jobs, keyed by job ID, with the f * `job_id` * `jobState` - see [Job output state](#job-output-state) below for the detailed structure * `outputWidgetInfo` - the parameters to send to output widgets, generated from the app specifications and job output. This is only available for completed jobs and is set to null otherwise. + * `last_checked` - timestamp in ns added at comm sending time -In case of error, the response has instead the keys: +In case of per-input-job-ID error, the response has instead the keys: * `job_id` * `error` - brief message explaining the issue + * `last_checked` - timestamp in ns added at comm sending time + +In case that all valid jobs were filtered out by the `ts` input from the frontend, there will be a job-ID-to-job-state pattern breaking key-value pair keyed by "error" with a state keyed by: + * `error` - "No updated jobs" + * `last_checked` - timestamp in ns added at comm sending time Sample response JSON: ```js @@ -330,11 +336,13 @@ Sample response JSON: "status": "running", "created": 123456789, }, - "outputWidgetInfo": null, // only available for completed jobs + "outputWidgetInfo": null, // only available for completed jobs, + "last_checked": 1652992287210343298, }, "job_id_2": { "job_id": "job_id_2", - "error": "Cannot find job with ID job_id_2" + "error": "Cannot find job with ID job_id_2", + "last_checked": 1652992287210343298, }, } ``` @@ -358,7 +366,6 @@ As sent to browser, includes cell info and run info. The structure below indicat "created": epoch ms, "queued": optional - epoch ms, "finished": optional - epoch ms, - "updated": epoch ms, "terminated_code": optional - int, "error": { // optional "code": int, @@ -371,7 +378,8 @@ As sent to browser, includes cell info and run info. The structure below indicat "tag": string (release, beta, dev), "error_code": optional - int, "errormsg": optional - string, - } + }, + "last_checked": int - ns } ``` diff --git a/src/biokbase/narrative/tests/test_jobcomm.py b/src/biokbase/narrative/tests/test_jobcomm.py index 7b6132c0a5..5c00181935 100644 --- a/src/biokbase/narrative/tests/test_jobcomm.py +++ b/src/biokbase/narrative/tests/test_jobcomm.py @@ -752,7 +752,7 @@ def mock_check_job(self_, params): job_state = get_test_job(lookup_id) trim_ee2_state(job_state, params.get("exclude_fields")) if lookup_id in updated_active_ids: - job_state["updated"] += 1 + job_state["created"] += 1 return job_state @@ -766,7 +766,7 @@ def mock_check_jobs(self_, params): trim_ee2_state(job_state, params.get("exclude_fields")) # if job is chosen to be updated, mutate it if job_id in updated_active_ids: - job_state["updated"] += 1 + job_state["created"] += 1 return job_states rq = make_comm_msg(STATUS, job_ids + not_found_ids, False, {"ts": ts}) @@ -779,7 +779,7 @@ def mock_check_jobs(self_, params): for job_id in updated_active_ids } for job_state in expected.values(): - job_state["jobState"]["updated"] += 1 + job_state["jobState"]["created"] += 1 expected[JOB_NOT_FOUND] = { "job_id": JOB_NOT_FOUND, "error": JOB_NOT_REG_2_ERR % JOB_NOT_FOUND @@ -806,7 +806,7 @@ def mock_check_job(self_, params): job_state = get_test_job(lookup_id) trim_ee2_state(job_state, params.get("exclude_fields")) - job_state["updated"] += 1 + job_state["created"] += 1 return job_state @@ -818,7 +818,7 @@ def mock_check_jobs(self_, params): job_states = get_test_jobs(lookup_ids) for _, job_state in job_states.items(): trim_ee2_state(job_state, params.get("exclude_fields")) - job_state["updated"] += 1 + job_state["created"] += 1 return job_states rq = make_comm_msg(STATUS, ALL_JOBS + [JOB_NOT_FOUND], False, {"ts": 0}) @@ -832,7 +832,7 @@ def mock_check_jobs(self_, params): } for job_id, job_state in expected.items(): if job_id in ACTIVE_JOBS: - job_state["jobState"]["updated"] += 1 + job_state["jobState"]["created"] += 1 expected[JOB_NOT_FOUND] = { "job_id": JOB_NOT_FOUND, "error": JOB_NOT_REG_2_ERR % JOB_NOT_FOUND