コード例 #1
0
ファイル: queue.py プロジェクト: nvonpentz/qless-py
 def peek(self, count=None):
     '''Similar to the pop command, except that it merely peeks at the next
     items'''
     results = [Job(self.client, **rec) for rec in json.loads(
         self.client('peek', self.name, count or 1))]
     if count is None:
         return (len(results) and results[0]) or None
     return results
コード例 #2
0
ファイル: queue.py プロジェクト: nvonpentz/qless-py
 def pop(self, count=None):
     '''Passing in the queue from which to pull items, the current time,
     when the locks for these returned items should expire, and the number
     of items to be popped off.'''
     results = [Job(self.client, **job) for job in json.loads(
         self.client('pop', self.name, self.worker_name, count or 1))]
     if count is None:
         return (len(results) and results[0]) or None
     return results
コード例 #3
0
 def test_no_mtime(self):
     '''Don't blow up we cannot check the modification time of a module.'''
     exc = OSError('Could not stat file')
     with mock.patch('qless.job.os.stat', side_effect=exc):
         Job._import('test_job.Foo')
         Job._import('test_job.Foo')
コード例 #4
0
 def test_reload(self):
     '''Ensure that nothing blows up if we reload a class'''
     self.client.queues['foo'].put(Foo, {}, jid='jid')
     self.assertEqual(self.client.jobs['jid'].klass, Foo)
     Job.reload(self.client.jobs['jid'].klass_name)
     self.assertEqual(self.client.jobs['jid'].klass, Foo)
コード例 #5
0
ファイル: test_job.py プロジェクト: JustinTArthur/qless-py
 def test_reload(self):
     """Ensure that nothing blows up if we reload a class"""
     self.client.queues["foo"].put(Foo, {}, jid="jid")
     self.assertEqual(self.client.jobs["jid"].klass, Foo)
     Job.reload(self.client.jobs["jid"].klass_name)
     self.assertEqual(self.client.jobs["jid"].klass, Foo)
コード例 #6
0
ファイル: test_job.py プロジェクト: multiwave/qless-py
 def test_no_mtime(self):
     '''Don't blow up we cannot check the modification time of a module.'''
     exc = OSError('Could not stat file')
     with mock.patch('qless.job.os.stat', side_effect=exc):
         Job._import('test_job.Foo')
         Job._import('test_job.Foo')
コード例 #7
0
ファイル: test_job.py プロジェクト: multiwave/qless-py
 def test_reload(self):
     '''Ensure that nothing blows up if we reload a class'''
     self.client.queues['foo'].put(Foo, {}, jid='jid')
     self.assertEqual(self.client.jobs['jid'].klass, Foo)
     Job.reload(self.client.jobs['jid'].klass_name)
     self.assertEqual(self.client.jobs['jid'].klass, Foo)