command_execution
Creates, updates, deletes, gets or lists a command_execution resource.
Overview
| Name | command_execution |
| Type | Resource |
| Id | databricks_workspace.compute.command_execution |
Fields
The following fields are returned by SELECT queries:
- command_status
| Name | Datatype | Description |
|---|---|---|
id | string | |
results | object | |
status | string | Create a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />>>> class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access:<br /><br /> >>> Color.RED<br /> <Color.RED: 1><br /><br />- value lookup:<br /><br /> >>> Color(1)<br /> <Color.RED: 1><br /><br />- name lookup:<br /><br /> >>> Color['RED']<br /> <Color.RED: 1><br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />>>> len(Color)<br />3<br /><br />>>> list(Color)<br />[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]<br /><br />Methods can be added to enumerations, and members can have their own<br />attributes -- see the documentation for details. (Cancelled, Cancelling, Error, Finished, Queued, Running) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
command_status | select | cluster_id, context_id, command_id, deployment_name | Gets the status of and, if available, the results from a currently executing command. | |
create | insert | deployment_name | Creates an execution context for running cluster commands. | |
cancel | exec | deployment_name | Cancels a currently running command within an execution context. | |
destroy | exec | deployment_name, clusterId, contextId | Deletes an execution context. | |
execute | exec | deployment_name | Runs a cluster command in the given execution context, using the provided language. |
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.
| Name | Datatype | Description |
|---|---|---|
cluster_id | string | |
command_id | string | |
context_id | string | |
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
SELECT examples
- command_status
Gets the status of and, if available, the results from a currently executing command.
SELECT
id,
results,
status
FROM databricks_workspace.compute.command_execution
WHERE cluster_id = '{{ cluster_id }}' -- required
AND context_id = '{{ context_id }}' -- required
AND command_id = '{{ command_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;
INSERT examples
- create
- Manifest
Creates an execution context for running cluster commands.
INSERT INTO databricks_workspace.compute.command_execution (
clusterId,
language,
deployment_name
)
SELECT
'{{ clusterId }}',
'{{ language }}',
'{{ deployment_name }}'
RETURNING
id,
status
;
# Description fields are for documentation purposes
- name: command_execution
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the command_execution resource.
- name: clusterId
value: "{{ clusterId }}"
description: |
Running cluster id
- name: language
value: "{{ language }}"
description: |
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum):
... RED = 1
... BLUE = 2
... GREEN = 3
Access them by:
- attribute access:
>>> Color.RED
<Color.RED: 1>
- value lookup:
>>> Color(1)
<Color.RED: 1>
- name lookup:
>>> Color['RED']
<Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own
attributes -- see the documentation for details.
Lifecycle Methods
- cancel
- destroy
- execute
Cancels a currently running command within an execution context.
EXEC databricks_workspace.compute.command_execution.cancel
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"clusterId": "{{ clusterId }}",
"commandId": "{{ commandId }}",
"contextId": "{{ contextId }}"
}'
;
Deletes an execution context.
EXEC databricks_workspace.compute.command_execution.destroy
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"clusterId": "{{ clusterId }}",
"contextId": "{{ contextId }}"
}'
;
Runs a cluster command in the given execution context, using the provided language.
EXEC databricks_workspace.compute.command_execution.execute
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"clusterId": "{{ clusterId }}",
"command": "{{ command }}",
"contextId": "{{ contextId }}",
"language": "{{ language }}"
}'
;