Skip to content

Commit

Permalink
rebase develop and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
n1mus committed May 19, 2022
1 parent 9020680 commit 6bbd36d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
18 changes: 13 additions & 5 deletions docs/design/job_architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
},
}
```
Expand All @@ -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,
Expand All @@ -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
}
```
Expand Down
12 changes: 6 additions & 6 deletions src/biokbase/narrative/tests/test_jobcomm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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})
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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})
Expand All @@ -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
Expand Down

0 comments on commit 6bbd36d

Please sign in to comment.