The Workflow Manager contains many types of tasks to help you build workflows and worklets. We can create reusable tasks in the Task Developer.
Types of tasks:
Task Type | Tool where task can be created | Reusable or not |
Session | Task Developer | Yes |
Email | Workflow Designer | Yes |
Command | Worklet Designer | Yes |
Event-Raise | Workflow Designer | No |
Event-Wait | Worklet Designer | No |
Timer | | No |
Decision | | No |
Assignment | | No |
Control | | No |
SESSION TASK
- A session is a set of instructions that tells the Power Center Server how and when to move data from sources to targets.
- To run a session, we must first create a workflow to contain the Session task.
- We can run as many sessions in a workflow as we need. We can run the Session tasks sequentially or concurrently, depending on our needs.
- The Power Center Server creates several files and in-memory caches depending on the transformations and options used in the session.
EMAIL TASK
- The Workflow Manager provides an Email task that allows us to send email during a workflow.
- Created by Administrator usually and we just drag and use it in our mapping.
Steps:
- In the Task Developer or Workflow Designer, choose Tasks-Create.
- Select an Email task and enter a name for the task. Click Create.
- Click Done.
- Double-click the Email task in the workspace. The Edit Tasks dialog box appears.
- Click the Properties tab.
- Enter the fully qualified email address of the mail recipient in the Email User Name field.
- Enter the subject of the email in the Email Subject field. Or, you can leave this field blank.
- Click the Open button in the Email Text field to open the Email Editor.
- Click OK twice to save your changes.
Example: To send an email when a session completes:
Steps:
- Create a workflow wf_sample_email
- Drag any session task to workspace.
- Edit Session task and go to Components tab.
- See On Success Email Option there and configure it.
- In Type select reusable or Non-reusable.
- In Value, select the email task to be used.
- Click Apply -> Ok.
- Validate workflow and Repository -> Save
- We can also drag the email task and use as per need.
- We can set the option to send email on success or failure in components tab of a session task.
COMMAND TASK
The Command task allows us to specify one or more shell commands in UNIX or DOS commands in Windows to run during the workflow.
For example, we can specify shell commands in the Command task to delete reject files, copy a file, or archive target files.
Ways of using command task:
1. Standalone Command task: We can use a Command task anywhere in the workflow or worklet to run shell commands.
2. Pre- and post-session shell command: We can call a Command task as the pre- or post-session shell command for a Session task. This is done in COMPONENTS TAB of a session. We can run it in Pre-Session Command or Post Session Success Command or Post Session Failure Command. Select the Value and Type option as we did in Email task.
Example: to copy a file sample.txt from D drive to E.
Command: COPY D:\sample.txt E:\ in windows
Steps for creating command task:
- In the Task Developer or Workflow Designer, choose Tasks-Create.
- Select Command Task for the task type.
- Enter a name for the Command task. Click Create. Then click done.
- Double-click the Command task. Go to commands tab.
- In the Commands tab, click the Add button to add a command.
- In the Name field, enter a name for the new command.
- In the Command field, click the Edit button to open the Command Editor.
- Enter only one command in the Command Editor.
- Click OK to close the Command Editor.
- Repeat steps 5-9 to add more commands in the task.
- Click OK.
Steps to create the workflow using command task:
- Create a task using the above steps to copy a file in Task Developer.
- Open Workflow Designer. Workflow -> Create -> Give name and click ok.
- Start is displayed. Drag session say s_m_Filter_example and command task.
- Link Start to Session task and Session to Command Task.
- Double click link between Session and Command and give condition in editor as
- $S_M_FILTER_EXAMPLE.Status=SUCCEEDED
- Workflow-> Validate
- Repository –> Save
WORKING WITH EVENT TASKS
We can define events in the workflow to specify the sequence of task execution.
Types of Events:
- Pre-defined event: A pre-defined event is a file-watch event. This event Waits for a specified file to arrive at a given location.
- User-defined event: A user-defined event is a sequence of tasks in the Workflow. We create events and then raise them as per need.
Steps for creating User Defined Event:
- Open any workflow where we want to create an event.
- Click Workflow-> Edit -> Events tab.
- Click to Add button to add events and give the names as per need.
- Click Apply -> Ok. Validate the workflow and Save it.
Types of Events Tasks:
- EVENT RAISE: Event-Raise task represents a user-defined event. We use this task to raise a user defined event.
- EVENT WAIT: Event-Wait task waits for a file watcher event or user defined event to occur before executing the next session in the workflow.
Example1: Use an event wait task and make sure that session s_filter_example runs when abc.txt file is present in D:\FILES folder.
Steps for creating workflow:
- Workflow -> Create -> Give name wf_event_wait_file_watch -> Click ok.
- Task -> Create -> Select Event Wait. Give name. Click create and done.
- Link Start to Event Wait task.
- Drag s_filter_example to workspace and link it to event wait task.
- Right click on event wait task and click EDIT -> EVENTS tab.
- Select Pre Defined option there. In the blank space, give directory and filename to watch. Example: D:\FILES\abc.tct
- Workflow validate and Repository Save.
Example 2: Raise a user defined event when session s_m_filter_example succeeds. Capture this event in event wait task and run session S_M_TOTAL_SAL_EXAMPLE
Steps for creating workflow:
- Workflow -> Create -> Give name wf_event_wait_event_raise -> Click ok.
- Workflow -> Edit -> Events Tab and add events EVENT1 there.
- Drag s_m_filter_example and link it to START task.
- Click Tasks -> Create -> Select EVENT RAISE from list. Give name
- ER_Example. Click Create and then done.Link ER_Example to s_m_filter_example.
- Right click ER_Example -> EDIT -> Properties Tab -> Open Value for User Defined Event and Select EVENT1 from the list displayed. Apply -> OK.
- Click link between ER_Example and s_m_filter_example and give the condition $S_M_FILTER_EXAMPLE.Status=SUCCEEDED
- Click Tasks -> Create -> Select EVENT WAIT from list. Give name EW_WAIT. Click Create and then done.
- Link EW_WAIT to START task.
- Right click EW_WAIT -> EDIT-> EVENTS tab.
- Select User Defined there. Select the Event1 by clicking Browse Events button.
- Apply -> OK.
- Drag S_M_TOTAL_SAL_EXAMPLE and link it to EW_WAIT.
- Mapping -> Validate
- Repository -> Save.
- Run workflow and see.