Jobs
Define and run user code (JAR or Python) on Onehouse compute clusters. Includes JAR upload helpers.
Methods
| Method | Description |
|---|---|
create_job | Define a job (does not run it) |
create_and_run_job | Define a job and trigger it immediately |
alter_job | Change a job's cluster or parameters |
delete_job | Delete a job |
run_job | Trigger an existing job |
cancel_job_run | Cancel an in-flight job run |
describe_job | Show full configuration for a job |
describe_job_run | Show details of one job run |
show_jobs | List all jobs in the project |
show_runs_in_job | List runs for one job |
upload_jar | Upload a JAR for use by jobs |
replace_jar | Replace an existing JAR |
create_job
create_job(
name: str,
*,
type: str,
parameters: Sequence[str],
cluster: str,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
| Parameter | Required | Type / values |
|---|---|---|
name | yes | str |
type | yes | "JAR", "PYTHON" |
parameters | yes | Sequence[str] — argv-style parameters passed to the job |
cluster | yes | str |
Example
client.create_job(
"nightly_export",
type="PYTHON",
parameters=["--date", "{{ds}}", "--target", "s3://exports/"],
cluster="batch_cluster",
)
create_and_run_job
Same signature as create_job. Defines the job and triggers it in one call.
Example
client.create_and_run_job(
"ad_hoc_export",
type="PYTHON",
parameters=["--full-refresh"],
cluster="batch_cluster",
)
alter_job
alter_job(
name: str,
*,
cluster: str | None = None,
parameters: Sequence[str] | None = None,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
Requires exactly one of cluster or parameters.
Examples
# Move to a different cluster
client.alter_job("nightly_export", cluster="batch_cluster_v2")
# Update parameters
client.alter_job("nightly_export", parameters=["--date", "{{ds}}", "--verbose"])
delete_job
delete_job(name: str, *, unsafe_raw=False, timeout=None, poll_interval=None)
Example
client.delete_job("nightly_export")
run_job
run_job(name: str, *, unsafe_raw=False, timeout=None, poll_interval=None)
Example
client.run_job("nightly_export")
cancel_job_run
cancel_job_run(
job_run_id: str,
*,
job_name: str,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
| Parameter | Required | Type / values |
|---|---|---|
job_run_id | yes | str (positional) — UUID of the run |
job_name | yes | str |
Example
client.cancel_job_run("3afe72cd-1234-...", job_name="nightly_export")
describe_job
describe_job(name: str, *, unsafe_raw=False, timeout=None, poll_interval=None)
Example
result = client.describe_job("nightly_export")
describe_job_run
describe_job_run(
job_run_id: str,
*,
job_name: str,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
Example
result = client.describe_job_run("3afe72cd-1234-...", job_name="nightly_export")
show_jobs
show_jobs(*, timeout=None, poll_interval=None)
Example
result = client.show_jobs()
show_runs_in_job
show_runs_in_job(name: str, *, unsafe_raw=False, timeout=None, poll_interval=None)
Example
result = client.show_runs_in_job("nightly_export")
upload_jar
upload_jar(
name: str,
*,
options: Mapping[str, str] | None = None,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
Example
client.upload_jar("etl-1.2.0.jar", options={"path": "s3://my-bucket/jars/etl-1.2.0.jar"})
replace_jar
replace_jar(
name: str,
*,
options: Mapping[str, str] | None = None,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
Example
client.replace_jar("etl-1.2.0.jar", options={"path": "s3://my-bucket/jars/etl-1.2.1.jar"})