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

Function test_enqueue_job_custom_queue

tests/test_main.py:96–118  ·  view source on GitHub ↗
(arq_redis: ArqRedis, test_redis_settings: RedisSettings, worker)

Source from the content-addressed store, hash-verified

94
95
96async def test_enqueue_job_custom_queue(arq_redis: ArqRedis, test_redis_settings: RedisSettings, worker):
97 async def foobar(ctx):
98 return 42
99
100 async def parent_job(ctx):
101 inner_job = await ctx['redis'].enqueue_job('foobar')
102 return inner_job.job_id
103
104 job = await arq_redis.enqueue_job('parent_job', _queue_name='spanner')
105
106 worker: Worker = worker(
107 functions=[func(parent_job, name='parent_job'), func(foobar, name='foobar')],
108 arq_redis=None,
109 redis_settings=test_redis_settings,
110 queue_name='spanner',
111 )
112
113 await worker.main()
114 inner_job_id = await job.result(poll_delay=0)
115 assert inner_job_id is not None
116 inner_job = Job(inner_job_id, arq_redis, _queue_name='spanner')
117 inner_result = await inner_job.result(poll_delay=0)
118 assert inner_result == 42
119
120
121async def test_job_error(arq_redis: ArqRedis, worker):

Callers

nothing calls this directly

Calls 6

resultMethod · 0.95
funcFunction · 0.90
JobClass · 0.90
workerFunction · 0.85
enqueue_jobMethod · 0.80
mainMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…