Skip to content

Show job handle in "show unique jobs" output - #527

Merged
esabol merged 1 commit into
gearman:masterfrom
p-alik:show-unique-jobs-handle
Oct 14, 2026
Merged

esabol merged 1 commit into
gearman:masterfrom
p-alik:show-unique-jobs-handle

Conversation

@p-alik

@p-alik p-alik commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Fixes #81, as discussed with @esabol in #81 (comment).

Each line of show unique jobs (gearadmin --show-unique-jobs) is now <job handle>\t<unique> instead of just <unique>. That lets you go from a unique ID to the handle that cancel job / gearadmin --cancel-job needs.

$ gearadmin --show-unique-jobs
H:host:1	myuniq
.

The handle comes first because it never contains a tab, while a unique ID may. Splitting each line on the first tab therefore stays unambiguous, and the layout matches show jobs.

Incompatible output change: scripts that read the whole show unique jobs line as the unique ID need to take the text after the first tab instead. This is targeted at 2.2.0.

Changes:

  • libgearman-server/text.cc: print job_handle\tunique per line.
  • docs/source/protocol/text.rst, docs/source/bin/gearadmin.rst, gearadmin --help: describe the new output (also fixes the "processesing" typo).
  • tests/cli.cc: new test. It submits a background job with a known unique ID to a function that has no worker, checks that --show-unique-jobs prints <handle>\t<unique>, then passes that handle to --cancel-job and checks that --show-jobs reports the job as cancelled (ignore_job=1). The test fails without the server change.

Note: cancel job is lazy. It marks the job as ignored, and the job is freed only when a worker would take it, so a cancelled job keeps showing up in show jobs / show unique jobs until then. That behaviour is unchanged here.

🤖 Generated with Claude Code

Each line of the "show unique jobs" admin command (gearadmin
--show-unique-jobs) is now "<job handle>\t<unique>" instead of just
"<unique>", so a job submitted with a known unique ID can be mapped to
the handle that "cancel job" expects.

The handle comes first because it never contains a tab, while a unique
ID may; splitting each line on the first tab stays unambiguous. This
also matches the layout of "show jobs".

This changes the output format of "show unique jobs". Scripts that
treat the whole line as the unique ID need to take the text after the
first tab instead.

Fixes gearman#81

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Alexei Pastuchov <info@maximka.de>
@esabol

esabol commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thanks, @p-alik !

@esabol
esabol merged commit dc97723 into gearman:master Oct 14, 2026
22 checks passed
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.

--show-jobs does not show job ID

2 participants