-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update job status in case of actinia error #152
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,10 +80,32 @@ def get(self, job_id): | |
|
||
# Store the updated job in the database | ||
self.job_db[job_id] = job | ||
else: | ||
elif code == 400: | ||
# actinia response contains only status and message | ||
if job.additional_info != job_info: | ||
job.additional_info = job_info | ||
if job_info["status"] == "finished": | ||
job.status = "finished" | ||
if job_info["status"] == "error": | ||
job.status = "error" | ||
if job_info["status"] == "accepted": | ||
job.status = "queued" | ||
if job_info["status"] == "terminated": | ||
job.status = "canceled" | ||
if job_info["status"] == "running": | ||
job.status = "running" | ||
|
||
# Store the updated job in the database | ||
self.job_db[job_id] = job | ||
else: | ||
# other 4xx errors | ||
Comment on lines
+100
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment is misleading as all other HTTP codes are handled here, including eg. internal server errors 5xx |
||
if job.additional_info != job_info: | ||
job.additional_info = job_info | ||
|
||
job.status = "error" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be dangerous. IIUC, the job status is always updated here on http codes not |
||
|
||
# Store the updated job in the database | ||
self.job_db[job_id] = job | ||
|
||
if (job.additional_info['urls'] and | ||
"resources" in job.additional_info['urls']): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,10 +81,32 @@ def get(self, job_id): | |
|
||
# Store the updated job in the database | ||
self.job_db[job_id] = job | ||
else: | ||
elif code == 400: | ||
# actinia response contains only status and message | ||
if job.additional_info != job_info: | ||
job.additional_info = job_info | ||
if job_info["status"] == "finished": | ||
job.status = "finished" | ||
if job_info["status"] == "error": | ||
job.status = "error" | ||
if job_info["status"] == "accepted": | ||
job.status = "queued" | ||
if job_info["status"] == "terminated": | ||
job.status = "canceled" | ||
if job_info["status"] == "running": | ||
job.status = "running" | ||
|
||
# Store the updated job in the database | ||
self.job_db[job_id] = job | ||
else: | ||
# other 4xx errors | ||
if job.additional_info != job_info: | ||
job.additional_info = job_info | ||
|
||
job.status = "error" | ||
|
||
# Store the updated job in the database | ||
self.job_db[job_id] = job | ||
Comment on lines
+84
to
+109
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same 3 comments here as above. |
||
|
||
if (job.additional_info['urls'] and | ||
"resources" in job.additional_info['urls']): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Unfortunately I cannot make a suggestion in the unchanged lines above, so explaining here)
Why not merge
if code == 200
andelif code == 400
to aif code == 200 or code == 400
block? This way, inconsistencies don't matter, e.g. that there most likely is nofinished
status with a 400 http code.