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

Function test_multi_exec

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

Source from the content-addressed store, hash-verified

836
837
838async def test_multi_exec(arq_redis: ArqRedis, worker, caplog):
839 c = 0
840
841 async def foo(ctx, v):
842 nonlocal c
843 c += 1
844 return v + 1
845
846 caplog.set_level(logging.DEBUG, logger='arq.worker')
847 await arq_redis.enqueue_job('foo', 1, _job_id='testing')
848 worker: Worker = worker(functions=[func(foo, name='foo')])
849 await asyncio.gather(*[worker.start_jobs([b'testing']) for _ in range(5)])
850 # debug(caplog.text)
851 await worker.main()
852 assert c == 1
853 # assert 'multi-exec error, job testing already started elsewhere' in caplog.text
854 # assert 'WatchVariableError' not in caplog.text
855
856
857async def test_abort_job(arq_redis: ArqRedis, worker, caplog, loop):

Callers

nothing calls this directly

Calls 5

funcFunction · 0.90
workerFunction · 0.85
enqueue_jobMethod · 0.80
start_jobsMethod · 0.80
mainMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…