Skip to content

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: SiftClient

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: SiftClient

grpc_client

TYPE: GrpcClient

rest_client

TYPE: RestClient

client property

client: SiftClient

grpc_client property

grpc_client: GrpcClient

rest_client property

rest_client: RestClient

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: Job | str

get async

get(job_id: str) -> Job

Get a job by ID.

PARAMETER DESCRIPTION
job_id

The ID of the job to retrieve.

TYPE: str

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: list[str] | None DEFAULT: None

created_after

Filter to jobs created after this datetime.

TYPE: datetime | None DEFAULT: None

created_before

Filter to jobs created before this datetime.

TYPE: datetime | None DEFAULT: None

modified_after

Filter to jobs modified after this datetime.

TYPE: datetime | None DEFAULT: None

modified_before

Filter to jobs modified before this datetime.

TYPE: datetime | None DEFAULT: None

created_by_user_id

Filter to jobs created by this user ID.

TYPE: str | None DEFAULT: None

modified_by_user_id

Filter to jobs last modified by this user ID.

TYPE: str | None DEFAULT: None

job_type

Filter to jobs with this type.

TYPE: JobType | None DEFAULT: None

job_status

Filter to jobs with this status.

TYPE: JobStatus | None DEFAULT: None

started_date_after

Filter to jobs started after this datetime.

TYPE: datetime | None DEFAULT: None

started_date_before

Filter to jobs started before this datetime.

TYPE: datetime | None DEFAULT: None

completed_date_after

Filter to jobs completed after this datetime.

TYPE: datetime | None DEFAULT: None

completed_date_before

Filter to jobs completed before this datetime.

TYPE: datetime | None DEFAULT: None

organization_id

Organization ID. Required if your user belongs to multiple organizations.

TYPE: str | None DEFAULT: None

filter_query

Explicit CEL query to filter jobs. If provided, other filter arguments are ignored.

TYPE: str | None DEFAULT: None

order_by

Field and direction to order results by.

TYPE: str | None DEFAULT: None

limit

Maximum number of jobs to return. If None, returns all matches.

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
list[Job]

A list of Job objects that match the filter criteria.

retry async

retry(job: Job | str) -> Job

Retry a failed job.

Jobs that are finished, in progress, or in the process of being cancelled are not affected.

PARAMETER DESCRIPTION
job

The Job or ID of the job to retry.

TYPE: Job | str

RETURNS DESCRIPTION
Job

The updated Job object.

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: Job | str

polling_interval_secs

Seconds between status polls. Defaults to 5s.

TYPE: int DEFAULT: 5

timeout_secs

Maximum seconds to wait. If None, polls indefinitely. Defaults to None (indefinite).

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
Job

The Job in the completed state.