Skip to content

Starting a workflow

Workflows can also be started programmatically through the Python API client. Each workflow is input as workdata to execute_workflow, a special platform-wide step function. If you have already created a workflow on the platform, running it is as simple as finding its self-link in the workflow explorer, then passing it as workdata to execute_workflow; you can then review the results of execution in the return slot. The report itself is in JSON format, making programmatic access simple.

import json
from pinexq.client.job_management import Job, WorkData
job = (
Job(client).create("workflow_job")
.select_processing(function_name="execute_workflow")
.assign_input_dataslot(0, work_data_urls=["https://jobs.api.pinexq.net/api/WorkData/019c0000-0000-0000-88ac-d08c000000000"])
.start()
.wait_for_completion(timeout_s=60.0)
)
report_workdata = json.load(job.get_output_dataslots()[0].assigned_workdatas[0].download_link.download())