From ec1532b29d490e66b5c22424b51781865ea4cf44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Kr=C3=BCger=20Svensson?= Date: Fri, 29 Mar 2024 15:36:05 +0100 Subject: [PATCH] docs: add documentation on how to retrieve running jobs (#377) --- docs/examples/job_ids.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/examples/job_ids.py b/docs/examples/job_ids.py index 9de9b8cc..1148591c 100644 --- a/docs/examples/job_ids.py +++ b/docs/examples/job_ids.py @@ -2,6 +2,8 @@ from arq import create_pool from arq.connections import RedisSettings +from arq.jobs import Job + async def the_task(ctx): print('running the task with id', ctx['job_id']) @@ -37,6 +39,14 @@ async def main(): > None """ + # you can retrieve jobs by using arq.jobs.Job + await redis.enqueue_job('the_task', _job_id='my_job') + job5 = Job(job_id='my_job', redis=redis) + print(job5) + """ + + """ + class WorkerSettings: functions = [the_task]