Managing a resource definition from the Orchestration CLI

You can run the new command to create a resource. Configure the mandatory and optional parameters to create a unique resource.

When creating a resource definition, you can define it in a folder. If no folder path is specified, then the definition is created in the default folder. By default, it is the root (/) folder, but you can customize it to a different folder path. For more information, see Installing and authenticating the Orchestration CLI.

Syntax and command line options

Run the following command to create a resource definition.
ocli model new [resource / res]
After running the command, fill in the following template to create a resource:
---
Kind: Resource
Def:
 Folder: <mandatory>
 Name: <mandatory>
 Workstation: <optional>
 Description: <optional>
 Quantity: <mandatory>
---
Mandatory attributes
Folder
Specify a valid folder name. The name must start with a letter or a number, and can contain alphanumeric characters, dashes, and underscores. The name of the folder cannot contain spaces. You must include a forward slash (/) before the folder name if you want to define an absolute path, while it is not required for relative paths.
Name
Specify a name for the resource definition. The name must start with a letter or a number, and can contain alphanumeric characters, dashes, and underscores. The name cannot contain spaces.
Quantity
Specify the quantity as a positive integer. The maximum quantity that you can specify for a single resource definition is 2,147,483,647 units.
Optional attributes
Workstation
Specify a valid workstation. The name must start with a letter and can contain alphanumeric characters, dashes, and underscores. The name of the workstation cannot contain spaces.
Description
Add any description as free text.

Adding resource dependencies to tasks or workflows

After running the command ocli model new [resource | res], a resource definition is created with a unique ID. You can add a resource dependency either in a task inside a workflow or in an embedded task definition or workflow as follows:
resourceDependencies:
-	 resource: [[/workstationfolder/workstationname#/foldername/resourcename] | [workstationname#/foldername/resourcename] | [/foldername/resourcename] | resourcename]
        quantity: <mandatory>
        shared: <true or false>
Resource
If the resource definition is associated with a workstation, enter the workstation name followed by #/ and the resource name. Otherwise, enter only the resource name.
quantity
Specify a positive integer as quantity.
Shared
Specify true to share the quantity of a single resource definition across multiple tasks or workflows. Otherwise, specify false.
Important:
  • For a task or workflow in plan, if the number of resource units allotted is not available, then the task or workflow remains in READY_WAITING_FOR_RESOURCE state.

  • If the number of units allotted to a task or workflow does not match with the total quantity of units of the resource, then the task or workflow remains in READY_WAITING_FOR_USER_INTERVENTION.

Examples

  1. Add a resource dependency to the embedded task jd2 in the js2 workflow as follows:
    ---
    kind: JobStream
    def:
      folder: /
      name: JS2
      workstation: /WS_AGT_0
      saturdayIsFree: true
      sundayIsFree: true
      priority: 10
      asap: false
      perJobLatestStart: false
      lateStartAction: doNotRun
      matchingCriteria:
        type: previous
      resourceDependencies: []
      jobs:
      - name: JD2
        workstation: /WS_AGT_0
        jobDefinition:
          type: executable
          task:
            executable:
              virtualType: ByPath
              ByPath: {}
              environmentVariables: {}
              arguments: []
              path: ls
          recovery:
            action: STOP
            repeatAffinity: false
        priority: 10
        asap: false
        lateStartAction: doNotRun
        lateAction: continue
        resourceDependencies:
        - resource: /WS_AGT_0#/RESOURCE1
          quantity: 10
          shared: false
        minDurationAction: continue
        maxDurationAction: continue
        skipLateAction: overlap
    
  2. Add the resource dependency RESOURCE1 in the JS1 workflow, which contains the JD1 task as follows:
    ---
    kind: JobStream
    def:
      folder: /
      name: JS1
      workstation: /WS_AGT_0
      saturdayIsFree: true
      sundayIsFree: true
      priority: 10
      asap: false
      perJobLatestStart: false
      lateStartAction: doNotRun
      matchingCriteria:
        type: previous
      resourceDependencies:
      - resource: /WS_AGT_0#/RESOURCE1
        quantity: 1
        shared: false
      jobs:
      - name: JD1
        jobDefinitionRef: /WS_AGT_0#/JD1
        workstation: /WS_AGT_0
        priority: 10
        asap: false
        resourceDependencies: []