Open tamalsaha opened 7 years ago
Right on! Very cool. I'm always kind of amazed how many ways Gearman gets implemented (I've been tinkering with a Rust implementation for a while now to teach mysel Rust).
This is really a job for the admin protocol IMO. And you really don't need ot limit it to scheduled jobs. I think it might make sense to be able to just cancel any job by its job handle. Doing this as an admin thing seems to make more sense than doing it via the regular protocol. Some day we might even have ACL's on the admin protocol so it can only be used over a local socket or using SSL with a signed client cert or something. Some day. ;)
Anyway, regardless of security concerns, the admin protocol is a bit more wild-west than the binary protocol, so you'll have a better chance at retaining compatibility with other gearman clients, so I'd suggest just using that to add a cancel command.
And if you want to submit that as a patch to gearmand's PROTOCOL file, I'd happily accept it, and maybe even try to implement it for gearmand. :)
@SpamapS , thanks for the kind words. Gearman provides a very useful model for background task execution. So, the tool lives on even though the project has been mostly dormant for some time. Thank you for reviving it.
This is really a job for the admin protocol IMO. And you really don't need ot limit it to scheduled jobs. I think it might make sense to be able to just cancel any job by its job handle. Doing this as an admin thing seems to make more sense than doing it via the regular protocol.
From http://gearman.info/protocol/text.html, it seems to me that there is already a cancel-job
command. But this is missing from the protocol spec file. After some digging, I found the following code:
gearadmin: https://github.com/gearman/gearmand/blob/master/bin/gearadmin.cc#L221 implementation: https://github.com/gearman/gearmand/blob/master/libgearman/universal.cc#L670
I propose the following description of this command:
cancel-job
This sends a WORK_FAIL request to gearman server for a given job handle.
Arguments:
- job handle.
If this looks ok, I can open a PR.
Some day we might even have ACL's on the admin protocol so it can only be used over a local socket or using SSL with a signed client cert or something. Some day. ;)
Yeah. This will be really cool. This probably needs its own issue for discussion. Regarding this I have 2 ideas:
Thanks.
Hey! I kind of lost the thread on this one. So, #1 is that there's already an HTTP/1.1 protocol in the http protocol plugin. A gRPC version of the protocol would be great though, and would help gearmand focus on doing what it does well and not on things like security and auth (since we can just slap OAUTH or cert auth on top and call it a day)
Your protocol snippet looks great and I'd be happy to merge a PR with it. Thanks!
Hi, We are working on a Golang implementation of Gearman Server (https://github.com/appscode/g2). Our backend requires the option of job scheduling. In our implementation, we are using
SUBMIT_JOB_SCHED
code to schedule job. But Gearman protocol does not define any REQ/RES types for canceling schedule jobs. We think 2 new codes are needed for that:REQ: CANCEL_JOB_SCHED
RES: JOB_CANCELLED
Can these codes be added to the gearman protocol spec?
cc: @sadlil @ashiquzzaman33