Executing Objects: Generating Task at Activation Time vs Generating Task at Runtime
Executable objects go through four execution stages, the second one being the generation stage. During this stage, various steps happen in a specific sequence that prepare the task for the execution. One of those steps is the generation of the script (if available).
When you configure an object, you must decide the exact moment during the generation stage in which the script will be generated. You do this on the Attributes page by setting the following parameter:
-
Generate Task at: Activation time
The script is generated at the beginning of the generation stage
-
Generate Task at: Runtime
The script is generated later in the generation stage
It is important to understand the sequence in which the generation steps happen, and the impact of this setting particularly if you use script elements to enhance the logic of your Jobs.
This graphic illustrates the order in which the most important generation steps occur and the difference that this setting makes:
(CLick to expand)
In stand-alone objects, that is, objects that are executed NOT within a parent object, such as a Workflow or a Schedule, this setting may not make much of a difference. However, this setting can make a big difference for tasks in Workflows because the time lapse between task activation and task generation can e very long.
To explain the difference between both options, we will use a Workflow with two Jobs. The Workflow looks like this:
Generate at Activation Time
If you select this option, each Job object is generated earlier in the Workflow execution process, immediately after its activation phase has ended.
This graphic illustrates what happens:
This list describes what happens:
- The Workflow is activated.
- The Workflow is generated.
- Job 1 is activated.
- Job 1 is generated.
- Job 2 is activated.
- Job 2 is generated.
- The Workflow is processed.
- Job 1 is processed.
- Job 1 is completed.
- Job 2 is processed.
- Job 2 is completed
- The Workflow is completed.
When Should You Select this Option?
You have a very long Workflow that requires a long time for the preparation steps (activation and generation) and you need it to start at a specific time (you have defined a start time). Select this option and define a start time, for example 30 minutes before the actual time you want the Workflow to start. This leaves 30 minutes for the preparatory steps.
Generate at Runtime
This is the option that you will probably want to apply in most cases. When you select Generate Task at: Runtime, the object is generated later in the execution process, immediately before the generation stage starts.
This graphic illustrates what happens:
This list describes what happens:
- The Workflow is activated.
- Job 1 is activated.
- Job 2 is activated.
- The Workflow is generated.
- The Workflow is processed.
- Job 1 is generated.
- Job 1 is processed
- Job 1 is completed
- Job 2 is generated.
- Job 2 is processed
- Job 2 is completed.
- The Workflow is completed.
In case of Workflows with many tasks, there can be an important time difference between the Workflow activation and the generation of its last task, for example.
When Should You Select this Option?
Since tasks are generated at a later stage in the process, all the data that the script in a task might need is already available.
Example: A task in a Workflow can be generated only if some files are available in your system. Those files are the result of a previous task in the Workflow (a File Transfer). With the Generate Task at: Runtime option you can be sure that the files are already available when the task needs them.
When Are PromptSets Called?
The following settings and execution scenarios determine when PromptSets are called:
- The Generate Task at: Activation time / Runtime setting that you define on the object Attributes page
-
Whether it is a stand alone object or not
A stand alone object is an object that you execute on its own using the Execute command.
An object is not considered to be stand alone if executed in one of the following ways:
- From within a Workflow or Schedule
- Using the Execute Recurring command
PromptSets and Generate Task at: Activation Time
In stand alone objects that you execute manually, PromptSets pop up almost immediately after you have selected the Execute command. If the object runs in a Workflow, its PromptSets pop up also almost immediately after the Workflow is activated.
Let's suppose that both the Workflow and Job 1 that we used in our previous examples have a PromptSet. This list illustrates when the respective PromptSets are called:
- The Workflow is activated.
- The Workflow PromptSet is called.
- The Workflow is generated.
- Job 1 is activated.
- The Job 1 PromptSet is called.
- Job 1 is generated.
- Job 2 is activated.
- Job 2 is generated.
- The Workflow is processed.
- Job 1 is processed.
- Job 1 is completed.
- Job 2 is processed.
- Job 2 is completed
- The Workflow is completed.
PromptSets and Generate Task at: Runtime
In stand alone objects that you execute manually, there is virtually no delay when you use the Generate Task at Runtime option. The PromptSet pops up almost immediately after you have executed the object because there is no delay between activation and generation. However, if an object with a PromptSet runs within a Workflow, it will be called immediately before its generation stage starts.
Again, let’s suppose that both the Workflow and Job 1 have a PromptSet respectively. This list describes what happens:
- The Workflow is activated.
- The Workflow PromptSet is called.
- The Workflow is generated.
- Job 1 is activated.
- Job 2 is activated.
- The Workflow is processed.
- The Job 1 PromptSet is called.
- Job 1 is generated.
- Job 1 is processed
- Job 1 is completed
- Job 2 is generated.
- Job 2 is processed
- Job 2 is completed.
- The Workflow is completed.
See also: