MCPcopy Create free account
hub / github.com/python-arq/arq / test_max_bursts_multiple

Function test_max_bursts_multiple

tests/test_worker.py:787–804  ·  view source on GitHub ↗
(arq_redis: ArqRedis, worker, caplog)

Source from the content-addressed store, hash-verified

785
786
787async def test_max_bursts_multiple(arq_redis: ArqRedis, worker, caplog):
788 async def foo(ctx, v):
789 return v + 1
790
791 caplog.set_level(logging.INFO)
792 await arq_redis.enqueue_job('foo', 1)
793 await arq_redis.enqueue_job('foo', 2)
794 worker: Worker = worker(functions=[func(foo, name='foo')])
795 assert await worker.run_check(max_burst_jobs=1) == 1
796 assert worker.jobs_complete == 1
797 assert worker.jobs_retried == 0
798 assert worker.jobs_failed == 0
799 # either foo(1) or foo(2) can be run, but not both
800 if 'foo(1)' in caplog.text:
801 assert 'foo(2)' not in caplog.text
802 else:
803 assert 'foo(2)' in caplog.text
804 assert 'foo(1)' not in caplog.text
805
806
807async def test_max_bursts_dont_get(arq_redis: ArqRedis, worker):

Callers

nothing calls this directly

Calls 4

funcFunction · 0.90
workerFunction · 0.85
enqueue_jobMethod · 0.80
run_checkMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…