Skip to content

sift_client.sift_types.job

Job types for the Sift API.

CLASS DESCRIPTION
JobType

Type of job.

JobStatus

Status of a job.

DataImportStatusDetails

Status details for a data import job.

DataExportStatusDetails

Status details for a data export job.

RuleEvaluationStatusDetails

Status details for a rule evaluation job.

DataImportDetails

Details for a data import job.

DataExportDetails

Details for a data export job.

RuleEvaluationDetails

Details for a rule evaluation job.

Job

A job in the Sift system.

ATTRIBUTE DESCRIPTION
JobStatusDetails

JobDetails

JobStatusDetails module-attribute

JobDetails module-attribute

JobType

Bases: str, Enum

Type of job.

METHOD DESCRIPTION
to_filter_str

Convert to string representation.

to_proto

Convert to proto enum value.

from_proto

Create from proto enum value.

ATTRIBUTE DESCRIPTION
RULE_EVALUATION

DATA_IMPORT

DATA_EXPORT

RULE_EVALUATION class-attribute instance-attribute

RULE_EVALUATION = 'RULE_EVALUATION'

DATA_IMPORT class-attribute instance-attribute

DATA_IMPORT = 'DATA_IMPORT'

DATA_EXPORT class-attribute instance-attribute

DATA_EXPORT = 'DATA_EXPORT'

to_filter_str

to_filter_str() -> str

Convert to string representation.

to_proto

to_proto() -> int

Convert to proto enum value.

from_proto classmethod

from_proto(proto_value: int) -> JobType

Create from proto enum value.

JobStatus

Bases: str, Enum

Status of a job.

METHOD DESCRIPTION
to_filter_str

Convert to string representation.

from_proto

Create from proto enum value.

ATTRIBUTE DESCRIPTION
CREATED

RUNNING

FINISHED

FAILED

CANCELLED

CANCEL_REQUESTED

CREATED class-attribute instance-attribute

CREATED = 'CREATED'

RUNNING class-attribute instance-attribute

RUNNING = 'RUNNING'

FINISHED class-attribute instance-attribute

FINISHED = 'FINISHED'

FAILED class-attribute instance-attribute

FAILED = 'FAILED'

CANCELLED class-attribute instance-attribute

CANCELLED = 'CANCELLED'

CANCEL_REQUESTED class-attribute instance-attribute

CANCEL_REQUESTED = 'CANCEL_REQUESTED'

to_filter_str

to_filter_str() -> str

Convert to string representation.

from_proto classmethod

from_proto(proto_value: int) -> JobStatus

Create from proto enum value.

DataImportStatusDetails pydantic-model

Bases: BaseModel

Status details for a data import job.

Fields:

points_processed pydantic-field

points_processed: int

points_total pydantic-field

points_total: int

DataExportStatusDetails pydantic-model

Bases: BaseModel

Status details for a data export job.

Fields:

error_message pydantic-field

error_message: str | None = None

RuleEvaluationStatusDetails pydantic-model

Bases: BaseModel

Status details for a rule evaluation job.

DataImportDetails pydantic-model

Bases: BaseModel

Details for a data import job.

Fields:

data_import_id pydantic-field

data_import_id: str

DataExportDetails pydantic-model

Bases: BaseModel

Details for a data export job.

Fields:

storage_key pydantic-field

storage_key: str

RuleEvaluationDetails pydantic-model

Bases: BaseModel

Details for a rule evaluation job.

Fields:

report_id pydantic-field

report_id: str

Job pydantic-model

Bases: BaseType[Job, 'Job']

A job in the Sift system.

Jobs represent long-running operations like data imports, rule evaluations, and data exports.

Fields:

organization_id pydantic-field

organization_id: str

created_by_user_id pydantic-field

created_by_user_id: str

modified_by_user_id pydantic-field

modified_by_user_id: str

created_date pydantic-field

created_date: datetime

modified_date pydantic-field

modified_date: datetime

job_type pydantic-field

job_type: JobType

job_status pydantic-field

job_status: JobStatus

started_date pydantic-field

started_date: datetime | None

completed_date pydantic-field

completed_date: datetime | None

job_status_details pydantic-field

job_status_details: JobStatusDetails | None

job_details pydantic-field

job_details: JobDetails | None

is_in_progress property

is_in_progress: bool

Return True if the job is in progress, False otherwise.

A job is in progress if its status is RUNNING.

is_failed property

is_failed: bool

Return True if the job has failed, False otherwise.

A job has failed if its status is FAILED.

is_finished property

is_finished: bool

Return True if the job has finished, False otherwise.

A job has finished if its status is FINISHED.

is_cancelled property

is_cancelled: bool

Return True if the job has been cancelled, False otherwise.

A job has been cancelled if its status is CANCELLED.

model_config class-attribute instance-attribute

model_config = ConfigDict(frozen=True)

id_ pydantic-field

id_: str | None = None

proto pydantic-field

proto: Any | None = None

client property

client: SiftClient

refresh

refresh() -> Job

Refresh this job with the latest data from the API.

RETURNS DESCRIPTION
Job

The updated Job object.

cancel

cancel() -> None

Cancel this job.

If the job hasn't started yet, it will be cancelled immediately. Jobs that are already finished, failed, or cancelled are not affected.

retry

retry() -> Job

Retry this job.

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

RETURNS DESCRIPTION
Job

The updated Job object.

wait_until_complete

wait_until_complete(
    *,
    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.

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.

get_data_import

get_data_import() -> DataImport

Get the data import this job ran.

The import's error message and warnings live there, not on the job.

RETURNS DESCRIPTION
DataImport

The DataImport this job ran.

RAISES DESCRIPTION
ValueError

If this is not a data import job.

get_import_run

get_import_run() -> Run

Get the run created by this data import job.

RETURNS DESCRIPTION
Run

The Run associated with this import.

RAISES DESCRIPTION
ValueError

If this is not a data import job or the import has no associated run.

wait_and_download

wait_and_download(
    *,
    polling_interval_secs: int = 5,
    timeout_secs: int | None = None,
    output_dir: str | Path | None = None,
    extract: bool = True,
) -> list[Path]

Wait for a job to complete and download the result files.

Polls the job status at the given interval until the job is FINISHED, FAILED, or CANCELLED, then downloads the result files.

PARAMETER DESCRIPTION
polling_interval_secs

Seconds between status polls. Defaults to 5.

TYPE: int DEFAULT: 5

timeout_secs

Maximum seconds to wait. If None, polls indefinitely.

TYPE: int | None DEFAULT: None

output_dir

Directory to save the downloaded files. If omitted, a temporary directory is created automatically.

TYPE: str | Path | None DEFAULT: None

extract

If True (default) and the downloaded file is a zip, extract it and delete the archive, returning paths to the extracted files. Non-zip files are returned as-is regardless of this flag.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
list[Path]

List of paths to the downloaded/extracted files.

RAISES DESCRIPTION
RuntimeError

If the job fails or is cancelled.

TimeoutError

If the job does not complete within timeout_secs.