Closed nuno-andre closed 2 months ago
It would be great to leverage the events system to able to launch jobs programmatically. Something like:
... async with AsyncScheduler() as scheduler: await scheduler.add_schedule(fn, EventTrigger(), id='some_id') ...
And then, from elsewhere in the code:
... event = TriggerEvent(id='some_id') await event.fire() ...
I have tried to do it myself but I have to pass the scheduler to the trigger, current_async_scheduler returns None at initialization.
current_async_scheduler
None
Probably none that is not covered by .add_job(), but it could simplify many workflows.
.add_job()
How would the EventTrigger class work? I'm not comprehending this.
EventTrigger
Closing due to lack of responses.
Things to check first
Feature description
It would be great to leverage the events system to able to launch jobs programmatically. Something like:
And then, from elsewhere in the code:
I have tried to do it myself but I have to pass the scheduler to the trigger,
current_async_scheduler
returnsNone
at initialization.Use case
Probably none that is not covered by
.add_job()
, but it could simplify many workflows.