Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

Clarify JOB_UNKNOWN source in docs #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Function available to all examples::
print "Job %s finished! Result: %s - %s" % (job_request.job.unique, job_request.state, job_request.result)
elif job_request.timed_out:
print "Job %s timed out!" % job_request.unique
elif job_request.state == JOB_UNKNOWN:
elif job_request.state == gearman.client.JOB_UNKNOWN:
print "Job %s connection failed!" % job_request.unique

.. autoclass:: GearmanClient
Expand Down Expand Up @@ -69,7 +69,7 @@ Submitting jobs
failed_requests = gm_client.submit_multiple_jobs(list_of_jobs, background=False)

# Let's pretend our assigned requests' Gearman servers all failed
assert all(request.state == JOB_UNKNOWN for request in failed_requests), "All connections didn't fail!"
assert all(request.state == gearman.client.JOB_UNKNOWN for request in failed_requests), "All connections didn't fail!"

# Let's pretend our assigned requests' don't fail but some simply timeout
retried_connection_failed_requests = gm_client.submit_multiple_requests(failed_requests, wait_until_complete=True, poll_timeout=1.0)
Expand Down
2 changes: 1 addition & 1 deletion gearman/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def submit_multiple_requests(self, job_requests, wait_until_complete=True, poll_
* Blocks until our jobs are accepted (should be fast) OR times out
* Optionally blocks until jobs are all complete

You MUST check the status of your requests after calling this function as "timed_out" or "state == JOB_UNKNOWN" maybe True
You MUST check the status of your requests after calling this function as "timed_out" or "state == gearman.client.JOB_UNKNOWN" maybe True
"""
assert type(job_requests) in (list, tuple, set), "Expected multiple job requests, received 1?"
stopwatch = gearman.util.Stopwatch(poll_timeout)
Expand Down