Skip to main content

job_runs

Creates, updates, deletes, gets or lists a job_runs resource.

Overview

Namejob_runs
TypeResource
Iddatabricks_workspace.workflows.job_runs

Fields

The following fields are returned by SELECT queries:

Request completed successfully.

NameDatatypeDescription
job_idinteger
job_run_idinteger
original_attempt_run_idinteger
run_idinteger
creator_user_namestring
run_namestring
attempt_numberinteger
cleanup_durationinteger
cluster_instanceobject
cluster_specobject
descriptionstring
end_timeinteger
execution_durationinteger
git_sourceobject
has_moreboolean
job_clustersarray
job_parametersarray
number_in_jobinteger
overriding_parametersobject
queue_durationinteger
repair_historyarray
run_durationinteger
run_page_urlstring
run_typestring
scheduleobject
setup_durationinteger
start_timeinteger
stateobject
statusobject
tasksarray
triggerstring
trigger_infoobject

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listrunsselectdeployment_nameList runs in descending order by start time.
getrunselectdeployment_nameRetrieves the metadata of a run.
deleterundeletedeployment_nameDeletes a non-active run. Returns an error if the run is active.
cancelallrunsexecdeployment_nameCancels all active runs of a job. The runs are canceled asynchronously, so it doesn't prevent new runs from being started.
cancelrunexecdeployment_nameCancels a job run or a task run. The run is canceled asynchronously, so it may still be running when this request completes.
exportrunexecdeployment_nameExport and retrieve the job run task.
repairrunexecdeployment_nameRe-run one or more tasks. Tasks are re-run as part of the original job run. They use the current job and task settings, and can be viewed in the history for the original job run.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)

SELECT examples

List runs in descending order by start time.

SELECT
job_id,
job_run_id,
original_attempt_run_id,
run_id,
creator_user_name,
run_name,
attempt_number,
cleanup_duration,
cluster_instance,
cluster_spec,
description,
end_time,
execution_duration,
git_source,
has_more,
job_clusters,
job_parameters,
number_in_job,
overriding_parameters,
queue_duration,
repair_history,
run_duration,
run_page_url,
run_type,
schedule,
setup_duration,
start_time,
state,
status,
tasks,
trigger,
trigger_info
FROM databricks_workspace.workflows.job_runs
WHERE deployment_name = '{{ deployment_name }}' -- required;

DELETE examples

Deletes a non-active run. Returns an error if the run is active.

DELETE FROM databricks_workspace.workflows.job_runs
WHERE deployment_name = '{{ deployment_name }}' --required;

Lifecycle Methods

Cancels all active runs of a job. The runs are canceled asynchronously, so it doesn't prevent new runs from being started.

EXEC databricks_workspace.workflows.job_runs.cancelallruns 
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"job_id": {{ job_id }},
"all_queued_runs": {{ all_queued_runs }}
}';