Using Resources

JAMS Resources are powerful tools that can help you allocate how batch Jobs are run. Resources let you define the necessary requirements (weight) for all Jobs, allowing JAMS to determine which Jobs can or cannot run concurrently. You can also use Resources to create maintenance windows that will prevent Jobs from running for a specified time. This is helpful during upgrades or maintenance activities, such as moving the JAMS Scheduler or backing up the database.

Resources can be assigned to Folders and Jobs. The Resource is defined by setting a specific quantity. Jobs will then use a portion of this quantity when they run. If you assign the Resource at the Folder level, all Jobs within the Folder will inherit the Resource setting.

Determining the Resource Quantity to Assign

When manually modifying Resources, how do you know how much or how little to assign to a particular Job? JAMS provides several ways to determine if a Resource is working above or below its effective allocation.

Insert the Quantity Available and Quantity in Use Columns

To see what Resources are currently active, use the Column Chooser to insert the Quantity Available and Quantity in Use columns in the Resource Definitions View.

Access the Monitor

Open the Monitor to view the status of all Jobs. If a Job has stalled or displays a ‘Waiting for Resources’ description, consider adjusting the Resource allocation.

Run a Script

You can run the following PowerShell script to return the quantity of Resources that are currently in use.

Copy
#### Report Resource Usage
Import-Module JAMS
$JAMSServer = "localhost"
$JAMSDefaultServer = $JAMSServer
New-PSDrive JD JAMS $JAMSServer -ErrorAction SilentlyContinue

$jamsentries = get-jamsentry -server $JAMSServer
$EntryReport= @()
$ResourceReport= @()

foreach ($jamsentry in $jamsentries){
   $entry=get-jamsentry $jamsentry.jamsentry
   $resourcerequirements = $entry.Elements | where-object {($_ -is [MVPSI.JAMS.ResourceRequirement])}
    foreach ($resourcerequirement in $resourcerequirements){
        write-output "$($entry.jamsentry) $($entry.Name) $($entry.CurrentState) $($ResourceRequirement.ResourceName) $($ResourceRequirement.QuantityRequired) $($ResourceRequirement.ElementState)"
        $out = New-Object psobject
        $out | Add-Member noteproperty Entry-Entry $($entry.jamsentry)
        $out | Add-Member noteproperty Entry-Name $($entry.Name)
        $out | Add-Member noteproperty Entry-ResourceName $($ResourceRequirement.ResourceName)
        $out | Add-Member noteproperty Entry-QuantityRequired $($ResourceRequirement.QuantityRequired)
        $out | Add-Member noteproperty Entry-ElementState $($ResourceRequirement.ElementState)
        $EntryReport += $out
    }
}

$EntryReport | ft

write-output "`n*** Resources ***"
$resources = Get-Childitem -Path JD:\Resources
foreach ($resource in $resources) {
        $out = New-Object psobject
        $out | Add-Member noteproperty Resource-Name $($resource.Name)
        $out | Add-Member noteproperty Resource-QuantityAvailable $($resource.QuantityAvailable)
        $out | Add-Member noteproperty Resource-QuantityInUse $($resource.QuantityInUse)
        $ResourceReport += $out
}

$ResourceReport | ft

Resource Allocation

JAMS will automatically control how each Job acquires and releases the Resources assigned to them. Before a Job runs, JAMS compares the available Resource pool with the quantity required by the Job. If the available Resources exceed the required amount by the Job, the Job will execute. When the Job is completed, the Resources are released and added back to the available Resource pool.

The Resource quantity available can be manually increased or decreased at any time. You can make the modifications in one place, the Resource Definition, and it is available to all Jobs that need it.

As your batch processes move from one operating system to another, JAMS continues to enforce the assigned Resources requirements.

Resource Behavior

Resources have some unique characteristics that are listed below:

  • Jobs inherit the Resources that have been defined in their respective Folders.
  • Jobs can reduce or increase the inherited Resource requirements.
  • Jobs can add their own Resource requirements.
  • Sufficient Resources must be available for a Job to run.
  • Resources can be specific to an Agent or server.
  • Resources can be used on any operating system that is supported by JAMS.
  • The available Resource quantity can be increased or decreased at any time.
  • Requirements for different Resources can be added to the same Folder or Job.

Resource Definitions View

The Resource Definitions screen lets you view all existing Resources, create new Resources, and modify existing Resources. Each Resource displays the following:

  • Resource Name – The name to identify a Resource.
  • Description – The description to provide more information about the Resource.

