Skip to content
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

Reduce sleep time in task polling #98

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions firecrest/BasicClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ def submit(

# Inject taskid in the result
result = self._poll_tasks(
json_response["task_id"], "200", itertools.cycle([1, 5, 10])
json_response["task_id"], "200", itertools.cycle([1])
)
result["firecrest_taskid"] = json_response["task_id"]
return result
Expand Down Expand Up @@ -1040,7 +1040,7 @@ def poll(
json_response = self._acct_request(machine, jobids, start_time, end_time, page_size, page_number)
logger.info(f"Job polling task: {json_response['task_id']}")
res = self._poll_tasks(
json_response["task_id"], "200", itertools.cycle([1, 5, 10])
json_response["task_id"], "200", itertools.cycle([1])
)
# When there is no job in the sacct output firecrest will return an empty dictionary instead of list
if isinstance(res, dict):
Expand Down Expand Up @@ -1077,7 +1077,7 @@ def poll_active(
json_response = self._squeue_request(machine, jobids, page_size, page_number)
logger.info(f"Job active polling task: {json_response['task_id']}")
dict_result = self._poll_tasks(
json_response["task_id"], "200", itertools.cycle([1, 5, 10])
json_response["task_id"], "200", itertools.cycle([1])
)
return list(dict_result.values())

Expand All @@ -1100,7 +1100,7 @@ def cancel(self, machine: str, job_id: str | int) -> str:
json_response = self._json_response(self._current_method_requests, 200)
logger.info(f"Job cancellation task: {json_response['task_id']}")
return self._poll_tasks(
json_response["task_id"], "200", itertools.cycle([1, 5, 10])
json_response["task_id"], "200", itertools.cycle([1])
)

# Storage
Expand Down Expand Up @@ -1177,7 +1177,7 @@ def submit_move_job(
)
logger.info(f"Job submission task: {json_response['task_id']}")
return self._poll_tasks(
json_response["task_id"], "200", itertools.cycle([1, 5, 10])
json_response["task_id"], "200", itertools.cycle([1])
)

def submit_copy_job(
Expand Down Expand Up @@ -1220,7 +1220,7 @@ def submit_copy_job(
)
logger.info(f"Job submission task: {json_response['task_id']}")
return self._poll_tasks(
json_response["task_id"], "200", itertools.cycle([1, 5, 10])
json_response["task_id"], "200", itertools.cycle([1])
)

def submit_rsync_job(
Expand Down Expand Up @@ -1263,7 +1263,7 @@ def submit_rsync_job(
)
logger.info(f"Job submission task: {json_response['task_id']}")
return self._poll_tasks(
json_response["task_id"], "200", itertools.cycle([1, 5, 10])
json_response["task_id"], "200", itertools.cycle([1])
)

def submit_delete_job(
Expand Down Expand Up @@ -1304,7 +1304,7 @@ def submit_delete_job(
)
logger.info(f"Job submission task: {json_response['task_id']}")
return self._poll_tasks(
json_response["task_id"], "200", itertools.cycle([1, 5, 10])
json_response["task_id"], "200", itertools.cycle([1])
)

def external_upload(
Expand Down
2 changes: 1 addition & 1 deletion firecrest/ExternalStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(
self._status: Optional[str] = None
self._data = None
self._object_storage_data = None
self._sleep_time = itertools.cycle([1, 5, 10])
self._sleep_time = itertools.cycle([1])
self._responses = previous_responses

@property
Expand Down
Loading