darq
darq copied to clipboard
Add ability to passing args to task during creating cron job
It would be great if there was an opportunity to pass arguments to task during creating cron job
Example:
@darq.task
async def print_name(name: str = 'John'):
print(name)
cron_jobs = (
cron(print_name, hour=3, task_kwargs=dict(name='Lucas')),
)
Will do.
But for this moment it can be done by wrapping existing task into wrapper with params:
@darq.task
async def print_name(name: str = 'John'):
print(name)
@darq.task
async def print_alex_name():
return await print_name('Alex')
cron_jobs = (
cron(print_alex_name, hour=3),
)