Skip to main content

Running First Workflow

In this article we will explore how we can run a simple workflow (without deploying a microservice.)

Start Conductor

The quickest way to get started with Conductor is to use the free Orkes Playground.

We have also included instructions on how to use an instance of Conductor.


Configuring our First Workflow

This is a sample workflow that we can leverage for our test.

Workflow JSON

{
"name": "first_sample_workflow",
"description": "First Sample Workflow",
"version": 1,
"tasks": [
{
"name": "get_population_data",
"taskReferenceName": "get_population_data",
"inputParameters": {
"http_request": {
"uri": "https://datausa.io/api/data?drilldowns=Nation&measures=Population",
"method": "GET"
}
},
"type": "HTTP"
}
],
"inputParameters": [],
"outputParameters": {
"data": "${get_population_data.output.response.body.data}",
"source": "${get_population_data.output.response.body.source}"
},
"schemaVersion": 2,
"restartable": true,
"workflowStatusListenerEnabled": false,
"ownerEmail": "example@email.com",
"timeoutPolicy": "ALERT_ONLY",
"timeoutSeconds": 0
}

JSON explainer

Feel free to skip to Creating the Workflow if you're in a hurry.

The JSON has a name, description and version of the workflow:

  "name": "first_sample_workflow",
"description": "First Sample Workflow",
"version": 1,

This workflow contains just one worker, listed under the key tasks:

{
"name": "get_population_data",
"taskReferenceName": "get_population_data",
"inputParameters": {
"http_request": {
"uri": "https://datausa.io/api/data?drilldowns=Nation&measures=Population",
"method": "GET"
}
},
"type": "HTTP"
}

Here is a list of fields and what it does:

  1. "name" : Name of our worker
  2. "taskReferenceName" : This is a reference to this worker in this specific workflow implementation.
  3. "inputParameters" : These are the inputs into our worker. We've hardcoded the inputs here, but dynamic inputs are also possible. (Our Beginner Codelab has an example of this.)
  4. "type" : The task type (in our example - this a HTTP task to make a REST API call).
  5. "http_request" : The required inputs for a HTTP tasks are a URL and the type or request.

Creating the Workflow

We have two options to add the Workflow into Conductor: using the Conductor UI, or via API.

Both Orkes Playground and Conductor have a Dashboard that allows for the visual creation of Workflows.

  1. Open Workflow Creation page:
  • Open Source: Click Definitions in the top menu. Click the New Workflow Definition button.
  • Orkes Playground: Click Workflow definitions in the left navigation. Click the Define Workflow button.
  1. Copy the workflow JSON from above, and paste it into the editor.

  2. Click Save (and then Confirm save), and your workflow diagram will appear next to the definition.

We are now ready to run the workflow!

Running the Workflow

To run the workflow, we again have the option of running the workflow via the UI or the API.

  1. To run your workflow via the UI click the following link:
  • Conductor: http://localhost:5000/workbench
  • Playground: https://play.orkes.io/runWorkflow

UI of the Workbench page in OS Conductor

  1. Choose your workflow name. The other fields can be left blank.

  2. Start the workflow.

  • Conductor: Press the "play" arrow to the right of "Workflow Workbench."
  • Playground: Press "Run Workflow" button.

The workflowID will appear. Click this to open the execution diagram of your workflow.

Workflow Results

We can visualize the workflow results in the Conductor UI:

http://localhost:5000/execution/<WORKFLOW_ID>
or:
http://play.orkes.io/execution/<WORKFLOW_ID>

Replace <WORKFLOW_ID> with our workflow id from the previous step. We should see a screen like below. Click on the different tabs to see all inputs and outputs and task list etc. Explore away!

Conductor UI - Workflow Run

The concludes the tutorial. Feel free to explore the codelabs and other tutorials to try additional features of Conductor.