Skip to content

Commit

Permalink
Fix to paging though jobs list
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-jt79 committed Jun 2, 2021
1 parent 99fe45f commit 8111f69
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pyepic/client/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def list(self, limit=10):
yield result
if count < limit:
while results.next is not None:
offset += limit
offset += get_batch_size
results = instance.job_list(limit=get_batch_size, offset=offset)
for result in results.results:
if count >= limit:
Expand Down Expand Up @@ -164,15 +164,17 @@ def get_step_logs(self, step_id, refresh=True, refresh_timeout=10):
with epiccore.ApiClient(self.configuration) as api_client:
try:
instance = epiccore.JobrefreshApi(api_client)
refresh_obj = instance.jobrefresh_create({"job_step":step_id})
count = 0
while (count < refresh_timeout) and not refresh_obj.response_recieved:
refresh_obj = instance.jobrefresh_create({"job_step": step_id})
count = 0
while (
count < refresh_timeout
) and not refresh_obj.response_recieved:
time.sleep(1)
count += 1
refresh_obj = instance.jobrefresh_create({"job_step": step_id})
except epiccore.exceptions.ApiException as e:
if e.status != 400:
raise(e)
raise (e)
with epiccore.ApiClient(self.configuration) as api_client:
instance = epiccore.JobstepApi(api_client)
return instance.jobstep_logs_read(step_id)
Expand Down Expand Up @@ -213,4 +215,6 @@ def get_job_residual_values(self, job_id, variable_list):
"""
with epiccore.ApiClient(self.configuration) as api_client:
instance = epiccore.JobApi(api_client)
return instance.job_residuals_read(job_id, variables=variable_list).residual_values
return instance.job_residuals_read(
job_id, variables=variable_list
).residual_values
1 change: 1 addition & 0 deletions pyepic/desktops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from .desktop import Desktop
from .desktop import MountType

0 comments on commit 8111f69

Please sign in to comment.