You can add additional columns by using the Column Chooser. Right-click a column heading, and select Column Chooser.

Adding a Resource Definition

You can create a Resource definition to use with your Jobs. When you create the Resource, you have full access to it. If you want others to be able to modify or create a Job with that resource requirement, ensure the Security settings are configured properly for that user. However, users do not need permissions on a Resource to create/update a Job in a Folder that inherits the Resource requirement from a parent Folder.

  1. Click Resources from the Shortcuts menu.
  2. Click +.
  3. In the Name field, enter a name for the Resource.
  4. In the QtyAvailable field, enter a quantity for the Resource.
  5. Click Ok.
  6. Click the Available tab.
  7. To set the Resource to be used with only a specific Agent, do the following:
    1. Select the Agent Specific checkbox.
    2. To add the Agent, click in the field under Agent Name and select the Agent.
    3. In the Quantity Available field, enter the Resource quantity for the Agent.
  8. Click the Security tab to select the access level for the Resource for any other users who will modify the Resource or reference the Resource in their Jobs.
  9. Click Save and Close.

Inheriting a Resource Definition from a Folder

Jobs can inherit the Resources defined within their Folder. This inheritance feature simplifies the assignment of Resources to any Job. If you set a Resource on a Job, that setting will override the inheritance from the Folder.

Follow the steps described in the section: Adding a Resource to a Job or Folder.

Adding a Resource to a Job or Folder

  1. Click Definitions from the Shortcuts menu.
  2. Right-click a Job or Folder, and select Properties.
  3. Click the Schedule tab.
  4. Click +.
  5. Select This Job depends on a | Resource.
  6. In the Resource field, select the name of the Resource you want to add.
  7. In the Quantity Required field, select the number of Resources this Job or Folder requires to run. You can also enter a negative number to reduce the required Resources. This allows inherited Resource requirements to be overridden.
  8. Click Finish.
  9. Click Save and Close.

Modifying a Resource Definition

You can modify a Resource by changing its name, description, quantity available, and security settings. You can also add or remove Resource requirements from an Agent.

  1. Click Resources from the Shortcuts menu.
  2. Double-click a Resource to open its definitions window.
  3. Click the Resource tab to change the name or description of the Resource.
  4. Click the Available tab to do the following:
    1. Modify the Quantity Available for the Resource.
    2. Add, delete, or modify the Agent names that will have Resource requirements. See the section below for details.
  5. Click the Security tab to select the access level for the Resource for any other users who will modify the Resource or reference the Resource in their Jobs.
  6. Click Save and Close.

For a complete listing and description of each Resource property, refer to the Resource Properties topic.

Deleting a Resource Definition

Before deleting a Resource, ensure all Job and Folders that currently use it have been updated to remove references to it. To view where it is referenced, double-click the Resource and select the References tab.

  1. Click Resources from the Shortcuts menu.
  2. Click the Resource you want to delete.
  3. Right-click the Resource, and select Delete.
  4. Click Yes.
NOTE: You must have the proper level of access to the Resource Definition to add or delete a Resource.

Resource Requirements for Agents

Adding a Resource requirement to an Agent is optional. When you add a Resource requirement to an Agent, a set number of Resources from the Resource pool is available for Jobs that run on the Agent. This is useful when you want to restrict the number of Jobs that will run on one Agent as compared to another Agent. If an Agent has a lower load capacity than another Agent, enter a lower quantity on that Agent and a higher quantity on the Agent with a greater load capacity. JAMS will check the available Resources on the Agent before the Job runs.

If no Resource requirement has been added to an Agent, Jobs will use the Resources that have been allocated to the Resource pool.

Adding a Resource Requirement to an Agent

  1. Click Resources from the Shortcuts menu.
  2. Double-click the Resource that you want to edit.
  3. Click the Available tab.
  4. Under Agent Details, ensure the Agent Specific checkbox is selected.
  5. Under Agent Name, click the row to select an Agent.
  6. Under Quantity Available, enter the quantity of Resources that are available to that Agent.
  7. Click Save and Close.

Deleting a Resource Requirement from an Agent

  1. Click Resources from the Shortcuts menu.
  2. Double-click the Resource that you want to edit.
  3. Click the Available tab.
  4. Under Agent Name, click in the row to select an Agent to remove.
  5. Press the Delete key.
  6. Click OK.
  7. Click Save and Close.