Summary
This article demonstrates how to use a Script to hold or release a Job Group from an executing job.
More Information
The Job Control Action provides a way for a running job to hold or release other jobs, but there is no built-in way to hold or release a job group. This can be accomplished using a Script.
To do this, add a step to your job and choose the Execute a Script task. Create a new script and set the language to VB.NET. Replace the script contents with the following:
Imports System
Imports System.Collections.Generic
Imports ArcanaDevelopment.adTempus.Shared
Imports ArcanaDevelopment.adTempus.ApplicationIntegration
Imports ArcanaDevelopment.adTempus.Client
Public Class UserScript
Inherits ArcanaDevelopment.adTempus.ApplicationIntegration.UserScriptBase
Public Overrides Function Run() As Object
dim groupName as string="" 'this operates on the Root group (affects all jobs). Put in the appropriate group name to operate on a different group
Using session = Scheduler.Connect("", LoginAuthenticationType.Windows, "", "")
Using context=session.NewDataContext()
Dim group=context.GetJobGroup(groupName)
group.UpdateHoldType(HoldType.DisableTriggers, MissedJobCheckOptions.NoCheck )
adTempus.LogMessage(MessageTypeEnum.Informational, 0, "Group held: " & groupName)
End Using
End Using
Return 0
End Function
End Class
Save the script and run the job. When this step executes, it will hold the root group (disabling triggers for all jobs).
To release a group, use the following code:
Imports System
Imports System.Collections.Generic
Imports ArcanaDevelopment.adTempus.Shared
Imports ArcanaDevelopment.adTempus.ApplicationIntegration
Imports ArcanaDevelopment.adTempus.Client
Public Class UserScript
Inherits ArcanaDevelopment.adTempus.ApplicationIntegration.UserScriptBase
Public Overrides Function Run() As Object
dim groupName as string="" 'this operates on the Root group (affects all jobs). Put in the appropriate group name to operate on a different group
Using session = Scheduler.Connect("", LoginAuthenticationType.Windows, "", "")
Using context=session.NewDataContext()
Dim group=context.GetJobGroup(groupName)
group.UpdateHoldType(HoldType.NotHeld, MissedJobCheckOptions.NoCheck )
adTempus.LogMessage(MessageTypeEnum.Informational, 0, "Group released: " & groupName)
End Using
End Using
Return 0
End Function
End Class
Caveats
The script uses Windows authentication to connect to the adTempus server. The Windows user account that the job is running under must have an associated adTempus login, and must have permission to view the job.