yggdrasil.databricks.job.service¶
service ¶
Databricks Jobs service — collection-level job and run management.
:class:Jobs wraps the Databricks SDK JobsAPI with sensible defaults,
cluster integration, and the yggdrasil tagging contract. :class:JobRuns
provides run-level listing and retrieval across all jobs or scoped to one.
Individual job lifecycle (run, update, delete) lives on the
:class:~yggdrasil.databricks.job.job.Job resource. Individual run
lifecycle (wait, cancel, repair) lives on
:class:~yggdrasil.databricks.job.run.JobRun.
Jobs ¶
Bases: DatabricksService
Collection-level Databricks job management.
Listing, finding, creating, and updating jobs live here, as does
:meth:submit for one-time runs that aren't backed by a persisted job.
Individual job lifecycle operations live on the :class:Job resource.
Getter methods accept a positional obj that can be a :class:Job,
an int (job id), or a str. Strings that are purely numeric
are treated as ids; everything else is treated as a job name::
jobs.get(12345) # by id
jobs.get("12345") # numeric string → by id
jobs.get("my-etl-job") # by name
jobs["my-etl-job"] # __getitem__ delegates to get
environments
property
¶
Base-environment service (shorthand for client.environments).
tables
property
¶
Collection-level Unity Catalog table service (shorthand for client.tables).
views
property
¶
Alias for :attr:tables — :class:Table covers both managed/external
tables and view-shaped securables.
catalogs
property
¶
Collection-level Unity Catalog hierarchy service (shorthand for client.catalogs).
schemas
property
¶
Collection-level Unity Catalog schema service (shorthand for client.schemas).
volumes
property
¶
Collection-level Unity Catalog volume service (shorthand for client.volumes).
get ¶
get(
obj: "Job | int | str | None" = None,
*,
job_id: int | None = None,
name: str | None = None,
default: Any = ...
) -> Optional["Job"]
Resolve a job by id or name.
Parameters¶
obj:
Positional shortcut — Job (returned as-is), int
(job id), or str (numeric → id, otherwise → name).
job_id:
Explicit job id.
name:
Explicit job name.
default:
Returned when the job is not found. ... (the default)
raises :class:ResourceDoesNotExist.
submit ¶
submit(
*,
run_name: str | None = None,
tasks: list["SubmitTask | dict"] | None = None,
cluster: "Cluster | str | None" = None,
environment: "Any | str | None" = None,
timeout_seconds: int | None = None,
wait: WaitingConfigArg = False,
raise_error: bool = True,
**submit_kwargs: Any
) -> "JobRun"
Submit a one-time run without creating a persisted job.
Mirrors the SDK jobs.submit one-shot API: the run executes
immediately and is not backed by a saved job definition (so it
has a run_id but no job_id). Returns an awaitable
:class:JobRun, exactly like :meth:Job.run.
Tasks are :class:SubmitTask (not :class:Task) — the SDK uses a
distinct task type for one-time runs. Dicts are coerced. When a
cluster is given, it backfills existing_cluster_id on any
task that doesn't already pin a cluster.
Parameters¶
run_name:
Display name for the run.
tasks:
List of :class:SubmitTask or dicts.
cluster:
Default cluster for tasks that don't specify their own.
environment:
Serverless environment for tasks that don't pin a cluster.
A :class:JobEnvironment is used directly; a str names a
seeded serverless base environment (or a workspace path to its
.yml spec) present in the shared environment path. When
given, it's attached to the run's environments and its key
is backfilled onto every cluster-less, key-less task — so the
verbose environments=[…] + per-task environment_key
boilerplate collapses to one argument. None (default)
leaves submit behaviour unchanged.
timeout_seconds:
Overall run timeout.
wait:
False (default) = fire-and-forget; True = block until
terminal; a number = timeout in seconds.
raise_error:
Raise on terminal failure when waiting.
default_tags ¶
Return default resource tags for Databricks assets.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
A dict of default tags. |
JobRuns ¶
Bases: DatabricksService
Collection-level run management — listing and retrieving runs.
Getter methods accept a positional obj that can be a
:class:JobRun, an int (run id), or a numeric str::
job_runs.get(98765) # by run id
job_runs.get("98765") # numeric string → by run id
environments
property
¶
Base-environment service (shorthand for client.environments).
tables
property
¶
Collection-level Unity Catalog table service (shorthand for client.tables).
views
property
¶
Alias for :attr:tables — :class:Table covers both managed/external
tables and view-shaped securables.
catalogs
property
¶
Collection-level Unity Catalog hierarchy service (shorthand for client.catalogs).
schemas
property
¶
Collection-level Unity Catalog schema service (shorthand for client.schemas).
volumes
property
¶
Collection-level Unity Catalog volume service (shorthand for client.volumes).
list ¶
list(
obj: "Job | int | str | None" = None,
*,
job_id: int | None = None,
name: str | None = None,
active_only: bool = False,
completed_only: bool = False,
expand_tasks: bool = False,
limit: int | None = None
) -> Iterator["JobRun"]
List runs, optionally scoped to a job.
Parameters¶
obj:
Positional shortcut for the owning job — Job, int
(job id), or str (numeric → job id, otherwise → job name
resolved via :meth:Jobs.get).
get ¶
get(
obj: "JobRun | int | str | None" = None,
*,
run_id: int | None = None,
default: Any = ...
) -> Optional["JobRun"]
Retrieve a single run by id.
Parameters¶
obj:
Positional shortcut — JobRun (returned as-is), int
(run id), or numeric str.
run_id:
Explicit run id.
default:
Returned when the run is not found. ... raises.
default_tags ¶
Return default resource tags for Databricks assets.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
A dict of default tags. |