moo.sdk.tasks.invoke
- moo.sdk.tasks.invoke(*args, verb=None, callback=None, delay=0, periodic=False, cron=None, _caller=None, _player=None, **kwargs)
Asynchronously execute a Verb, optionally returning the result to another Verb. This is often a better alternative than using __call__-syntax to invoke a verb directly, since Verbs invoked this way will each have their own timeout.
- Parameters:
verb (Verb) – the Verb to execute
callback (Verb) – an optional callback Verb to receive the result
delay (
int) – seconds to wait before executing, cannot be used with cronperiodic (
bool) – should this task continue to repeat? cannot be used with croncron (
str|None) – a crontab expression to schedule Verb execution_caller – explicit caller override; falls back to
context.caller. Used bytransaction.on_commitcallbacks that fire after theContextManagerhas exited and cleared the contextvars._player – explicit player override; falls back to
context.player. Same reason as_caller.args – positional arguments for the Verb, if any
kwargs – keyword arguments for the Verb, if any
- Returns:
a
PeriodicTaskinstance or None if the task is a one-shot- Return type:
Optional[
PeriodicTask]