Open topic with navigation

TIBCO GridServer® 7.1.0

# Lifecycle Blocks

Lifecycle blocks include statements that execute during the life of a Service. The following sections describe the lifecycle blocks.

Other blocks include the options block, discriminator block, and schedule block.

## prejob

The prejob lifecycle block executes once at the very beginning of the job before any tasks are submitted to the Manager. These commands execute on the Driver.

## pretask

The pretask lifecycle block executes once on every Engine that processes tasks for the job before any tasks are processed. Use this block for generic initialization such as obtaining input files common to all tasks.

## task

Commands in the task lifecycle block execute once per task. The number of tasks in the Service is determined by the expression following the `task` keyword. Array variables referenced in the task block are indexed by the task ID, as explained in more detail in the Arrays section, below.

Since the same Engine can take more than one task, the statements in the `task` block run many times on the same Engine. The statements in the `pretask` and `posttask` blocks run only once per Engine.

The task block is the only required block in a PDS file. Thus a computation that only required executing a program ten times could be expressed by the PDS program:

    job simple
        task 10
            execute "myprog"
        end
    end

## posttask

The posttask lifecycle block executes once on every Engine at some point after the job finishes. Place Engine cleanup tasks here. Note that the Engine’s file cleaner automatically cleans all files in the `DSWORKDIR` directory. The posttask block typically executes after the postjob block executes on the Driver side, although it is not guaranteed to execute then. Execution order of the blocks in a PDS file is typically `prejob`, `pretask`, `task`, `postjob`, and `posttask`, but this is not guaranteed.

## postjob

The postjob lifecycle block executes once on the Driver after all tasks finish. Use this block to obtain outputs from the staging directory, run post-processing scripts, and so on.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO GridServer®

Copyright © 2001-2022. TIBCO Software Inc. All Rights Reserved.