-
Notifications
You must be signed in to change notification settings - Fork 409
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
Use Jobs API 2.1 with name filter for databricks_job
data source
#1744
Conversation
This patch switches to 2.1 version of Jobs API for List operation so we can more efficiently handle workspace with huge number of jobs (> 3000). It also uses new `name` parameter to search jobs by name in the `databricks_job` data source.
} | ||
offset += len(resp.Jobs) | ||
} | ||
return jobs, nil |
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.
go sdk will generate the following logic. please reuse
var results []Job
ctx = useragent.InContext(ctx, "sdk-feature", "pagination")
for {
response, err := a.List(ctx, request)
if err != nil {
return nil, err
}
if len(response.Jobs) == 0 {
break
}
for _, v := range response.Jobs {
results = append(results, v)
}
request.Offset += int(len(response.Jobs))
}
return results, nil
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'll need to look for SDK modification as it's doing the extra API call at the end.
}) | ||
} | ||
|
||
func TestJobsAPIListMultiplePages(t *testing.T) { |
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.
what about duplicates that appear when job is added in the middle of iteration? :) you can skip this one here, though
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1744 +/- ##
=======================================
Coverage 89.98% 89.98%
=======================================
Files 141 141
Lines 11148 11171 +23
=======================================
+ Hits 10031 10052 +21
- Misses 712 713 +1
- Partials 405 406 +1
|
…atabricks#1744) This patch switches to 2.1 version of Jobs API for List operation so we can more efficiently handle workspace with huge number of jobs (> 3000). It also uses new `name` parameter to search jobs by name in the `databricks_job` data source.
bn |
This patch switches to 2.1 version of Jobs API for List operation so we can more efficiently handle workspaces with huge number of jobs (> 3000). It also uses new
name
parameter to search jobs by name in thedatabricks_job
data source.