Task-helpers

Latest version: v1.4.1

Safety actively analyzes 682244 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 2

1.2.0

- Added bulk operations for TaskCourier's:
- ClientTaskCourier - added bulk_add_tasks_to_queue method & tests for it.
- WorkerTaskCourier - added bulk_return_task_results method & tests for it.
- Renamed WorkerTaskCourier.get_tasks => WorkerTaskCourier.bulk_get_tasks.
- Fixes on courier: now courier.bulk_return_task_results "tasks" arg is list of tuples [(task_id, task_result), ...]
- Performanse improvements.
- Changes on docs & readme.

1.1.0

- New logic for _generate_task_id method.

1.0.1

Readme fixes.

1.0.0

Release.
- Added Task couriers
- ClientTaskCourier
- get_task_result - returns task retuls, if it exists.
- wait_for_task_result - Waits for the task result to appear.
- add_task_to_queue - adds a task to the queue for processing.
- check_for_done - checks if the task has completed.
- WorkerTaskCourier
- get_tasks - pops many tasks from queue and returns it.
- get_task - pops one task from queue and returns it.
- wait_for_task - waits for task and returns it.
- return_task_result - returns result to the client side.
- BaseWorker
- wait_for_tasks - waits for tasks in the queue, pops and returns them.
- perform_tasks - abstract method for processing tasks. Should return a list of tasks.
- return_task_results - method method for sending task results to the clients.
- perform - the main method that starts the task worker. total_iterations argument are required (how many processing iterations the worker should do).
- ClassicWorker
- perform_tasks - Method for processing tasks. Returns a list of tasks.
task is a tuple: (task_id, task_data).
task_data is a dictionary with keys "function", "args" and "kwargs".
Calls a function with args "args" and kwargs "kwargs", unpacking them, and returns the execution result.
Arguments "args" and "kwargs" are optional.

Page 2 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.