Skip to main content
Version: 1.33.0 (latest) View Markdown

External job runs

New to the SDK? Getting started shows how to connect and use it.

ExternalJobRuns​

The runs external runners report in one workspace.

ExternalJobRuns.start()​

start(
*,
job_ref: str,
external_id: str,
started_at: datetime,
trigger: str,
dlt_version: str,
refresh: bool = False,
previous_job_run_id: str | None = None,
details: ExternalRunDetails | None = None,
runner_bootstrap_version: int | None = None,
) -> ExternalJobRun

Report that an external runner is about to run an externally controlled job.

Repeating a start with the same external_id answers the run it recorded, so a retried start is safe.

Arguments

NameTypeDescription
job_refstrThe job to run, by its ref.
external_idstrThe run's id on the external runner, unique per workspace.
started_atdatetimeWhen the external runner started the run.
triggerstrWhat fired the run, e.g. manual:<job_ref>.
dlt_versionstrThe dlt version installed where the job runs.
refreshboolWhether to start the run as a refresh.
previous_job_run_idstr | NoneFor a follow-up, the run it follows.
detailsExternalRunDetails | NoneWhat the external runner reports about the run.
runner_bootstrap_versionint | NoneThe newest bootstrap version the runner reads, from dlt_runtime.external.runner_bootstrap_version().

Returns: ExternalJobRun — The run and its bootstrap; awaitable in async mode. A repeated start for a run that has ended carries no bootstrap.

Raises

ExceptionWhen
BadRequestThe job is archived or not externally controlled, the details pass 16 KB, or the runner is too old for dltHub (code is runner_too_old).
ConflictThe job would not take the run, e.g. it is paused or at its concurrency limit; code says why, and no run is recorded.
NotAuthorizedOnly the owner of the workspace's organization reports external runs.
NotFoundNo job with that ref.
ServerErrorThe run could not be started on its data plane.
ScopeMissingReached without a workspace in scope.

ExternalJobRuns.get()​

get(*, id: str) -> ExternalJobRun

Return one external run by id; it never carries a bootstrap.

Arguments

NameTypeDescription
idstrThe run's uuid.

Returns: ExternalJobRun — The run; awaitable in async mode.

Raises

ExceptionWhen
BadRequestThe id is not a uuid.
NotFoundNo external run with that id in this workspace.
ScopeMissingReached without a workspace in scope.

ExternalJobRuns.finish()​

finish(
*,
id: str,
status: ExternalRunEnd,
finished_at: datetime,
details: ExternalRunDetails | None = None,
) -> ExternalJobRun

Report how an external run ended.

A run that already ended is answered as recorded.

Arguments

NameTypeDescription
idstrThe run's uuid, as its start answered it.
statusExternalRunEndHow the run ended.
finished_atdatetimeWhen the external runner ended the run.
detailsExternalRunDetails | NoneMerged into the start's details; error says why a failed run failed.

Returns: ExternalJobRun — The ended run; awaitable in async mode.

Raises

ExceptionWhen
BadRequestThe run is not external, or the details together pass 16 KB.
NotAuthorizedOnly the owner of the workspace's organization reports external runs.
NotFoundNo such run in this workspace.
ServerErrorThe run's end could not be applied.
ScopeMissingReached without a workspace in scope.

ExternalJobRun​

Subclass of JobRun[M].

A run of an externally controlled job, as its external runner reported it.

Only its external runner ends it, with ExternalJobRuns.finish(): dltHub refuses cancel() for it.

Attributes

NameTypeDescription
bootstrapMapping[str, Any] | NoneThe document the external runner hands our runner as bootstrap.json, written as is; answered only by ExternalJobRuns.start(), and None once the run has ended. It carries the run's credentials: keep it secret.

ExternalRunEnd​

ExternalRunEnd = Literal[JobRunStatus.COMPLETED, JobRunStatus.FAILED, JobRunStatus.CANCELLED]

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.