This repository has been archived by the owner on Apr 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
Add method for retrieving status of a running task #15
Open
matslindh
wants to merge
1
commit into
Yelp:master
Choose a base branch
from
matslindh:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit like a hack. It looks like you've gotten the handle from
GearmanJobRequest.handle
and want to check on the status, but for some reason you don't have theGearmanJobRequest
anymore.My main objection here is the 1 connection limitation. I think you should try and rewrite this to poll all the connections, but maybe it'd be better if you kept track of the
GearmanJobRequest
objects, unless you have some external requirement to not store python objects, but only handles ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In it's current form it's a bit of a hack, yes. :-) I'm not too fond of storing the complete
GermanJobRequest
in a DB - there will be use cases where you want to simply poll a server (or a collection of servers) for the state of a job (from the CLI, for example) and don't have access to the completeGearmanJobRequest
object.Since an handle isn't unique to a host in Gearman (as duplicate local host names will generate the same handles across servers), I decided to use the server address provided to the client itself to inidicate which Gearman server to query for the status of the task. The idea (if I remember correctly) was to allow a client user to query the status of a task by creating a client with the gearman server to query, and then request the status of a handle from that server.
Polling all the connections are a possibility, but might return the wrong task if you have several servers with the same local host name - so either we're talking about a documentation issue (by polling all the connections) or a code issue (by only allowing the user of the library to set which server to poll). The last case solves the issue where you could store the (server, handle) pair in a DB and then request the job status at some point in time. I'm open for both, as long as the limitations are clear for the user.