feat: add job filter to memory client#540
Conversation
🦋 Changeset detectedLatest commit: 61b1769 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| // Also create a job based on the proposal | ||
| job := &jobv1.Job{ | ||
| Id: jobID, | ||
| Uuid: uuid.New().String(), |
There was a problem hiding this comment.
This fixes the field which should have been set during job setup
| if proposal.JobId == jobID { | ||
| delete(m.proposals, id) | ||
| } | ||
| job, ok := m.jobs[jobID] |
There was a problem hiding this comment.
Implement a soft delete instead to match the Job Distributor API
| // Unknown operation, default to false | ||
| return false | ||
| } | ||
| return matchesSelector(nodeLabels, selector) |
There was a problem hiding this comment.
Clean up to use a common function
| node: &nodev1.Node{ | ||
| Labels: []*ptypes.Label{ | ||
| {Key: "environment", Value: pointer.To("prod")}, | ||
| }, |
There was a problem hiding this comment.
These tests are now covered by the common function
3ce4762 to
7ae3fe6
Compare
When calling `ListJobs`, the filter can now be applied to the jobs. This supports all the filter options that are supported by the `ListJobs` method. It also makes a change to the DeleteJob method to perform a soft delete of the job, rather than a hard delete. This is in line with how the Job Distributor API works.
7ae3fe6 to
61b1769
Compare
|
| func jobMatchesNodeIds(job *jobv1.Job, nodeIds []string) bool { | ||
| return slices.Contains(nodeIds, job.NodeId) | ||
| } | ||
|
|
There was a problem hiding this comment.
Could these 3 function be a general jobMatches function since they have the same signature and perform the same check?
eg
func jobMatches(target string, filter []string) bool {
return slices.Contains(filter, target)
}
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## chainlink-deployments-framework@0.59.0 ### Minor Changes - [#536](#536) [`d35d8de`](d35d8de) Thanks [@jkongie](https://github.com/jkongie)! - JD Memory Client now supports filtering in `ListNodes` - [#542](#542) [`5b3a421`](5b3a421) Thanks [@jkongie](https://github.com/jkongie)! - Aligns MemoryJobDistributor `ProposeJob` and `RevokeJob` to have the same functionality as the JobDistributor service - [#540](#540) [`35d9189`](35d9189) Thanks [@jkongie](https://github.com/jkongie)! - JD Memory Client now supports filtering in `ListJobs` --------- Co-authored-by: app-token-issuer-engops[bot] <144731339+app-token-issuer-engops[bot]@users.noreply.github.com>




When calling
ListJobs, the filter can now be applied to the jobs.This supports all the filter options that are supported by the
ListJobsmethod. It also makes a change to the DeleteJob method to perform a soft delete of the job, rather than a hard delete. This is in line with how the Job Distributor API works.