Personal tools

4.5.3. Job Constraints

Up one level
The Job Service Constraints

Job Constraints

The job constraints feature is a new experimental feature. It does not currently integrate with the SLA Management Service.

Job constraints are passed to platform scripts either from the Job Service using the -r command line argument (defined statically) or directly by the client user (using the client API) via a constraints XML file which the Job Service will store in the job session directory as resources.xml. The startJob platform script should parse these constraints and translate them to resource manager directives. Typical job service constraints are expected to describe resource constraints such as WallClockTime, CPUSpeed, PhysicalMemory, DiskSpace, etc.

Constraints passed from the Job Service as command line arguments should follow the form of name=value pairs, for example -r CPUSpeed=1800 (in MHz for a CPU speed constraint), or -r WallClockTime=3600 for a runtime constraint of an hour.

Job Service providers have to specify and advertise which job constraints a user is allowed to apply for a job run. This can be done easily with an apropriate XML schema. Client users can then submit jobs along with their constraints file. An example of a simple user supplied constraints file could be:

<?xml version="1.0"?>
<Resources>
        <CPUArchitecture>amd64</CPUArchitecture>
        <CPUSpeed>180</CPUSpeed>
        <PhysicalMemory>1024</PhysicalMemory>
        <!--DiskSpace>40</DiskSpace-->
        <WallClockTime>210</WallClockTime>
        <IndividualCPUCount>1</IndividualCPUCount>
        <TotalCPUCount>1</TotalCPUCount>
        <FileSizeLimit>200</FileSizeLimit>
</Resources>

A suitable XML schema for these constraints could be:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:annotation>
    <xsd:documentation xml:lang="en">
     GRIA resource schema
    </xsd:documentation>
  </xsd:annotation>

  <xsd:element name="Resources" type="ResourcesType"/>

  <xsd:complexType name="ResourcesType">
    <xsd:sequence>
      <xsd:element name="Comment" type="xsd:string" minOccurs="0"/>
      <xsd:element name="CPUArchitecture" type="cpuarchitecture" minOccurs="0" default="x86"/>
      <xsd:element name="CPUSpeed" type="xsd:int" minOccurs="0"/>
      <xsd:element name="PhysicalMemory" type="xsd:int" minOccurs="0"/>
      <xsd:element name="DiskSpace" type="xsd:int" minOccurs="0"/>
      <xsd:element name="WallClockTime" type="xsd:long"/>
      <xsd:element name="IndividualCPUCount" type="xsd:int" minOccurs="0" default="1"/>
      <xsd:element name="TotalCPUCount" type="xsd:int" minOccurs="0" default="1"/>
      <xsd:element name="FileSizeLimit" type="xsd:long" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:simpleType name="cpuarchitecture">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="x86"/>
      <xsd:enumeration value="ia64"/>
      <xsd:enumeration value="amd64"/>
      <xsd:enumeration value="sparc"/>
      <xsd:enumeration value="other"/>
    </xsd:restriction>
  </xsd:simpleType>

</xsd:schema>

Supported Constraints in the Supplied Platform Scripts

The platform (startJob) scripts supplied with GRIA implement the following job constraints:

WallClockTime
Maximum amount of time a job can run in seconds. If the job service and the user both specify this constraint, the minimum of the two is taken.
PhysicalMemory
The minimum amount of required physical memory in MB. If the job service and the user both specify this constraint, the maximum of the two is taken.
CPUSpeed
The minimum CPU speed required in MHz. If the job service and the user both specify this constraint, the maximum of the two is taken.
DiskSpace
The minimum amount of available disk space required in MB. If the job service and the user both specify this constraint, the maximum of the two is taken.
OSName
The Job Service overwrites the user supplied constraint.

Note: GRIA pre-supplied scripts are using XML::Simple perl module to handle the user constraints XML file, which is only capable of handling simple XML documents without attributes.

The following table shows which constraints are implemented with the GRIA pre-supplied platform scripts.

Constraint Unit Local execution PBS Condor
WallClockTime sec OK OK OK
PhysicalMemory MB - OK OK
CPUSpeed MHz OK (req. perl win32::Info for XP) - -
OSName <string> - OK OK
DiskSpace MB - - OK

Depending on the platform capabilities Job Service providers should customise section E of the startJob platform script accordingly.