Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

kick-job command #24

Merged
merged 2 commits into from

2 participants

@ifduyue

beanstalkd v1.8 add a new command kick-job, so I add it to beanstalkc.

@ifduyue

The version of beanstalkd in ubuntu repo is less than 1.8, that's why travis failed.

@earl earl merged commit ea2e7e9 into earl:master
@earl
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 7, 2012
  1. @ifduyue

    kick-job command

    ifduyue authored
  2. @ifduyue
This page is out of date. Refresh to see the latest.
Showing with 19 additions and 0 deletions.
  1. +12 −0 TUTORIAL.mkd
  2. +7 −0 beanstalkc.py
View
12 TUTORIAL.mkd
@@ -300,6 +300,18 @@ tell you how many jobs were actually kicked alive again:
>>> beanstalk.kick(42)
0
+You can also kick a specific job:
+
+ >>> job = beanstalk.reserve()
+ >>> job.bury()
+ >>> job.stats()['state']
+ 'buried'
+ >>> job.kick_job() # or beanstalk.kick_job(job.jid)
+
+The `kick-job` command was introduced in beanstalkd v1.8, please make sure
+beanstalkd version >= v1.8 if you want to use
+this command.
+
Inspecting Jobs
---------------
View
7 beanstalkc.py
@@ -154,6 +154,10 @@ def kick(self, bound=1):
"""Kick at most bound jobs into the ready queue."""
return int(self._interact_value('kick %d\r\n' % bound, ['KICKED']))
+ def kick_job(self, jid):
+ """Kick a specific job into the ready queue."""
+ self._interact('kick-job %d\r\n' % jid, ['KICKED'], ['NOT_FOUND'])
+
def peek(self, jid):
"""Peek at a job. Returns a Job, or None."""
return self._interact_peek('peek %d\r\n' % jid)
@@ -277,6 +281,9 @@ def bury(self, priority=None):
self.conn.bury(self.jid, priority or self._priority())
self.reserved = False
+ def kick_job(self):
+ self.conn.kick_job(self.jid)
+
def touch(self):
"""Touch this reserved job, requesting more time to work on it before
it expires."""
Something went wrong with that request. Please try again.