Skip to content

Commit c054386

Browse files
areeseandrewmchen
authored andcommitted
Add runs get output command (#247)
* Add runs get output command * Fix line to long error * make some changes
1 parent b175a20 commit c054386

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

databricks_cli/runs/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ def get_run(self, run_id):
3939

4040
def cancel_run(self, run_id):
4141
return self.client.cancel_run(run_id)
42+
43+
def get_run_output(self, run_id):
44+
return self.client.get_run_output(run_id)

databricks_cli/runs/cli.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,21 @@ def get_cli(api_client, run_id):
120120
click.echo(pretty_format(RunsApi(api_client).get_run(run_id)))
121121

122122

123+
@click.command(context_settings=CONTEXT_SETTINGS)
124+
@click.option('--run-id', required=True, type=RunIdClickType())
125+
@debug_option
126+
@profile_option
127+
@eat_exceptions
128+
@provide_api_client
129+
def get_output_cli(api_client, run_id):
130+
"""
131+
Gets the output of a run
132+
133+
The output schema is documented https://docs.databricks.com/api/latest/jobs.html#runs-get-output
134+
"""
135+
click.echo(pretty_format(RunsApi(api_client).get_run_output(run_id)))
136+
137+
123138
@click.command(context_settings=CONTEXT_SETTINGS)
124139
@click.option('--run-id', required=True, type=RunIdClickType())
125140
@debug_option
@@ -151,3 +166,4 @@ def runs_group():
151166
runs_group.add_command(list_cli, name='list')
152167
runs_group.add_command(get_cli, name='get')
153168
runs_group.add_command(cancel_cli, name='cancel')
169+
runs_group.add_command(get_output_cli, name='get-output')

0 commit comments

Comments
 (0)