Yelp / python-gearman

Gearman API - Client, worker, and admin client interfaces
http://github.com/Yelp/python-gearman/
Other
242 stars 122 forks source link

get_job_status raises gearman.errors.InvalidClientState exception #1

Closed JustinAzoff closed 13 years ago

JustinAzoff commented 14 years ago

probably doing something wrong here.. but...

>>> j=c.submit_job("config", ip,wait_until_complete=False)
>>> c.get_job_status(j)
<GearmanJobRequest task='config', unique='c468734f3bfe4786e486be6651877ed7', priority=None, background=False, state='CREATED', timed_out=False>
>>> c.get_job_status(j)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/gearman/client.py", line 127, in get_job_status
  File "build/bdist.linux-x86_64/egg/gearman/client.py", line 141, in get_job_statuses
  File "build/bdist.linux-x86_64/egg/gearman/client.py", line 158, in wait_until_job_statuses_received
  File "build/bdist.linux-x86_64/egg/gearman/connection_manager.py", line 194, in poll_connections_until_stopped
  File "build/bdist.linux-x86_64/egg/gearman/connection_manager.py", line 160, in handle_connection_activity
  File "build/bdist.linux-x86_64/egg/gearman/connection_manager.py", line 218, in handle_read
  File "build/bdist.linux-x86_64/egg/gearman/command_handler.py", line 39, in fetch_commands
  File "build/bdist.linux-x86_64/egg/gearman/command_handler.py", line 65, in recv_command
  File "build/bdist.linux-x86_64/egg/gearman/client_handler.py", line 142, in recv_status_res
  File "build/bdist.linux-x86_64/egg/gearman/client_handler.py", line 57, in _assert_request_state
gearman.errors.InvalidClientState: Expected handle (H:dell:333) to be in state 'CREATED', got 'COMPLETE'
mtai commented 14 years ago

Hmmm what would you expect to happen? Also are you using 2.0.1 or 2.0.0? I recently changed some of the update behavior

JustinAzoff commented 14 years ago

I have 2.0.1..

I expected it to return

<GearmanJobRequest task='config', unique='c468734f3bfe4786e486be6651877ed7', priority=None, background=False, state='COMPLETE', timed_out=False>

the second time..

mtai commented 14 years ago

K, I'll try to submit a patch today

mtai commented 14 years ago

Patch submitted. Its currently on the development branch if you'd like to pull it down. Because it was a 1-line change I may punt on a version change. Thoughts?

JustinAzoff commented 14 years ago

works great now :-)

mtai commented 13 years ago

Closed with python-gearman 2.0.2

Thanks for the bug report!