Skip to content

JobsClientSync

relationalai.services.jobs.client_sync
JobsClientSync(gateway: JobsGatewaySync, *, config: "Config | None" = None)

Synchronous jobs client (public API for connect_sync()).

JobsClientSync.close() -> None

Close underlying resources (best-effort).

Note: current sync gateways are SQL-only and typically have nothing to close.

Returns:

  • None - Always returns None.
JobsClientSync.get(
reasoner_type: str, job_id: str, *, include: JobIncludeDict | None = None
) -> Job | None

Get a normalized job/transaction by (reasoner_type, job_id).

By default returns a stable common schema. Use include= to opt into backend-specific expansions (e.g. details, events, artifacts, problems, raw).

Returns:

  • Job | None - The job/transaction, or None if not found.
JobsClientSync.create(
reasoner_type: str,
reasoner_name: str,
payload: dict[str, Any],
*,
timeout_mins: int | None = None
) -> JobOperationSync

Start a job/transaction and return a non-blocking operation handle (sync).

Note: reasoner_name identifies which reasoner/worker to run on.

Returns:

  • JobOperationSync - An operation handle; call op.wait(...) to block for completion.
JobsClientSync.create_ready(
reasoner_type: str,
reasoner_name: str,
payload: dict[str, Any],
*,
timeout_mins: int | None = None,
timeout_s: float = 900,
poll_interval_s: float = 0.5,
include: JobIncludeDict | None = None
) -> Job

Create a job and block until it reaches a terminal state.

Returns:

  • Job - The final job/transaction (possibly expanded when include= is provided).
JobsClientSync.list(
reasoner_type: str | None = None,
*,
job_id: str | None = None,
state: str | None = None,
name: str | None = None,
created_by: str | None = None,
only_active: bool = False,
all_users: bool = False,
limit: int | None = None,
include: JobIncludeDict | None = None
) -> list[Job]

List jobs/transactions, optionally filtered and optionally expanded (sync).

If reasoner_type is None, lists across all supported job types and merges the results, sorting by created_on (desc).

Returns:

  • list[Job] - Matching jobs/transactions (possibly expanded when include= is provided).
JobsClientSync.get_events(
reasoner_type: str,
job_id: str,
continuation_token: str = "",
*,
stream_name: str = "progress"
) -> JobEvents

Get events for a job or transaction.

Works for all reasoner types and backends:

  • LOGIC (DA): GET /v1alpha1/transactions/{txn_id}/events/{stream_name}
  • LOGIC (SQL): {app}.api.get_own_transaction_events(txn_id, continuation_token)
  • Non-LOGIC (DA): GET /v1alpha1/jobs/{job_type}/{job_id}/events/{stream_name}
  • Non-LOGIC (SQL): {app}.{schema}.GET_JOB_EVENTS(reasoner_type, job_id, token)

Returns:

  • JobEvents - Event page including events and an optional continuation_token.
JobsClientSync.cancel(reasoner_type: str, job_id: str, *, all_users: bool = False) -> None

Cancel a running job/transaction (sync).

Cancellation is supported for both non-LOGIC jobs and LOGIC transactions.

cancel(all_users=True) is only supported for LOGIC transactions; non-LOGIC jobs reject it.

Returns:

  • None - Always returns None.
JobsClientSync.wait(
reasoner_type: str,
job_id: str,
*,
timeout_s: float = 900,
poll_interval_s: float = 0.5,
include: JobIncludeDict | None = None
) -> Job

Poll get(...) until the execution reaches a terminal state (sync).

Raises JobTimeoutError when timeout_s is exceeded.

Returns:

  • Job - The final job/transaction (possibly expanded when include= is provided).
JobsClientSync.get_operation(reasoner_type: str, job_id: str) -> Operation

Derive a normalized operation status from the current job state.

Returns:

  • Operation - A normalized operation status.