Skip to content

Conversation

@jkongie
Copy link
Collaborator

@jkongie jkongie commented Oct 24, 2025

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.

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

🦋 Changeset detected

Latest commit: 61b1769

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
chainlink-deployments-framework Minor

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(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement a soft delete instead to match the Job Distributor API

// Unknown operation, default to false
return false
}
return matchesSelector(nodeLabels, selector)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up to use a common function

node: &nodev1.Node{
Labels: []*ptypes.Label{
{Key: "environment", Value: pointer.To("prod")},
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are now covered by the common function

@jkongie jkongie force-pushed the jd-memory-client-job-filter branch from 3ce4762 to 7ae3fe6 Compare October 24, 2025 12:23
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.
@jkongie jkongie force-pushed the jd-memory-client-job-filter branch from 7ae3fe6 to 61b1769 Compare October 24, 2025 12:24
@cl-sonarqube-production
Copy link

@jkongie jkongie marked this pull request as ready for review October 24, 2025 13:18
@jkongie jkongie requested a review from a team as a code owner October 24, 2025 13:18
func jobMatchesNodeIds(job *jobv1.Job, nodeIds []string) bool {
return slices.Contains(nodeIds, job.NodeId)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
}

@jkongie jkongie added this pull request to the merge queue Oct 24, 2025
Merged via the queue into main with commit 35d9189 Oct 24, 2025
14 checks passed
@jkongie jkongie deleted the jd-memory-client-job-filter branch October 24, 2025 16:08
github-merge-queue bot pushed a commit that referenced this pull request Oct 27, 2025
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
## [email protected]

### 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants