-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Internal] Update Jobs GetRun API to support paginated responses for jobs and ForEach tasks with >100 runs #324
Conversation
.codegen/_openapi_sha
Outdated
37e2bbe0cbcbbbe78a06a018d4fab06314a26a40 No newline at end of file | ||
universe:/Users/ricardo.costa/universe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looking to get an official SHA here.
if (paginatingIterations) { | ||
run.getIterations().addAll(currRun.getIterations()); | ||
} else { | ||
run.getTasks().addAll(currRun.getTasks()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need this condition because in case of For each run, the singular task keeps showing up in the tasks array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that we're only ever paginating one of the two fields, and never both at the same time.
This way we avoid having duplicate entries in the array that is not being paginated.
} | ||
|
||
// now that we've added all pages to the Run, the token is useless | ||
run.setNextPageToken(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previous page token too I suppose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
@Override | ||
public Run getRun(GetRunRequest request) { | ||
Run run = super.getRun(request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this calling API 2.2 or 2.1? I can't find where the version is defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently 2.1. The implementation is supposed to work with both (as long as the types are there).
databricks-sdk-java/databricks-sdk-java/src/main/java/com/databricks/sdk/service/jobs/JobsImpl.java
Line 98 in c7f2582
String path = "/api/2.1/jobs/runs/get"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly you will override the String path
in JobsImpl.java variable later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JobsImpl.java
is generated. It follows that the String path
there is also generated. My understanding is that when the version is updated on the proto, the next generation will automatically update those paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change
08727a7
to
6981221
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Were you able to test this out against a real workspace?
for (long runId : taskRunIds) { | ||
tasks.add(new RunTask().setRunId(runId)); | ||
} | ||
run.setIterations(tasks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean run.setTasks
I assume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, thanks for spotting that. The test was passing previously because the expected object was also being constructed in the same way.
Fixed: 9967447
} | ||
|
||
@Override | ||
public Run getRun(GetRunRequest request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto here, we may want to have a separate doccomment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto here
I may have missed another comment of yours.
I added a docstring to this method in this commit: e9eec92 Is this what you were looking for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you were referring to this? databricks/databricks-sdk-py#725 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improved further to explicitly mention the 100 task/iteration limit: 057f140
Did not attempt. |
@mgyucht tested manually against a job with 100+ tasks as well as a ForEach run with 100+ iterations, hardcoding both v 2.1 and 2.2. All combinations worked as expected. |
Removing myself from the reviewer list as it seems my review is not explicitly needed/requested. Please add me back if that is incorrect. |
Closed in favour of a new pr linked above |
Changes
Jobs GetRun 2.2 behind the scenes pagination
Tests
Unit tests