Skip to main content

Python client for Conductor

Python client for Conductor provides two sets of functions:

  1. Workflow management APIs (start, terminate, get workflow status etc.)
  2. Worker execution framework

NOTE: This repository has been forked from Netflix:conductor's client/python folder. Apart from the results of renaming the module from conductor to pyconductor, (as pip already contains a conductor module), there are no code changes. This repository is mostly meant to act as an easy way to install the python client for Netflix:conductor. There are also attempts made to add documentation to the client overall. As far as possible, the library will be kept in sync with the upstream branch.

Install

pip install pyconductor

Using Workflow Management API

Python class WorkflowClient provides client API calls to the conductor server to start manage the workflows.

Example

import sys
from pyconductor import conductor
import json

def getStatus(workflowId):

	workflowClient = conductor.WorkflowClient('http://localhost:8080/api')

	workflow_json = workflowClient.getWorkflow(workflowId)
	print json.dumps(workflow_json, indent=True, separators=(',', ': '))

	return workflow_json

Task Worker Execution

Task worker execution APIs facilitates execution of a task worker using python client. The API provides necessary mechanism to poll for task work at regular interval and executing the python worker in a separate threads.

Example

The following python script demonstrates workers for the kitchensink workflow.

from pyconductor.ConductorWorker import ConductorWorker

def execute(task):
	return {'status': 'COMPLETED', 'output': {'mod': 5, 'taskToExecute': 'task_1', 'oddEven': 0}, 'logs': ['one', 'two']}

def execute4(task):
	forkTasks = [{"name": "task_1", "taskReferenceName": "task_1_1", "type": "SIMPLE"},{"name": "sub_workflow_4", "taskReferenceName": "wf_dyn", "type": "SUB_WORKFLOW", "subWorkflowParam": {"name": "sub_flow_1"}}];
	input = {'task_1_1': {}, 'wf_dyn': {}}
	return {'status': 'COMPLETED', 'output': {'mod': 5, 'taskToExecute': 'task_1', 'oddEven': 0, 'dynamicTasks': forkTasks, 'inputs': input}}

def main():
	print 'Hello World'
	cc = ConductorWorker('http://localhost:8080/api', 1, 0.1)
	for x in range(1, 30):
		if(x == 4):
			cc.start('task_{0}'.format(x), execute4, False)
		else:
			cc.start('task_{0}'.format(x), execute, False)
	cc.start('task_30', execute, True)

if __name__ == '__main__':
    main()

Metadata

Release files for pyconductor 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyconductor 0.1.3
File Size Uploaded Provenance Actions
pyconductor-0.1.3.tar.gz 5.8 kB Without provenance Details for pyconductor-0.1.3.tar.gz

Release files / pyconductor-0.1.3.tar.gz

Download URL pyconductor-0.1.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c309c1d6a8fd58a85612ef9b08c61cfd7f2e6b7c0447f400d4d9e86694dbc5a8
BLAKE2b-256 checksum
How to use checksums
b19de0fe234b23b0a55ebcb3f019b5669a9b7ab4111d023d401b4ce5ea067c4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.6.5

Security for pyconductor 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page