Worker(gator, max_tasks=0, to_consume='all', nap_time=0.1, log_level=20)¶
Handles the logic of checking for & executing a task.
Worker.run_forever uses this in a loop to actually handle the main logic, though you can call this on your own if you have different needs.
- True if a task was run successfully, False if there was
- no task to process or executing the task failed.
Return type: bool
Sets up logging for the instance.
Parameters: log_level (int) – Optional. The logging level you’d like for output. Default is logging.INFO. Returns: The log instance. Return type: logging.Logger
Returns a string identifier for the worker.
Used in the printed messages & includes the process ID.
Prints an interrupt message to stdout.
Prints the received result from a task to stdout.
Parameters: result – The result of the task
Causes the worker to run either forever or until the Worker.max_tasks are reached.
Prints a startup message to stdout.
Prints a shutdown message to stdout.