provenaclient.utils.async_job_helpers
Created Date: Monday June 17th 2024 +1000 Author: Peter Baker —– Last Modified: Monday June 17th 2024 4:45:39 pm +1000 Modified By: Peter Baker —– Description: Set of helpers for running polling tasks against the job API until completion etc. —– HISTORY: Date By Comments ———- — ———————————————————
Attributes
Exceptions
Raised when poll operation exceeds timeout |
|
Raised when poll operation callback errors |
Functions
|
|
|
The poll callback function which repeatedly polls given func according to spec |
|
Waits for the entry to be in in progress status |
Waits for the entry to appear in the queue |
|
|
Waits for completion. |
Waits for the entire lifecycle of a job, adhering to settings. Uses L2 client. |
|
Waits for the full lifecycle of an async job and asserts that it is successful at the end. |
Module Contents
- provenaclient.utils.async_job_helpers.JOB_FINISHED_STATES
- provenaclient.utils.async_job_helpers.Payload
- provenaclient.utils.async_job_helpers.PollCallbackData
- provenaclient.utils.async_job_helpers.PollCallbackResponse
- provenaclient.utils.async_job_helpers.PollCallbackFunction
- exception provenaclient.utils.async_job_helpers.PollTimeoutException[source]
Bases:
Exception
Raised when poll operation exceeds timeout
- exception provenaclient.utils.async_job_helpers.PollFunctionErrorException[source]
Bases:
Exception
Raised when poll operation callback errors
- async provenaclient.utils.async_job_helpers.poll_callback(poll_interval_seconds: int, timeout_seconds: int, callback: PollCallbackFunction) PollCallbackData [source]
The poll callback function which repeatedly polls given func according to spec
- Parameters:
poll_interval_seconds (int) – The polling interval
timeout_seconds (int) – The timeout to adhere to
callback (PollCallbackFunction) – The call back function itself
- Raises:
PollFunctionErrorException – Unexpected error
PollTimeoutException – Timeout
- Returns:
The resulting data (job status table probably)
- Return type:
PollCallbackData
- async provenaclient.utils.async_job_helpers.wait_for_in_progress(session_id: str, client: provenaclient.clients.JobAPIClient, settings: provenaclient.models.AsyncAwaitSettings) ProvenaInterfaces.AsyncJobAPI.JobStatusTable [source]
Waits for the entry to be in in progress status
- Parameters:
session_id (str) – The session ID
client (JobAPIClient) – The L2 job client
settings (AsyncAwaitSettings) – The settings
- Returns:
The resulting entry
- Return type:
JobStatusTable
- async provenaclient.utils.async_job_helpers.wait_for_entry_in_queue(session_id: str, client: provenaclient.clients.JobAPIClient, settings: provenaclient.models.AsyncAwaitSettings) ProvenaInterfaces.AsyncJobAPI.JobStatusTable [source]
Waits for the entry to appear in the queue
- Parameters:
session_id (str) – The session ID
client (JobAPIClient) – The L2 job client
settings (AsyncAwaitSettings) – The settings
- Raises:
Exception – If non 400 error
- Returns:
The resulting entry
- Return type:
JobStatusTable
- async provenaclient.utils.async_job_helpers.wait_for_completion(session_id: str, client: provenaclient.clients.JobAPIClient, settings: provenaclient.models.AsyncAwaitSettings) ProvenaInterfaces.AsyncJobAPI.JobStatusTable [source]
Waits for completion.
- Parameters:
session_id (str) – The session ID
client (JobAPIClient) – The L2 job client
settings (AsyncAwaitSettings) – The settings
- Returns:
The resulting entry
- Return type:
JobStatusTable
- async provenaclient.utils.async_job_helpers.wait_for_full_lifecycle(session_id: str, client: provenaclient.clients.JobAPIClient, settings: provenaclient.models.AsyncAwaitSettings) ProvenaInterfaces.AsyncJobAPI.JobStatusTable [source]
Waits for the entire lifecycle of a job, adhering to settings. Uses L2 client.
- Parameters:
session_id (str) – The session ID to await
client (JobAPIClient) – The client to utilise
settings (AsyncAwaitSettings) – The settings including timeouts
- Returns:
The resulting entry
- Return type:
JobStatusTable
- async provenaclient.utils.async_job_helpers.wait_for_full_successful_lifecycle(session_id: str, client: provenaclient.clients.JobAPIClient, settings: provenaclient.models.AsyncAwaitSettings) ProvenaInterfaces.AsyncJobAPI.JobStatusTable [source]
Waits for the full lifecycle of an async job and asserts that it is successful at the end.
- Parameters:
session_id (str) – The session ID to await
client (JobAPIClient) – The client
settings (AsyncAwaitSettings) – The settings
- Returns:
The resulting successful job
- Return type:
JobStatusTable