diff --git a/boaapi/boa_client.py b/boaapi/boa_client.py index 6e646df..3dc771c 100644 --- a/boaapi/boa_client.py +++ b/boaapi/boa_client.py @@ -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__) diff --git a/boaapi/job_handle.py b/boaapi/job_handle.py index 88a245e..767d05f 100644 --- a/boaapi/job_handle.py +++ b/boaapi/job_handle.py @@ -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)