Sunday 17 April 2011

WORKING WITH TASKS –Part 2

                                                            

TIMER TASK

The Timer task allows us to specify the period of time to wait before the Power Center Server runs the next task in the workflow. The Timer task has two types of settings:

  • Absolute time: We specify the exact date and time or we can choose a user-defined workflow variable to specify the exact time. The next task in workflow will run as per the date and time specified.
  • Relative time: We instruct the Power Center Server to wait for a specified period of time after the Timer task, the parent workflow, or the top-level workflow starts.

Example: Run session s_m_filter_example relative to 1 min after the timer task.

Steps for creating workflow:

  1. Workflow -> Create -> Give name wf_timer_task_example -> Click ok.
  2. Click Tasks -> Create -> Select TIMER from list. Give name TIMER_Example. Click Create and then done.
  3. Link TIMER_Example to START task.
  4. Right click TIMER_Example-> EDIT -> TIMER tab.
  5. Select Relative Time Option and Give 1 min and Select ‘From start time of this task’ Option.
  6. Apply -> OK.
  7. Drag s_m_filter_example and link it to TIMER_Example.
  8. Workflow-> Validate and Repository -> Save.

clip_image002

DECISION TASK

  • The Decision task allows us to enter a condition that determines the execution of the workflow, similar to a link condition.
  • The Decision task has a pre-defined variable called $Decision_task_name.condition that represents the result of the decision condition.
  • The Power Center Server evaluates the condition in the Decision task and sets the pre-defined condition variable to True (1) or False (0).
  • We can specify one decision condition per Decision task.

Example: Command Task should run only if either s_m_filter_example or

S_M_TOTAL_SAL_EXAMPLE succeeds. If any of s_m_filter_example or

S_M_TOTAL_SAL_EXAMPLE fails then S_m_sample_mapping_EMP should run.

Steps for creating workflow:

  1. Workflow -> Create -> Give name wf_decision_task_example -> Click ok.
  2. Drag s_m_filter_example and S_M_TOTAL_SAL_EXAMPLE to workspace and link both of them to START task.
  3. Click Tasks -> Create -> Select DECISION from list. Give name DECISION_Example. Click Create and then done. Link DECISION_Example to both s_m_filter_example and S_M_TOTAL_SAL_EXAMPLE.
  4. Right click DECISION_Example-> EDIT -> GENERAL tab.
  5. Set ‘Treat Input Links As’ to OR. Default is AND. Apply and click OK.
  6. Now edit decision task again and go to PROPERTIES Tab. Open the Expression editor by clicking the VALUE section of Decision Name attribute and enter the following condition: $S_M_FILTER_EXAMPLE.Status = SUCCEEDED OR $S_M_TOTAL_SAL_EXAMPLE.Status = SUCCEEDED
  7. Validate the condition -> Click Apply -> OK.
  8. Drag command task and S_m_sample_mapping_EMP task to workspace and link them to DECISION_Example task.
  9. Double click link between S_m_sample_mapping_EMP & DECISION_Example & give the condition: $DECISION_Example.Condition = 0. Validate & click OK.
  10. Double click link between Command task and DECISION_Example and give the condition: $DECISION_Example.Condition = 1. Validate and click OK.
  11. Workflow Validate and repository Save.
  12. Run workflow and see the result.

clip_image002[5]

CONTROL TASK

  • We can use the Control task to stop, abort, or fail the top-level workflow or the parent workflow based on an input link condition.
  • A parent workflow or worklet is the workflow or worklet that contains the Control task.
  • We give the condition to the link connected to Control Task.

Control Option

Description

Fail Me

Fails the control task.

Fail Parent

Marks the status of the WF or worklet that contains the

Control task as failed.

Stop Parent

Stops the WF or worklet that contains the Control task.

Abort Parent

Aborts the WF or worklet that contains the Control task.

Fail Top-Level WF Fails the workflow that is running.
Stop Top-Level WF Stops the workflow that is running.
Abort Top-Level WF Aborts the workflow that is running.

 

Example: Drag any 3 sessions and if anyone fails, then Abort the top level workflow.

Steps for creating workflow:

  1. Workflow -> Create -> Give name wf_control_task_example -> Click ok.
  2. Drag any 3 sessions to workspace and link all of them to START task.
  3. Click Tasks -> Create -> Select CONTROL from list. Give name cntr_task.
  4. Click Create and then done.
  5. Link all sessions to the control task cntr_task.
  6. Double click link between cntr_task and any session say s_m_filter_example and give the condition: $S_M_FILTER_EXAMPLE.Status = SUCCEEDED.
  7. Repeat above step for remaining 2 sessions also.
  8. Right click cntr_task-> EDIT -> GENERAL tab. Set ‘Treat Input Links As’ to OR. Default is AND.
  9. Go to PROPERTIES tab of cntr_task and select the value ‘Fail top level
  10. Workflow’ for Control Option. Click Apply and OK.
  11. Workflow Validate and repository Save.
  12. Run workflow and see the result.

clip_image002[7]

ASSIGNMENT TASK

  • The Assignment task allows us to assign a value to a user-defined workflow variable.
  • See Workflow variable topic to add user defined variables.
  • To use an Assignment task in the workflow, first create and add the
  • Assignment task to the workflow. Then configure the Assignment task to assign values or expressions to user-defined variables.
  • We cannot assign values to pre-defined workflow.

Steps to create Assignment Task:

  1. Open any workflow where we want to use Assignment task.
  2. Edit Workflow and add user defined variables.
  3. Choose Tasks-Create. Select Assignment Task for the task type.
  4. Enter a name for the Assignment task. Click Create. Then click Done.
  5. Double-click the Assignment task to open the Edit Task dialog box.
  6. On the Expressions tab, click Add to add an assignment.
  7. Click the Open button in the User Defined Variables field.
  8. Select the variable for which you want to assign a value. Click OK.
  9. Click the Edit button in the Expression field to open the Expression Editor.
  10. Enter the value or expression you want to assign.
  11. Repeat steps 7-10 to add more variable assignments as necessary.
  12. Click OK.

No comments :

Post a Comment