sift_client.resources.jobs
¶
| CLASS | DESCRIPTION |
|---|---|
JobsAPIAsync |
High-level API for interacting with jobs. |
JobsAPIAsync
¶
JobsAPIAsync(sift_client: SiftClient)
Bases: ResourceBase
High-level API for interacting with jobs.
This class provides a Pythonic interface for managing jobs in Sift. Jobs represent long-running operations like data imports, rule evaluations, and data exports.
Initialize the JobsAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
cancel |
Cancel a job. |
get |
Get a job by ID. |
list_ |
List jobs with optional filtering. |
retry |
Retry a failed job. |
wait_until_complete |
Wait until the job is complete or the timeout is reached. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
cancel
async
¶
cancel(job: Job | str) -> None
Cancel a job.
If the job hasn't started yet, it will be cancelled immediately. Jobs that are already finished, failed, or cancelled are not affected.
| PARAMETER | DESCRIPTION |
|---|---|
job
|
The Job or ID of the job to cancel.
TYPE:
|
get
async
¶
get(job_id: str) -> Job
Get a job by ID.
| PARAMETER | DESCRIPTION |
|---|---|
job_id
|
The ID of the job to retrieve.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job
|
The Job object. |
list_
async
¶
list_(
*,
job_ids: list[str] | None = None,
created_after: datetime | None = None,
created_before: datetime | None = None,
modified_after: datetime | None = None,
modified_before: datetime | None = None,
created_by_user_id: str | None = None,
modified_by_user_id: str | None = None,
job_type: JobType | None = None,
job_status: JobStatus | None = None,
started_date_after: datetime | None = None,
started_date_before: datetime | None = None,
completed_date_after: datetime | None = None,
completed_date_before: datetime | None = None,
organization_id: str | None = None,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
) -> list[Job]
List jobs with optional filtering.
| PARAMETER | DESCRIPTION |
|---|---|
job_ids
|
Filter to jobs with any of these IDs.
TYPE:
|
created_after
|
Filter to jobs created after this datetime.
TYPE:
|
created_before
|
Filter to jobs created before this datetime.
TYPE:
|
modified_after
|
Filter to jobs modified after this datetime.
TYPE:
|
modified_before
|
Filter to jobs modified before this datetime.
TYPE:
|
created_by_user_id
|
Filter to jobs created by this user ID.
TYPE:
|
modified_by_user_id
|
Filter to jobs last modified by this user ID.
TYPE:
|
job_type
|
Filter to jobs with this type.
TYPE:
|
job_status
|
Filter to jobs with this status.
TYPE:
|
started_date_after
|
Filter to jobs started after this datetime.
TYPE:
|
started_date_before
|
Filter to jobs started before this datetime.
TYPE:
|
completed_date_after
|
Filter to jobs completed after this datetime.
TYPE:
|
completed_date_before
|
Filter to jobs completed before this datetime.
TYPE:
|
organization_id
|
Organization ID. Required if your user belongs to multiple organizations.
TYPE:
|
filter_query
|
Explicit CEL query to filter jobs. If provided, other filter arguments are ignored.
TYPE:
|
order_by
|
Field and direction to order results by.
TYPE:
|
limit
|
Maximum number of jobs to return. If None, returns all matches.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Job]
|
A list of Job objects that match the filter criteria. |
retry
async
¶
wait_until_complete
async
¶
wait_until_complete(
*,
job: Job | str,
polling_interval_secs: int = 5,
timeout_secs: int | None = None,
) -> Job
Wait until the job is complete or the timeout is reached.
Polls the job status at the given interval until the job is FINISHED, FAILED, or CANCELLED, returning the completed Job
| PARAMETER | DESCRIPTION |
|---|---|
job
|
The Job or job_id to wait for.
TYPE:
|
polling_interval_secs
|
Seconds between status polls. Defaults to 5s.
TYPE:
|
timeout_secs
|
Maximum seconds to wait. If None, polls indefinitely. Defaults to None (indefinite).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job
|
The Job in the completed state. |