Job#
Client for managing asynchronous jobs and status tracking.
Job client for managing asynchronous jobs.
This module provides the JobClient for submitting, monitoring, and
managing background jobs in the Ionworks platform.
- class ionworks.job.JobCreationPayload(*, job_type, params, priority=5, callback_url=None)[source]#
Bases:
BaseModelPayload for creating a job.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.job.JobResponse(*, job_id, status, job_type, params, priority, created_at, updated_at, metadata, error, result)[source]#
Bases:
BaseModelResponse model for job details.
- Parameters:
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.job.JobClient(client)[source]#
Bases:
objectClient for managing asynchronous jobs.
This class provides methods to create, retrieve, list, and cancel jobs in the Ionworks platform.
- Parameters:
client (Any)
- __init__(client)[source]#
Initialize the JobClient.
- Parameters:
client (Any) – The HTTP client instance used for API requests.
- Return type:
None
- create(payload)[source]#
Submit a job using the provided payload.
- Parameters:
payload (JobCreationPayload) – The configuration for the job to be created.
- Returns:
Response containing the job_id and initial status.
- Return type:
- Raises:
requests.exceptions.RequestException – If the API request fails.
ValueError – If the response parsing fails.
- get(job_id)[source]#
Get the status and details of a specific job.
- Parameters:
job_id (str) – The ID of the job to retrieve.
- Returns:
Job details and current status.
- Return type:
- Raises:
ValueError – If the response parsing fails.
- list()[source]#
List all jobs.
- Returns:
List of all jobs with their details.
- Return type:
- Raises:
ValueError – If the response is not a list or job data format is invalid.
- cancel(job_id)[source]#
Cancel a job.
- Parameters:
job_id (str) – The ID of the job to cancel.
- Returns:
Updated job details with canceled status.
- Return type:
- Raises:
ValueError – If the response parsing fails.