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

Function test_enqueue_job_nested_custom_serializer

tests/test_main.py:68–93  ·  view source on GitHub ↗
(
    arq_redis_msgpack: ArqRedis, test_redis_settings: RedisSettings, worker
)

Source from the content-addressed store, hash-verified

66
67
68async def test_enqueue_job_nested_custom_serializer(
69 arq_redis_msgpack: ArqRedis, test_redis_settings: RedisSettings, worker
70):
71 async def foobar(ctx):
72 return 42
73
74 async def parent_job(ctx):
75 inner_job = await ctx['redis'].enqueue_job('foobar')
76 return inner_job.job_id
77
78 job = await arq_redis_msgpack.enqueue_job('parent_job')
79
80 worker: Worker = worker(
81 functions=[func(parent_job, name='parent_job'), func(foobar, name='foobar')],
82 arq_redis=None,
83 redis_settings=test_redis_settings,
84 job_serializer=msgpack.packb,
85 job_deserializer=functools.partial(msgpack.unpackb, raw=False),
86 )
87
88 await worker.main()
89 result = await job.result(poll_delay=0)
90 assert result is not None
91 inner_job = Job(result, arq_redis_msgpack, _deserializer=functools.partial(msgpack.unpackb, raw=False))
92 inner_result = await inner_job.result(poll_delay=0)
93 assert inner_result == 42
94
95
96async def test_enqueue_job_custom_queue(arq_redis: ArqRedis, test_redis_settings: RedisSettings, 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…