HCL Workload Automation, Version 9.4

Applying an order of preference to possible targets

In this scenario, you create a job that uses logical resources to apply an order of preference to a group of eligible target computers on which a job can run.

Business Goal

A company needs to establish an order of preference when selecting a target computer to run a job. The job is sent to the first available computer based on the specified order of preference policy. This is useful when more than one computer has suitable characteristics to run a given job. New machines can be added to the preference order and if two or more machines match the needed criteria, the order of preference is applied to select the target. In this scenario, target computers have similar or identical characteristics and are typically used as backups for each other during scheduled maintenance or in case of failover. The scenario consists of the following tasks:
  1. The administrator creates a logical resource for each of the eligible computer targets that are part of the preference order list. The logical resources are all of the same type and have a quantity that represents the preference value used to order the list.
  2. The administrator creates a definition for the job that must be run on the target computers according to the preference order.
  3. The administrator uses the Dynamic Workload Console to schedule the job.

Roles

This section lists the user roles needed to run the scenario:
dynamic workload broker Developer
Defines the jobs using the Job Brokering Definition Console
dynamic workload broker Operator
Monitors and controls the jobs that have been submitted.
HCL Workload Automation Job Scheduler
Manages the workload by submitting and monitoring jobs.

Software requirements

The following software must be installed and configured, before running this scenario:
  • A HCL Workload Automation network with the Dynamic Scheduling capability.
  • Optionally, the Dynamic Workload Console

Setting up the environment

To run this scenario, complete the tasks described in Setting up your environment for dynamic scheduling.

Running the Scenario

To create the logical resources and a job definition that selects a defined logical resource based on an established order of preference, perform the following steps:

Procedure

  1. Select the Define a New Logical Resource task option in the Dynamic Workload Consoleto create the logical resources needed for the job. The job must run on a Linux workstation. ComputerA, ComputerB, and ComputerC are Linux workstations that are suitable for running the job. ComputerA is the first preference. ComputerB is considered to be a backup if ComputerA is unavailable, and ComputerC is used if neither ComputerA nor ComputerB is available. Define the logical resources with the following characteristics:
    Table 1. Logical resources for defining an order of preference
    Logical resource name Type Quantity Computer
    Preference1 Preference 50 ComputerA
    Preference2 Preference 30 ComputerB
    Preference3 Preference 10 ComputerC
  2. To create the job definition, in the Job Brokering Definition Console select File > New > Job brokering definition and create a new job definition named jobWithPreference. The job definition opens at the Overview page with the job name assigned.
  3. Open the Application page and define the required information for the application that the job is to run. In the Type field select Executable. Specify the executable name and path. In this definition, the variable myApp is used to identify the executable myExecutable as shown in the sample JSDL file.
  4. Open the Resources page and select the Software Requirements tab.
  5. Create an operating system requirement, as follows:
    1. In the Candidate Operating Systems pane, click Add. The Operating System Details dialog box is displayed.
    2. In the Type field, select LINUX and click OK.
  6. Create a requirement for a logical resource, as follows:
    1. In the Logical Resources pane, click Add. The Logical Resource Details dialog box is displayed.
    2. In the Type field, type Preference (the type assigned to the three logical resources) and click OK.
  7. Open the Optimization page and specify an optimization objective, as follows:
    1. In the Type menu, choose Select best resource by optimization objective.
    2. In the Resource Type menu, select Logical Resource.
    3. In the Resource Property menu, select Quantity.
    4. In the Optimization Objective menu, select Maximize.
    When the job is submitted, it is sent to the first available workstation associated with the logical resource of type Preference that has the highest quantity available.
  8. Select File > Save to save the job definition file.
  9. Select the new JSDL and upload it to the server by clicking on the corresponding icon.
  10. Submit the job in one of the following ways, depending on whether you want to submit it as a broker job or by using a job definition.
    • Log in to the Dynamic Workload Console and choose the Dynamic Workload Broker portfolio option.
      • Select Definitions > Jobs . Optionally specify search criteria and click Search. Select the job definition you created in the previous steps.
      • To run the job, select Submit and click Go.
    • Log in to the Dynamic Workload Console.
      • Select Administration > Workload Design > Manage Workload Definitionsto open the Workload Designer. Create a new broker job definition by filling in the required fields as appropriate. In the Workload Broker Job Name field, type the name of the JSDL file that you created in the previous steps.
      • Submit the HCL Workload Automation job by selecting Workload > Submit > Submit Predefined Jobs .
      You can also add the job to an existing job stream , or submit the job using the jobsubmit command. For further information about the dynamic workload broker command-line interface, see HCL Workload Automation: Scheduling Workload Dynamically.

Expected Results

When the job is submitted, it is sent to the first available target computer associated with the logical resource of type Preference that has the highest quantity. If a selected target is unavailable, the job is submitted to the first available target in the order of preference. You can change preference values for your computers at any time. The new order becomes effective for job submission as soon as it is saved.

Sample Configuration file

The JSDL file created for this scenario has the following syntax:
<?xml version="1.0" encoding="UTF-8"?>
<jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" 
  xmlns:jsdle="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdle"
     name="JobWithPreference">
  <jsdl:variables>
    <jsdl:stringVariable name="myApp">myExecutable</jsdl:stringVariable>
  </jsdl:variables>
  <jsdl:application name="executable">
    <jsdle:executable interactive="false" path="${myApp}"/>
  </jsdl:application>
  <jsdl:resources>
    <jsdl:candidateOperatingSystems>
      <jsdl:operatingSystem type="LINUX"/>
    </jsdl:candidateOperatingSystems>
    <jsdl:logicalResource subType="Preference"/>
  </jsdl:resources>
  <jsdl:optimization name="JPT_BestResource">
    <jsdl:objective propertyObjective="maximize" resourcePropertyName="Quantity" 
      resourceType="LogicalResource"/>
  </jsdl:optimization>
</jsdl:jobDefinition>