Generating at Activation or 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:

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:

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:

Time line indicating the sequence: 1 Activation starts, 2 RunID is assigned, 3 the task is visible in Process Monitoring, 4 Activation ends, 5 Task is generated, 6 Agent is assigned, 7 PromptSet is called, 8 Variables are resolved, 9 Generation starts, 10 Queue is assigned, 11 Object properties are read, 12 Script is processed, 13 Generation ends

This list describes what happens:

  1. The Workflow is activated.
  2. The Workflow is generated.
  3. Job 1 is activated.
  4. Job 1 is generated.
  5. Job 2 is activated.
  6. Job 2 is generated.
  7. The Workflow is processed.
  8. Job 1 is processed.
  9. Job 1 is completed.
  10. Job 2 is processed.
  11. Job 2 is completed
  12. 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 processing stage starts.

This graphic illustrates what happens:

Time line indicating the sequence: 1 Activation starts, 2 RunID is assigned, 3 the task is visible in Process Monitoring, 4 Activation ends, 5 Agent is assigned, 6 PromptSet is called, 7 Variables are resolved, 8 Generation starts, 9 Queue is assigned, 10 Object properties are read, 11 Script is processed, 12 Task is generated, 13 Generation ends

This list describes what happens:

  1. The Workflow is activated.
  2. Job 1 is activated.
  3. Job 2 is activated.
  4. The Workflow is generated.
  5. The Workflow is processed.
  6. Job 1 is generated.
  7. Job 1 is processed
  8. Job 1 is completed
  9. Job 2 is generated.
  10. Job 2 is processed
  11. Job 2 is completed.
  12. 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:

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:

  1. The Workflow is activated.
  2. The Workflow PromptSet is called.
  3. The Workflow is generated.
  4. Job 1 is activated.
  5. The Job 1 PromptSet is called.
  6. Job 1 is generated.
  7. Job 2 is activated.
  8. Job 2 is generated.
  9. The Workflow is processed.
  10. Job 1 is processed.
  11. Job 1 is completed.
  12. Job 2 is processed.
  13. Job 2 is completed
  14. 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:

  1. The Workflow is activated.
  2. The Workflow PromptSet is called.
  3. The Workflow is generated.
  4. Job 1 is activated.
  5. Job 2 is activated.
  6. The Workflow is processed.
  7. The Job 1 PromptSet is called.
  8. Job 1 is generated.
  9. Job 1 is processed
  10. Job 1 is completed
  11. Job 2 is generated.
  12. Job 2 is processed
  13. Job 2 is completed.
  14. The Workflow is completed.

See also: