Using Timeouts Example Flow Chart

Using Timeouts Example Flow Chart

Timeouts allow you to take special measures if an action or trigger takes too long to execute. These become extremely useful when you wish to run a Process Action only for a certain amount of time, or take a different flow if an action takes to long to finish.

In this example you will set up a flow chart with a Process Action that runs a specific program. The program will run for a specified amount of time before timing out, which will kill the process. When the timeout is fired the execution will flow into a timeout flow and execute the action designated for that flow.

This example will also show you the behavior of timeouts with a Process Action. This behavior is special to Process Actions, which are killed upon timeout. Other actions, such as java actions, have to finish execution before following a timeout flow, if timed out.

Getting Started

To get started, run the Flux Designer. You can start the Designer by running the flux-designer script located within your Flux installation directory, or by running the “Flux Designer.exe” icon also located within your Flux installation directory or start menu for Windows users.

Flux Designer

     

      

Figure 1: 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/timeout”. To open the project, click the, , icon, browse to the previously mentioned directory, open the “fluxproject.fpr” file.
Next, make a new flow chart, by either 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 2: "New" Options

Name the flow chart “Timeout” and click Ok.

Creating Actions

Next, create the actions used in the flow chart. Locate the actions and triggers needed within the “Action” and “Trigger” tabs represented by Figure 3 below which is located to the left of the drawing canvas. Drag the actions listed below in the bulleted list into your drawing canvas and arrange them according to Figure 3 displayed below.

       

Figure 3: "Action” and "Trigger" Tabs

The bulleted list below gives you the following information: 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.

“Actions” Tab:

· Name: “Process Action” , Heading: “Most Popular”, Quantity: 1

· Name: “Console Action”, Heading: “Core” , Quantity: 2

Figure 4: The Actions Layout

Renaming Actions

Next, let’s give the actions more descriptive names. This will keep us from getting confused on which actions we are dealing with later in the example. Follow the steps below to edit an action’s name.

To edit an actions name:

  1. Right-Click on the action whose name you wish to edit. The menu shown below in Figure 5 will appear.

       

Figure 5: Editing the Action Name

  1. Click the “Edit action name” option on the drop down menu.
  2. Type in the name you wish to give the action.

Action Names

Use the bulleted list below as a reference to rename your actions.

Rename:

· “Console Action” to “Regular Work.”

· “Console Action 2” to “Timed Out Work!”

       

Figure 6: Renaming the Actions

Editing the Action Properties

Console Actions

Next, we need to edit the “Message” field for both Console Actions. First, click on the “Regular Work” Console Action” so that its “Action Properties” panel becomes viewable. Then, locate the “Message” field, under the “Action Properties” tab and click on the blank field to the right of the “Message” title until you are able to edit it. Type in: “Regular work will be done here.”.

Next, follow these steps for “Console Action 2”, except edit the message to read: “Timed out work has started”.

Process Action

Now, let’s edit the “Process Action” to open a program. First, click on the “Process Action” within the drawing canvas and move your cursor over to its “Action Properties” tab at the right of the screen.

Click the “Command” field so that you may edit it. You can now type in the command, “notepad.exe”, which will open the program “Notepad” upon runtime. If notepad is not available, type in any program that you can run on your computer. “Notepad” is used in this example for simplicity. Refer to Figure 7 below as a reference.

       

Figure 7: Editing the Process Actions Command

Next, set the “Destroy On Timeout” option which is located in the “Action Properties” tab to “true”. See Figure 8 below for a reference.

       

Figure 8: “Destroy On Timeout”

Setting up a Timeout

Next, let’s setup the timeout for the “Process Action”. Start by moving down to the “Timeout Expression” field within the “Process Action” “Action Properties” panel and click on it to make it editable. You must now type “+5s” within the field to set the “Timeout Expression” to fire in five seconds. Refer to Figure 9 below for a guide.

You may also use the “Timeout Expression Editor” by clicking on the  box to the right of the “Timeout Expression” field when it is editable. Business intervals are also available to use with timeouts. Use which ever one is better suited for your situation. For simplicity you will be using the “Timeout Expression” that is provided. If you would like to learn more about creating and using time expressions and business intervals features refer to the “End-Users Manual” or examples.

       

Figure 9: Timeout Expression

Setting up Flows

Next we need to create the flow from each action and trigger. Use Figure 10 displayed below as a guide to set up the flows for your flow chart. Follow the list of instructions below to create the flows.

  1. Click the blank white space within your drawing canvas.
  2. Click and hold on the action you wish to draw the flow from.
  3. Drag your cursor to the action you wish to draw the flow to and release.

     

Figure 10: Actions Flow

Setting up a Timeout Flow

Now we need to set up the timeout flow from the “Process Action” to the “Timed Out Work!” Console Action. First, right-click the flow from your “Process Action” to our “Timed Out Work!” Console Action. This will bring up the menu represented in Figure 11 below.

       

Figure 11: Flow Menu

Click on the “Edit flow condition” option at the top of the menu. A window similar to Figure 12 below will appear.

       
Figure 12: Flow Condition (Timeout Flow Condition)

Select the “Timeout Flow Condition” option and click Ok.

     

Figure 13: Timeouts Flow Chart

You should now have a working flow chart similar to the one shown in Figure 13 above that uses a timeout on a Process Action. The timeout will fire five seconds after the program that was initiated by the Process Action has run. The Process Action will then be stopped and the flow will be diverted into the “Timed Out Work!” Console Action.

Creating a Flux Engine

Next, create a Flux engine. To create an engine, run the start-unsecured-flux-engine script from the Flux installation directory.

Next, return 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 14 below will appear.

       
Figure 14: Job Scheduler Engine Setup

Click on the “Advanced” tab at the top of the “Flux remote engine” window and click .

You should be back at the Flux main screen. Look at the “Flux Engines” tab again. The engine you just started should look like Figure 15, shown below.

       
Figure 15: Indicator for running Engine

Running the Flow Chart

Next, export your flow chart to the engine. You can do this step by clicking on the  icon at the top right of the Flux main screen. 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 16 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. The menu and option are shown below in Figure 16.

       
Figure 20: Export Menu

       
Figure 16: Drawing Canvas Options

Click Ok in the window represented by Figure 17 below.

       
Figure 17: Export to Engine

A confirmation window illustrated below as Figure 23 will appear if the job 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 18: Successful Export of Job

Once this example is completed, you can shutdown your server by running the shut-down-unsecured-flux-engine script from the Flux installation directory. 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.