Job Priority Example Flow Chart
This example demonstrates how you can use Flux's flow chart priorities to ensure that important jobs are always executed as soon as possible. Flow chart priorities are used in conjunction with the CONCURRENCY_LEVEL configuration option to make sure that more important, or higher priority, jobs get executed before less important (low priority) jobs. If the concurrency level is full but there are still more flow chart awaiting execution, each flow chart's priority will be checked to determine which job should run next.
Flow chart priorities are useful when not all of your jobs can run at once (for example, if processing power is limited) and you need to ensure that certain jobs run before others. Since not all of your flow charts can run at once, you will often to need to ensure that the most important tasks are completed first.
Running this Example from the XML File
If you wish to run this example using an existing flow chart, create a new flow chart from within the Flux Designer and select the “Import one flow chart from XML file:” check box.
Click the "Browse" icon to browse for the .ffc file you wish to import. Select the flow chart located in the same directory as this example and click “Open” then click "OK" button. See Figure 1 below.
Figure 1: Importing a Flux Flow Chart
To get started, run the Flux Designer. You can start the Designer by running the flux-designer script from your Flux installation directory.
Figure 2: Flux Designer Logo
Once you have the Flux Designer running, open the project that is located within the same directory as this example resides in, /examples/end_users/job_priority. To open the project, click the "Browse" icon, browse to the previously mentioned directory, and open the fluxproject.fpr file.
Next, make a new flow chart, either by going to the “file” pull down menu at the top left of the screen and selecting “New”, or by click on the icon directly below it to bring up the “New” window represented in Figure 3 below. Select the “New Flow Chart” option and click "OK".
Figure 3: "New" Options
Name the flow chart “High Priority Job” and click "OK".
Create two more flow charts the same way you created the “High Priority Job” flow chart. Name these next two flow charts “Medium Priority Job” and “Low Priority Job”.
Next, create the actions used in the flow charts. Locate the actions and triggers needed within the “Action” and “Trigger” tabs represented by Figure 4 below which is located to the left of the drawing canvas. Drag the appropriate actions, listed below in the bulleted list, into the corresponding flow chart’s drawing canvas.
Figure 4: "Action" and "Trigger" Tabs
The bulleted list below gives you the following information: The flow chart’s name that the action will be added into, the name of the action or trigger you need, the category that the action or trigger is located under, and how many instances are needed for this example.
· Action: “High Priority Job”, “Console Action” , Category: “Core”, Quantity: 1
· Action: “Medium Priority Job”, “Console Action” , Category: “Core”, Quantity: 1
· Action: “Low Priority Job”, “Console Action” , Category: “Core”, Quantity: 1
Next, let’s give the actions more descriptive names. This will keep us from getting confused on which actions we are dealing with in which flow chart, later in the example. Follow the steps below to edit an action’s name.
To edit an action's name:
- Right-Click on the action whose name you whish to edit. The menu shown below in Figure 5 will appear.
Figure 5: Editing the Action Name
- Click the “Edit action name” option on the drop down menu.
- Type in the name you wish to give the action.
Use the bulleted list below as a reference to rename your actions. The information presented below is in the form of the flow chart name, present name, and new name.
· “High Priority Job”, “Console Action” to “HP Console Action”
· “Medium Priority Job”, “Console Action” to “MP Console Action”
· “Low Priority Job”, “Console Action” to “LP Console Action”
Editing the Flow Chart Properties
Next, let’s edit the “Priority” option of each of the flow chart’s properties. First, edit the “High Priority Job” flow chart. To edit the priority, select the flow chart either from the “Project View” or by clicking on the “High Priority Job” tab at the top of the drawing canvas. Once you have the “High Priority Job” flow chart loaded, click on the blank white space within the drawing canvas. If the “Flow Chart Properties” panel, shown below in Figure 6, does not appear to the right of the Designer, click the “Flow Chart Properties” tab located at the right of the Designer. This will bring up the “Flow Chart Properties” panel. Select the “Priority” option within this panel, and edit it to hold the number “1” as shown below in Figure 6. By setting this option to one, you are explicitly setting this flow chart with a high priority.
Figure 6: Flow Chart Property Panel
Next, Edit the priority option for the other two flow charts within this project. Set the “Medium Priority Job” flow chart’s priority to “50”, and the “Low Priority Job” flow chart’s priority to “100”. Once these priorities are set, we can move onto the Console Actions.
Editing the Action Properties
First, let’s start by editing the “HP Console Action”, located within the “High Priority Job” flow chart. To edit this Console Action, load the “High Priority Job” flow chart with the Flux Designer. Once the flow chart is loaded, click the “HP Console Action” located within the drawing canvas. Once highlighted, the Console Action’s properties will appear to the right of the Flux Designer. Identify and highlight the “Message” field. Click the “...” editor button that appears to the right of the field. Edit this message property to read, “High priority job has fired.”, and click ok.
Edit the “Message” field, as explained above, for the “Medium Priority Job” flow chart’s “MP Console Action”, and “Low Priority Job” flow chart’s “LP Console Action”. Edit “Medium Priority Job” flow chart’s Console Action’s “Message” field to read, “Medium priority job has fired.”. Also, edit “Low Priority Job” flow chart’s Console Action’s “Message” field to read, “Low priority job has fired.”.
Creating the Flux Engine
Now that the flow charts are complete, create an engine by running the start-unsecured-flux-engine script from the Flux installation directory.
Export the Flow Charts
Return back to the Flux Designer and move your cursor over the “Flux Engines” tab located at the left of the screen.
Click the "+" button at the top of the “Flux Engines” tab and the window shown in Figure 10 below will appear.
Figure 10: Job Scheduler Engine Setup
Click on the “Advanced” tab at the top of the “Flux remote engine” window and click "OK".
You should be back at the Flux main screen. Look at the “Flux Engines” tab again. Your engine you just started will look similar to Figure 11 displayed below.
Figure 11: Indicator for running Engine.
Next, export your flow charts to the engine. You can export the flow charts to the engine by clicking on the "Export" icon at the top right of the Flux Designer. You may also export a job by clicking on the “Export” menu at the top of the screen and selecting “Export to remote job scheduler engine”. This menu is represented by Figure 12 below. Another way to export your job is by right-clicking on your drawing canvas and selecting the “Export to remote job scheduler engine” option. You will have to export each flow chart separately. The menu and option are shown below in Figure 13.
Figure 12: Export Menu
Figure 13: Drawing Canvas Options
Click "OK" in the window represented by Figure 14 below.
Figure 14: Export to Engine
A confirmation window illustrated below as Figure 15 will appear if the flow chart was successfully exported. Click the "OK" button on the confirmation message. If there is an error message, look over this example carefully, and correct any mistakes made.
Figure 15: Successful Export of Job
Once all three flow charts are exported successfully, browse back to your Operations Console. From the “Engine Info” page, start the engine by clicking the “start” button.
Browse back to you engine’s console and view what was printed to it. The output on the console will look similar to the output shown below. Notice the order in which the flow charts executed regardless of what order they were exported to the engine.
High priority job has fired.
Medium priority job has fired.
Low priority job has fired.
Once you are satisfied with the results, you can shut down the Flux engine by running the shut-down-unsecured-engine script from your Flux installation directory.