I have an update. I decided against implementing automatic cancellation of tasks in the deployment program. Instead, it will now create the object cleanup list and check for associated running tasks
before any objects have been loaded or replaced. If any running tasks are found for objects that whould be cleaned up, the deployment will be aborted and the deploying user notified. This way we avoid the possible situation wherein a batch has some old objects and some new, and multiple running instances of what are essentially the same objects. (Obviously this would only happen if someone deployed an object — e.g., from DEV to PROD — and later deployed a renamed version of the same object while the old one was still running. This may seem unlikely, but I’m sure it would eventually happen.)
The pre-deployment check for running tasks will help us to enforce the policy of ensuring that our batch developers deactivate tasks for old objects before they deploy new versions of these objects.
The next challenge I’m working on is coming up with a general and robust approach to automated deactivation of a tasks associated with a list of objects, when these pieces of information are not known ahead of time:
• the possible relationships between the objects in the list
• the status of any tasks associated with these objects
I’ve chosen to deactivate tasks in order, by object type:
# |
| Name |
| Type |
1 |
| Schedule |
| JSCH |
2 |
| Event |
| EVNT |
3 |
| Workflow |
| JOBP |
4 |
| Script |
| SCRI |
5 |
| Job |
| JOBS |
6 |
| FileTransfer |
| JOBF |
7 |
| Group |
| JOBG |
8 |
| Notification |
| CALL |
This will eliminate many instances of the error
Cannot deactivate task with RunID '0022555744', a task within a Workflow cannot be deactivated. (message nr: 11164)
.
There will inevitably be many instances of the warning
Cannot deactivate task with RunID '0001066723', this task is not active anymore. (message nr: 11163)
because child tasks will be deactivated when their parent tasks (workflows, schedules) are deactivated. The cleanup step will ignore these warnings.
I have considered querying the Automation Engine to find out the hierarchy of tasks, and deactivating only the top task in the tree. However, I think this would probably be more trouble than it is worth.