decorators#
Custom law task method decorators.
Functions:
|
A decorator that ensures that the task's decorated method is only executed in the local environment, and not by (e.g.) remote jobs. |
|
callback(callback=None) A decorator that is configured with a callback function that is invoked if the decorated method raises an exception. |
|
This decorator is used to view the output plots of a task. |
- only_local_env(fn, opts, task, *args, **kwargs)[source]#
A decorator that ensures that the task’s decorated method is only executed in the local environment, and not by (e.g.) remote jobs.
- Parameters:
- Return type:
- Returns:
A tuple containing the before_call, call, and after_call functions.
- on_failure(fn, opts, task, *args, **kwargs)[source]#
callback(callback=None) A decorator that is configured with a callback function that is invoked if the decorated method raises an exception. The task instances is passed to the callback function as an argument.
- Parameters:
- Return type:
- Returns:
A tuple containing the before_call, call, and after_call functions.
- view_output_plots(fn, opts, task, *args, **kwargs)[source]#
This decorator is used to view the output plots of a task. It checks if the task has a view command, collects all the paths of the output files, and then opens each file using the view command.
- Parameters:
- Return type:
- Returns:
A tuple containing the before_call, call, and after_call functions.