You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Internal] GetRun logic paginates more arrays (#867)
## What changes are proposed in this pull request?
The existing code only paginates tasks and iterations. With this PR we
update the logic to also paginate job_clusters, job_parameters and
repair_history. This changes are needed for [Jobs API
2.2](https://docs.databricks.com/api/workspace/jobs/getrun)
compatibility.
## How is this tested?
I enabled API 2.2 calls by modifying URL string `/api/2.2/jobs/runs/get`
in databricks/sdk/service/jobs.py. Then I ran unit test from
tests/test_jobs_mixin.py
Copy file name to clipboardExpand all lines: databricks/sdk/mixins/jobs.py
+12-6Lines changed: 12 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -11,18 +11,20 @@ def get_run(self,
11
11
include_history: Optional[bool] =None,
12
12
include_resolved_values: Optional[bool] =None,
13
13
page_token: Optional[str] =None) ->jobs.Run:
14
-
"""
15
-
This method fetches the details of a run identified by `run_id`. If the run has multiple pages of tasks or iterations,
16
-
it will paginate through all pages and aggregate the results.
14
+
"""Get a single job run.
15
+
16
+
Retrieve the metadata of a run. If a run has multiple pages of tasks, it will paginate through all pages of tasks, iterations, job_clusters, job_parameters, and repair history.
17
+
17
18
:param run_id: int
18
19
The canonical identifier of the run for which to retrieve the metadata. This field is required.
19
20
:param include_history: bool (optional)
20
21
Whether to include the repair history in the response.
21
22
:param include_resolved_values: bool (optional)
22
23
Whether to include resolved parameter values in the response.
23
24
:param page_token: str (optional)
24
-
To list the next page or the previous page of job tasks, set this field to the value of the
25
-
`next_page_token` or `prev_page_token` returned in the GetJob response.
25
+
To list the next page of job tasks, set this field to the value of the `next_page_token` returned in
26
+
the GetJob response.
27
+
26
28
:returns: :class:`Run`
27
29
"""
28
30
run=super().get_run(run_id,
@@ -34,6 +36,7 @@ def get_run(self,
34
36
# When querying a ForEach task run, a page token is returned when there are more than 100 iterations. Only a single task is returned, corresponding to the ForEach task itself. Therefore, the client only reads the iterations from the next page and not the tasks.
0 commit comments