'arq worker - learning : python

let me know... how to setup worker for the arq job in python.

error i got

assert len(self.functions) > 0, 'at least one function or cron_job must be registered' AssertionError: at least one function or cron_job must be registered



Solution 1:[1]

You need a function that the worker should run. Otherwise the worker would be quite unnecessary.

For example with the function the_tasks, you add it to the functions argument of the worker:

arq import Worker

async def the_task(ctx):
    print('running the task')
    return 42

w = Worker(functions=[the_task],
    redis_settings=WorkerSettings.redis_settings(),
    max_jobs=1000,
    keep_result_forever=True,
    job_timeout=86000,
    max_tries=1000)
w.run()

Maybe start with the demo example: https://arq-docs.helpmanual.io/#simple-usage

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tractrac