4.12   Nodes

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

The supported methods table below requires each resource to be accessed with a URL parameter of api-version=3 in order to behave as documented. For more information, see 3.4  Requesting Specific API Versions.

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

Supported Methods

Resource GET PUT POST DELETE
/rest/nodes Get All Nodes -- -- --
/rest/nodes/<name> Get Single Node Modify Node -- --

In this section:

4.12.1 Getting Nodes

The HTTP GET method is used to retrieve Node information.

Quick Reference

GET https://localhost:8080/mws/rest/nodes/<name>?api-version=3

4.12.1.A  Get All Nodes

URLs and Parameters

GET https://localhost:8080/mws/rest/nodes?api-version=3
Parameter Required Type Description Example
query No JSON

Queries for specific results. It is possible to query by one or more fields based on MongoDB query syntax.

query={"type":"compute"}
sort No JSON

Sort the results. Use 1 for ascending and -1 for descending.

sort={"name":-1}

See 3.3  Global URL Parameters for available URL parameters.

This query will not return the DEFAULT or GLOBAL nodes from Moab HPC Suite. However, the Get Single Node task can be used to retrieve them individually if desired.

Sample Response

GET https://localhost:8080/mws/rest/nodes?api-version=3&fields=name
------------------------------------

{
  "totalCount": 3,
  "resultCount": 3,
  "results":   [
    {"name": "node1"},
    {"name": "node2"},
    {"name": "node3"}
  ]
}

4.12.1.B  Get Single Node

URLs and Parameters

GET https://localhost:8080/mws/rest/nodes/<name>?api-version=3
Parameter Required Type Value Description
name Yes String -- The name of the object.

See 3.3  Global URL Parameters for available URL parameters.

The attributes field is only applicable in API version 2 and later.

Sample Response

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

{
  "name": "l26.csa",
  "architecture": null,
  "classes": ["class1"],
  "attributes":   {
    "MOAB_DATACENTER":   {
      "value": "vcenter-datacenter-401",
      "displayValue": "vcenter-vcenter - adaptive data center"
    },
    "vcenter-vcenter-adaptive data center-compute nodes":     {
      "value": null,
      "displayValue": null
    }
  },
  "featuresCustom": ["feature1", "feature2"],
  "featuresReported": ["vcenter-vcenter-adaptive data center-compute nodes"],
  "index": 26,
  "ipAddress": "10.0.8.76",
  "lastUpdatedDate": "2024-05-24 20:18:11 UTC",
  "partition": "mws",
  "processorSpeed": null,
  "profilingEnabled": false,
  "rack": null,
  "resourceManagerMessages":   {
    "torque": null,
    "mws": null
  },
  "slot": null,
  "type": "compute",
  "messages": [  {
    "count": 11,
    "createdDate": "2024-10-24 04:06:04 UTC",
    "expireDate": "2037-10-24 12:26:40 UTC",
    "message": "This is a message"
  }],
  "metrics":   {
    "vmcount": 0,
    "cpuUtilization": 0.275,
    "cpuLoad": 0.01115
  },
  "variables":   {
    "VCENTER_DATASTORE_LOCAL1": "datastore-415",
    "VCENTER_DATASTORE_REMOTE1": "datastore-448"
  },
  "states":   {
    "powerState": "On",
    "powerStateExpected": null,
    "state": "Idle",
    "stateExpected": "Idle",
    "stateLastUpdatedDate": "2024-05-24 09:33:45 UTC",
    "subState": null,
    "subStateLast": null,
    "subStateLastUpdatedDate": null
  },
  "operatingSystem": "linux"
  "resources":   {
    "processors":     {
      "configured": 4,
      "real": 4,
      "dedicated": 0,
      "available": 4,
      "utilized": -1
    },
    "memory":     {
      "configured": 10239,
      "real": 10239,
      "dedicated": 0,
      "available": 9227,
      "utilized": 0
    },
    "disk":     {
      "configured": 0,
      "real": 0,
      "dedicated": 0,
      "available": 0,
      "utilized": 0
    },
    "swap":     {
      "configured": 0,
      "real": 0,
      "dedicated": 0,
      "available": 0,
      "utilized": 0
    }
  },
  "resourceManagers": [  {
    "name": "mws",
    "isMaster": true,
    "stateReported": "Active"
  }],
  "jobs": [],
  "reservations":   [
        {
      "name": "system.5",
      "type": "user"
    },
        {
      "name": "system.17",
      "type": "user"
    }
  ],
  "virtualContainers": [],
  "triggers": []
}

4.12.2 Modifying Nodes

The HTTP PUT method is used to modify Nodes.

Quick Reference

PUT https://localhost:8080/mws/rest/nodes/<name>?api-version=3[&proxy-user=<username>]

Restrictions

The proxy-user parameter is ignored unless you set ENABLEPROXY=TRUE in the moab.cfg file, for example:

ADMINCFG[1]           USERS=root,ted ENABLEPROXY=TRUE

4.12.2.A  Modify Node

URLs and Parameters

PUT https://localhost:8080/mws/rest/nodes/<name>?api-version=3[&proxy-user=<username>][&change-mode=set]
Parameter Required Type Value Description
name Yes String -- The name of the object.
proxy-user No String -- Perform the action as this user.

See 3.3  Global URL Parameters for available URL parameters.

Additional URL Parameters

Parameter Required Value Description
change-mode No

set (default)

add

remove

If set, replace all features with the features specified.

If add, add the specified features to existing features.

If remove, remove the specified features from existing features.

Request Body

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

Sample JSON request body to modify a node
------------------------------------

{  
  "featuresCustom": ["feature1", "feature2"],
  "messages":   [
    {"message": "Message one"},
    {"message": "Message two"}
  ],
  "metrics": {"pwatts": 211},
  "operatingSystem": "centos7.9",
  "partition": "part1",
  "states":   {
    "powerState": "On",
    "state": "Running"
  },
  "variables":   {
    "key": "value",
    "arbitrary text key": "more value"
  }
}

Sample Response

This message might not match the message returned from Moab HPC Suite exactly but is given as an example of the structure of the response.

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

{"messages":[
  "Successfully modified os to 'linux'",
  "Successfully powered node off"
]}

Related Topics