The conductor-python
repository provides the client SDKs to manage:
- Task workers
- Tasks & Workflows
- Schedules & Secrets
- Role Based Access Control (RBAC)
Building the task workers in Python mainly consists of the following steps:
- Setup conductor-python package
- Create and run task workers
- Create a virtual environment to build your package
virtualenv conductor
source conductor/bin/activate
- Get Conductor Python SDK
python3 -m pip install conductor-python
Everything related to server settings should be done within the Configuration
class by setting the required parameter (when initializing an object) like this:
from conductor.client.configuration.configuration import Configuration
configuration = Configuration(
server_api_url='https://play.orkes.io/api',
debug=True
)
- server_api_url : Conductor server address. For example, if you are running locally, it would look like;
http://localhost:8000/api
. - debug: It can take the values true/false.
true
for verbose loggingfalse
to display only the errors
Configure the authentication settings if your Conductor server requires authentication.
See Access Control for more details on role-based access control with Conductor and generating API keys for your environment.
from conductor.client.configuration.configuration import Configuration
from conductor.client.configuration.settings.authentication_settings import AuthenticationSettings
configuration = Configuration(
authentication_settings=AuthenticationSettings(
key_id='key',
key_secret='secret'
)
)
Conductor uses Prometheus to collect metrics.
metrics_settings = MetricsSettings(
directory='/path/to/folder',
file_name='metrics_file_name.extension',
update_interval=0.1,
)
directory
: Directory to store the metrics.- Ensure that you have already created this folder, or the program should have permission to create it for you.
file_name
: File where the metrics are stored.- example:
metrics.log
- example:
update_interval
: Time interval in seconds to refresh metrics into the file.- example:
0.1
means metrics are updated every 0.1s or 100ms.
- example:
The next step is to create and run task workers.
Builing tasks and workflows involve usage of Orkes Clients that can be used to do the following:
We can use the metadata client to manage task and workflow definitions.
You can execute workflows using code.
You can manage tasks using code.
You can unit test your conductor workflows on a remote server before running them on production..
You can handle errors returned from any of the Orkes Client SDK methods.
You can manage schedules using code.
You can manage secrets using code.
You can manage applications, users, groups and permissions using code.