Practice: Create An Event
Objective
To use Events to cancel a job in a workflow when a preceding job finishes okay.
Instructions
Create the Schedule
- In Solution Manager, from the Home tab, select Studio.
- Click the Add button on the toolbar.
- In the Schedule Name textbox, enter Event Schedule.
- In the Documentation textbox, enter This is a Training Schedule.
- In the Schedule Build and Maintenance frame, mark the Auto Build checkbox.
- Set
7
for the number of days in advance for Auto Build. - Set
1
for the number of days to Auto Build. - Mark the Auto Delete checkbox.
- Set
7
for the number of days to Auto Delete. - Click the Save button.
Create the Jobs
- In Solution Manager, select Studio.
- In the Schedule List, select Event Schedule.
- Click the View button in the toolbar.
- In the Menu to the right, select Add Job.
- In the Name textbox, enter Event Job 1
- In the Job Type drop-down list, select Windows.
- Expand the Task Details section to open the Details box.
- In the Machine Selection section, select the desired machine from the Machines or Machine Group drop down.
- In the General section, select the desired user from the User Id drop down.
- Under the Run section, type the following in the Command Line box:
timeout /t 10
- Click the Save button.
- Click the Lock button in the upper right-hand corner.
- Expand the Frequency box.
- Add a frequency for a Mon-Sun-O pattern.
- In the Frequency Name box, type Mon-Sun-O.
- Set When to Schedule as All Weeks.
- Select all days of the week by marking their check boxes.
- Be sure that the A/O/B/N radio button is set to On Date.
- Click the Save button.
- Click the Back button to return to the Job List.
- Using the filters at the top of the Job List, locate Event Job 1 and Copy it twice, once for Event Job 2 and once for Event Job 3.
Create the Event
- Using the filters at the top of the Job List, locate and select Event Job 1.
- Click Edit.
- Click the Lock icon to enter Admin Mode.
- Locate and expand the Events section.
- Click the + button.
- In the Create new Event screen:
- In the Send Event On dropdown, select Job Status.
- In the Job Status dropdown, select Finished OK.
- In the Event Template dropdown, select the $JOB:CANCEL event.
- In the Schedule Date field, use the Magic Wand or CTRL+SPACE to enter in $SCHEDULE DATE.
- In the Schedule Name field, use the Magic Wand or CTRL+SPACE to enter in $SCHEDULE NAME.
- In the Job Name field, enter in the job name for Event Job 3.
- Click Save.
- Click Save.
- Close Library.
info
For all events, you can use System Properties for fields like the Schedule Date and Schedule Name.
- For example: To use a
$JOB:CANCEL,<Schedule date>,<Schedule name>,<Job name>
event, you can substitute the following for the appropriate fields:<Schedule date>
can be replaced with eitherCURRENT
,[[$DATE]]
, or[[$SCHEDULE DATE]]
<Schedule name>
needs to be replaced with either the full name of the Schedule the Job is in or[[$SCHEDULE NAME]]
<Job name>
needs to be replaced with the name of the Job this Event is going to cancel
Add Dependencies
- Open Studio.
- Select Event Schedule.
- Click View.
- Click Event Job 3.
- In the side menu, select Add Dependency.
- In the Job Dependency pop-up, select Event Job 2 in the Job drop down list.
- Verify that the Dependency Type is Requires and the Condition is Finished OK.
- Click the Save button.
- Repeat Steps 26-30 to add a dependency between Event Job 1 and Event Job 2.
- Close Studio.
Build the Schedule
- In Operations, select Schedule Build.
- In the Schedule Date section, validate that today's date is specified for both From and To.
- In the Schedule Build section, click the Released radio button.
- Toggle on Overwrite Existing Schedules.
- In the Schedule Selection list, select Event Schedule.
- Click the Build button.
- Expand and click on the schedule link for Event Schedule to return to the Processes screen.
- Verify that the Event processed in Event Job 1 has successfully Cancelled Event Job 3.