Moab Web Services > Resources > Reservations

Reservations

This section describes behavior of the Reservations object in Moab Web Services. It contains the URLs, request bodies, and responses delivered to and from MWS.

The Fields: Reservations reference contains the type and description of all fields in the Reservations object. It also contains details regarding which fields are valid during PUT and POST actions.

Supported methods

Resource GET PUT POST DELETE
/rest/reservations Get All Reservations -- Create Reservation --
/rest/reservations/<id> Get Single Reservation Modify Reservation -- Release Reservation

This topic contains these sections:

Getting Reservations

The HTTP GET method is used to retrieve Reservation information. Queries for all objects and a single object are available.

Quick reference

GET http://localhost:8080/mws/rest/reservations/<id>?api-version=3

Restrictions

Only admin or user reservations are returned with this call.

Get All Reservations

URLs and parameters

GET http://localhost:8080/mws/rest/reservations?api-version=3

See Global URL Parameters for available URL parameters.

Sample response

GET http://localhost:8080/mws/rest/reservations?api-version=3&fields=id
------------------------------------

{
  "totalCount": 3,
  "resultCount": 3,
  "results":   [
    {"id": "system.1"},
    {"id": "system.2"},
    {"id": "system.3"}
  ]
}

Get Single Reservation

URLs and parameters

GET http://localhost:8080/mws/rest/reservations/<id>?api-version=3
Parameter Required Type Valid values Description
id Yes String -- The unique identifier of the object.

See Global URL Parameters for available URL parameters.

Sample response

JSON response
------------------------------------

{
  "accountingAccount": "",
  "accountingGroup": "",
  "accountingQOS": "",
  "accountingUser": "root",
  "aclRules": [  {
    "affinity": "NEUTRAL",
    "comparator": "LEXIGRAPHIC_EQUAL",
    "type": "RESERVATION_ID",
    "value": "system.43"
  }],
  "allocatedNodeCount": 1,
  "allocatedProcessorCount": 8,
  "allocatedTaskCount": 1,
  "allocatedNodes": [
  	{"id":"node001"}
  ],
  "comments": "",
  "creationDate": null,
  "duration": 200000000,
  "endDate": "2018-03-17 16:49:10 UTC",
  "excludeJobs":   [
    "job1",
    "job2"
  ],
  "expireDate": null,
  "flags":   [
    "REQFULL",
    "ISACTIVE",
    "ISCLOSED"
  ],
  "globalId": "",
  "hostListExpression": "",
  "id": "system.43",
  "idPrefix": "",
  "isActive": true,
  "isTracked": false,
  "label": "",
  "maxTasks": 0,
  "messages": [],
  "owner":   {
    "name": "adaptive",
    "type": "USER"
  },
  "partitionId": "switchB",
  "profile": "",
  "requirements":   {
    "architecture": "",
    "featureList":     [
      "feature1",
      "feature2"
    ],
    "featureMode": "",
    "memory": 0,
    "nodeCount": 0,
    "nodeIds": ["node001:1"],
    "os": "",
    "taskCount": 1
  },
  "reservationGroup": "",
  "resources": {"PROCS": 0},
  "startDate": "2011-11-14 20:15:50 UTC",
  "statistics":   {
    "caps": 0,
    "cips": 2659.52,
    "taps": 0,
    "tips": 0
  },
  "subType": "Other",
  "taskCount": 0,
  "trigger": null,
  "triggerIds": [],
  "uniqueIndex": "",
  "variables": {}
}

Creating Reservations

The HTTP POST method is used to create Reservations.

Quick reference

POST http://localhost:8080/mws/rest/reservations?api-version=3

Create Reservation

URLs and parameters

POST http://localhost:8080/mws/rest/reservations?api-version=3

See Global URL Parameters for available URL parameters.

Request body

The request body below shows all the fields that are available when creating a Reservation, along with some sample values.

JSON request body
------------------------------------

{
  "accountingAccount": "",
  "accountingGroup": "",
  "accountingQOS": "",
  "accountingUser": "root",
  "aclRules": [  {
    "affinity": "POSITIVE",
    "comparator": "LEXIGRAPHIC_EQUAL",
    "type": "GROUP",
    "value": "staff"
  }],
  "comments": "",
  "duration": 200000000,
  "endDate": "2018-03-17 16:49:10 UTC",
  "excludeJobs":   [
    "job1",
    "job2"
  ],
  "flags":   [
    "SPACEFLEX",
    "ACLOVERLAP",
    "SINGLEUSE"
  ],
  "hostListExpression": "",
  "idPrefix": "",
  "label": "myreservation",
  "owner":   {
    "name": "adaptive",
    "type": "USER"
  },
  "partitionId": "",
  "profile": "",
  "requirements":   {
    "architecture": "",
    "featureList":     [
      "feature1",
      "feature2"
    ],
    "memory": 0,
    "os": "",
    "taskCount": 1
  },
  "reservationGroup": "",
  "resources":   {
    "PROCS": 2,
    "MEM": 1024,
    "DISK": 1024,
    "SWAP": 1024,
    "other1": 17,
    "other2": 42
  },
  "startDate": "2011-11-14 20:15:50 UTC",
  "subType": "Other",
  "trigger": {
    "eventType":"START",
    "actionType":"EXEC",
    "action":"date"
  },
  "variables":   {
    "var1": "val1",
    "var2": "val2"
  }
}

This example is to create a reservation if no conflicting reservations are found. (This is the equivalent to mrsvctl -c -h node01 -E.)

JSON request body
------------------------------------

{
  "flags":   [
    "DEDICATEDRESOURCE"
  ],
  "hostListExpression": "node01"
}

Sample response

JSON Response for successful POST
------------------------------------

{"id": "system.44"}

Modifying Reservations

The HTTP PUT method is used to modify Reservations.

Quick reference

PUT http://localhost:8080/mws/rest/reservations/<id>?api-version=3&change-mode=<add|remove|set>

Modify Reservation

URLs and parameters

PUT http://localhost:8080/mws/rest/reservations/<id>?api-version=3&change-mode=<add|remove|set>
Parameter Required Type Valid values Description
id Yes String -- The unique identifier of the object.
change-mode Yes String

add

remove

set

If add, add the given variables to the variables that already exist.

If remove, delete the given variables from the variables that already exist.

If set, replace all existing variables with the given variables.

See Global URL Parameters for available URL parameters.

Request body

The request body below shows all the fields that are available when modifying a Reservation, along with some sample values.

JSON request body for reservation modify
------------------------------------

{
  "variables":   {
    "var1": "val1",
    "var2": "val2"
  }
}

Sample response

This message may not match the message returned from Moab exactly, but is given as an example of the structure of the response.

JSON response
------------------------------------

{"messages":["reservation 'system.43' attribute 'Variable' changed."]}

Restrictions

You can change the ACL Rules on a reservation, but not using this resource. See Create or Update ACL.

Releasing Reservations

The HTTP DELETE method is used to release Reservations.

Quick reference

DELETE http://localhost:8080/mws/rest/reservations/<id>?api-version=3

Release Reservation

URLs and parameters

DELETE http://localhost:8080/mws/rest/reservations/<id>?api-version=3
Parameter Required Type Valid values Description
id Yes String -- The unique identifier of the object.

See Global URL Parameters for available URL parameters.

Sample response

JSON Response for successful DELETE
------------------------------------

{}

Related Topics 

© 2015 Adaptive Computing