This example demonstrates how you can use Flux's workflow priorities to ensure that important workflows are always executed as soon as possible. Workflow priorities are used in conjunction with the CONCURRENCY_LEVEL configuration option to make sure that more important, or higher priority, workflows get executed before less important (low priority) workflows. If the concurrency level is full but there are still more workflow awaiting execution, each workflow's priority will be checked to determine which workflow should run next.
Workflow priorities are useful when not all of your workflows can run at once (for example, if processing power is limited) and you need to ensure that certain workflows run before others. Since not all of your workflows can run at once, you will often to need to ensure that the most important tasks are completed first.
Viewing the Example Files
Your Flux installation includes a working, pre-constructed version of this example. To load the example file:
- Click the "Repository" tab.
- Choose the "Workflows" option.
- Click the "Upload" button.
In the dialog that appears, browse to <Flux Home>/examples/end_users/job_priority, and upload each of the three .ffc files located there.
When the workflow finishes uploading, select it from the grid and choose the "Edit" button to view the workflow in the Designer.
Navigating to the Designer
The Flux Designer will be used to create and execute the example workflows. To use the Designer, browse to the Operations Console and select the "Designer" tab.
When you visit the Designer, you'll se a blank workspace representing the new workflow. To create the example, we'll start by populating the workflow with a few actions.
To add an action to the workflow, select the appropriate category from
When you return to the Designer, you will see a blank workspace representing the new workflow. To create the example, you will need to populate the new workflow with a few actions.
To add an action to the workflow, you'll first need to select the action's category in the panel to the left of the workspace. Once you've selected the appropriate category, the action will appear in the panel – left-click the action and drag it onto the Designer workspace to add it to the workflow.
The following table contains the type, category, and quantity of each trigger and action we'll use in this example.
Once you've added your Console Action, click the "/Workflow" text to rename the workflow. Name this workflow "/High Priority Job".
Save the workflow using the "Save to Repository" button, then repeat this process twice more, creating a "/Medium Priority Job" and "/Low Priority Job".
Editing the Workflow Properties
Now that the workflows are created, we'll want to set the priorities. Browse to the repository, find the "/High Priority Job", and click the "Edit" button to bring the workflow back up in teh Designer.
Once the workflow is loaded, right-click somewhere on the canvas and select "Workflow Properties". You'll see the following dialog:
Select the priority and edit it to read the number "1", then click "Save". Save the updated workflow to the repository, then repeat the process to set the priority to "2" for the medium priority workflow, and "3" for the low priority.
Editing the Action Properties
Now, we'll want to head back to the Repository and edit our "/High Priority Job" again. This time, we'll be setting up the descriptive message that the workflow will display.
Double-click the Console Action to open its action properties, find the "Message" field, and set the message to read:
"High Priority Job Has Fired."
Once again, save your changes, then repeat the process for the other two workflows, adding the respective messages "Medium Priority Job Has Fired." and "Low Priority Job Has Fired."
Running the Example
Once you're finished editing, head back to the Repository, select each of the three workflows, and click "Start" to begin running the flows.
Browse to the standard output for your engine (typically, the console where the engine is running, or the service log file when running as a service). The output will look something like this — notice the order in which the messages are displayed:
High priority job has fired.
Medium priority job has fired.
Low priority job has fired.
That's it! You've now successfully prioritized workflows using Flux.