Skip to content

Rust client: job cancellation#4828

Open
mladjan-gadzic wants to merge 2 commits intoarmadaproject:masterfrom
mladjan-gadzic:rust-client-cancel-jobs
Open

Rust client: job cancellation#4828
mladjan-gadzic wants to merge 2 commits intoarmadaproject:masterfrom
mladjan-gadzic:rust-client-cancel-jobs

Conversation

@mladjan-gadzic
Copy link
Copy Markdown
Contributor

What type of PR is this?

Rust client support.

What this PR does / why we need it

Support for job cancellation.

Which issue(s) this PR fixes

Fixes #

Special notes for your reviewer

Signed-off-by: Mladjan Gadzic <gadzic.mladjan@gmail.com>
@mladjan-gadzic mladjan-gadzic force-pushed the rust-client-cancel-jobs branch from 6d1a824 to 3809d3a Compare April 9, 2026 15:00
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Greptile Summary

This PR adds job cancellation support to the Armada Rust client by implementing two new methods — cancel_jobs (cancel one or more jobs by ID) and cancel_job_set (cancel all or filtered jobs in a set) — along with a new cancel example binary, updated public re-exports, and comprehensive documentation. The implementation faithfully follows the existing auth, tracing, and error-handling patterns established by submit and watch.

Confidence Score: 5/5

Safe to merge — no correctness, security, or API-contract issues found.

All four changed files score 5/5. The two new client methods mirror the existing submit pattern exactly (auth, timeout, tracing skip+fields), types are fully exported, and the example correctly handles both single-job and job-set cancellation paths. No P0 or P1 findings.

No files require special attention.

Vulnerabilities

No security concerns identified. Authorization tokens are handled consistently with the existing submit method — token is fetched from the TokenProvider, attached to the authorization metadata header only when non-empty, and never logged or exposed in traces (both self and request are skipped in the #[instrument] macro).

Important Files Changed

Filename Overview
client/rust/src/client.rs Adds cancel_jobs and cancel_job_set methods that follow the same auth/timeout/tracing pattern as the existing submit method; no issues found.
client/rust/examples/cancel.rs New example demonstrating single-job cancellation via cancel_jobs and job-set cancellation via cancel_job_set; correctly clones job_set_id only where needed.
client/rust/src/lib.rs Adds CancellationResult, JobCancelRequest, JobSetCancelRequest, JobSetFilter, and JobState to the public re-export list; feature table updated correctly.
client/rust/Cargo.toml Registers the new cancel example binary and updates the comment to mention it alongside submit and watch; no dependency changes.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant ArmadaClient
    participant TokenProvider
    participant SubmitClient (gRPC)

    Note over Caller,SubmitClient (gRPC): cancel_jobs — cancel one or more jobs by ID
    Caller->>ArmadaClient: cancel_jobs(JobCancelRequest { job_ids, queue, job_set_id, reason })
    ArmadaClient->>TokenProvider: token()
    TokenProvider-->>ArmadaClient: token (or "")
    ArmadaClient->>ArmadaClient: build tonic::Request + set authorization header + apply_timeout
    ArmadaClient->>SubmitClient (gRPC): cancel_jobs(req)
    SubmitClient (gRPC)-->>ArmadaClient: CancellationResult { cancelled_ids }
    ArmadaClient-->>Caller: Ok(CancellationResult)

    Note over Caller,SubmitClient (gRPC): cancel_job_set — cancel all / filtered jobs in a set
    Caller->>ArmadaClient: cancel_job_set(JobSetCancelRequest { queue, job_set_id, filter, reason })
    ArmadaClient->>TokenProvider: token()
    TokenProvider-->>ArmadaClient: token (or "")
    ArmadaClient->>ArmadaClient: build tonic::Request + set authorization header + apply_timeout
    ArmadaClient->>SubmitClient (gRPC): cancel_job_set(req)
    SubmitClient (gRPC)-->>ArmadaClient: () (empty response)
    ArmadaClient-->>Caller: Ok(())
Loading

Reviews (2): Last reviewed commit: "fix fmt" | Re-trigger Greptile

Signed-off-by: Mladjan Gadzic <gadzic.mladjan@gmail.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.

2 participants