Python Function Decorator
In addition to the taskbadger.Task
class and utility functions, there is also a
function decorator that can be used to automatically create a task when a function is called.
Using the decorator will create a task with the name provided and automatically update the task
status to success
when the function completes or error
if an exception is raised.
The decorator also applies the taskbadger.Session
context manager to the function.
See connection management.
API Docs
taskbadger.track
Decorator to track a function as a task.
Usage:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the task. Defaults to the fully qualified name of the function. |
None
|
monitor_id |
str
|
The ID of the monitor to associate the task with. |
None
|
max_runtime |
int
|
The maximum runtime of the task in seconds. If the task takes longer than this, it will be marked as an error. |
None
|
**kwargs |
{}
|