⚠️ This repository is abandoned.
Easy Asynchronous Jobs Manager for Developers
Explore the docs »
Website
·
Python Library
·
Tutorial in Python
Zenaton helps developers to easily run, monitor and orchestrate background jobs on your workers without managing a queuing system. In addition to this, a monitoring dashboard shows you in real-time tasks executions and helps you to handle errors.
This repository contains examples of workflows built with Zenaton. These examples illustrates how Zenaton orchestrates tasks that are executed on different workers.
Download this repo
git clone https://github.com/zenaton/examples-python.git && cd examples-python
then add an .env file
cp .env.example .env
and populate it with your application id and api token found here.
Or use the .env.example
file in this repo.
These a the minimal requirements to run the Zenaton client:
ZENATON_APP_ID=*****************
ZENATON_API_TOKEN=***************************
ZENATON_APP_ENV=dev
Install dependencies
pip3 install -r requirements.txt
Then, you need to install a Zenaton worker
curl https://install.zenaton.com | sh
and start it, and make it listen to your configuration:
zenaton start; zenaton listen --env=.env --boot=boot.py
Your all set!
Simply run
docker-compose build; docker-compose up
You're all set!
Your workflows will be processed by your worker, so you won't see anything except the stdout and stderr, respectively zenaton.out
and zenaton.err
. Look at these files :)
This example showcases
- A single execution of a task.
python3 launch_task.py
This example showcases
- a sequential execution of three tasks. The second and third tasks are executed only when the previous one is processed.
- In a sequential task execution, you can get the output of a task. The result of a task can be used by the next one.
python3 launch_sequential.py
This example showcases
- a parallel execution of 2 tasks
- a third task that is executed only after both first two tasks were processed
python3 launch_parallel.py
this example showcases
- Asynchronous executions of Task A and Task B (fire and forget)
- Then sequential executions of Task C and Task D
python3 launch_asynchronous.py
When a task is dispatched asynchronously, the workflow continues its execution without waiting for the task completion. Consequently, a task asynchronous dispatching always returns a null value.
This example showcases
- how to change a workflow's behaviour based on an external event
python3 launch_event.py
This example showcases
- how the provided
Wait
task can be used to pause the workflow for a specified duration
This example showcases
- how the provided
Wait
task can also be used to pause the workflow up to receiving a specific external event
This example showcases
- how launching events or workflows directly from orchestrated tasks allows you to schedule recurring workflows
python3 launch_recursive.py
This example showcases
- how to update your workflow implementation, even while previous versions are still running
python3 launch_version.py
This example showcases
- how a failed task appear on Zenaton website
- how to retry a failed task using the retry button
python3 launch_error.py
This example showcases
- how a failed task can be retried automatically
- how to customize the automatic retry policy
python3 launch_automatic_retry.php
This example showcases
- how to schedule a task to make it run periodically
python3 schedule_task_a.py
Triggering An Email After 3 Days of Cold Weather (Medium Article, Source Code)