Skip to content

Commit

Permalink
add output_size() method for job handles
Browse files Browse the repository at this point in the history
  • Loading branch information
psybers committed Sep 12, 2019
1 parent 5f6b5a3 commit 1599035
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions boaapi/boa_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,17 @@ def output(self, job):
return self.server.job.output(job.id)
except xmlrpc.client.Fault as e:
raise BoaException(e).with_traceback(e.__traceback__)

def output_size(self, job):
"""Return the output size for this job, if it finished successfully and has an output.
Raises:
BoaException: if theres an issue reading from the server
"""
self.ensure_logged_in()
try:
if job.exec_status != "Finished":
return "Job is currently running"
return self.server.job.outputsize(job.id)
except xmlrpc.client.Fault as e:
raise BoaException(e).with_traceback(e.__traceback__)
4 changes: 4 additions & 0 deletions boaapi/job_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ def output(self):
"""Return the output for this job, if it finished successfully and has output."""
return self.client.output(self)

def output_size(self):
"""Return the output size for this job, if it finished successfully and has output."""
return self.client.output_size(self)

def refresh(self):
"""Refreshes the cached data for this job."""
job = self.client.get_job(self.id)
Expand Down

0 comments on commit 1599035

Please sign in to comment.