Skip to content

Commit

Permalink
Add genie 4 job status (#53)
Browse files Browse the repository at this point in the history
* Add genie 4 job status

* Convert all status to upper case
  • Loading branch information
Hai-Lin authored Aug 7, 2019
1 parent 8f1b36e commit b9fa0e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pygenie/adapter/genie_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def get_genie_log(self, job_id, **kwargs):
def get_status(self, job_id):
"""Get job status."""

return self.get(job_id, path='status', timeout=10).get('status')
return self.get(job_id, path='status', timeout=10).get('status').upper()

def get_stderr(self, job_id, **kwargs):
"""Get a stderr log for a job."""
Expand Down
2 changes: 1 addition & 1 deletion pygenie/adapter/genie_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def get_status(self, job_id, timeout=10):
return self.get(job_id,
path='status',
timeout=None if self.disable_timeout else timeout) \
.get('status')
.get('status').upper()

def get_stderr(self, job_id, **kwargs):
"""Get a stderr log for a job."""
Expand Down
10 changes: 6 additions & 4 deletions pygenie/jobs/running.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
RUNNING_STATUSES = {
'INIT',
'RUNNING',
'init',
'running'
'RESERVED',
'ACCEPTED',
'RESOLVED',
'CLAIMED'
}

INFO_SECTIONS = {
Expand Down Expand Up @@ -263,7 +265,7 @@ def finish_time(self):
int: The finish time in epoch (milliseconds).
"""

status = self.status
status = self.status.upper()

if ('finished' not in self.info) \
or status in RUNNING_STATUSES \
Expand Down Expand Up @@ -587,7 +589,7 @@ def status(self):
str: Job status.
"""
if self._status is None and self.info.get('status'):
self._status = self.info.get('status')
self._status = self.info.get('status').upper()

if (self._status is None) or (self._status in RUNNING_STATUSES):
last_known_status = self._status
Expand Down

0 comments on commit b9fa0e1

Please sign in to comment.