needs

The needs keyword defines resources that must be available before a job or job stream is launched. You can use the needs keyword either in a job stream definition or in the definition of the contained jobs, not in both.

Syntax

needs [n] [folder/][workstation#][folder/]resourcename [,...]

Arguments

n
Specifies the number of resource units required. Possible values are 1 to 1024 for each needs statement. The default is 1.
[folder/]workstation
Specifies the name of the workstation on which the resource is locally defined, and optionally, the name of the folder in which the workstation is defined. If not specified, the default is the workstation where the dependent job or job stream runs. Resources can be used as dependencies only by jobs and job streams that run on the workstation where the resource is defined.

Due to the resources dependencies resolution mechanism, a resource dependency at job stream level can be considered 'local' (and then its use supported) rather than 'global', when both the job stream and all its jobs are defined on the same workstation as the resource.

However, a standard agent and its host can reference the same resources.

[folder/]resourcename
Specifies the name of the resource.

Comments

A job or job stream can request a maximum of 1024 units of a resource in a needs statement. At run time, each needs statement is converted in holders, each holding a maximum of 32 units of a specific resource. Independently from the amount of available units of the resource, for a single resource there can be a maximum of 32 holders. If 32 holders are already defined for a resource, the next job or job stream waiting for that resource waits until a current holder terminates AND the needed amount of resource becomes available.

Examples

The following example prevents job stream sked3 from being launched until three units of cputime, and two units of tapes become available:
schedule sked3 on fr
  needs 3 cputime,2 tapes :
The jlimit resource has been defined with two available units. The following example allows no more than two jobs to run concurrently in job stream sked4:
schedule sked4 on mo,we,fr :
  joba needs 1 jlimit
  jobb needs 1 jlimit
  jobc needs 2 jlimit    <<runs alone>>
  jobd needs 1 jlimit
end