View | Details | Raw Unified | Return to ticket 9131 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/slurmrestd/plugins/openapi/v0.0.37/nodes.c (-1 / +41 lines)
Lines 50-55 Link Here
50
#include "src/common/xassert.h"
50
#include "src/common/xassert.h"
51
#include "src/common/xmalloc.h"
51
#include "src/common/xmalloc.h"
52
#include "src/common/xstring.h"
52
#include "src/common/xstring.h"
53
#include "src/common/node_select.h"
53
54
54
#include "src/slurmrestd/openapi.h"
55
#include "src/slurmrestd/openapi.h"
55
#include "src/slurmrestd/operations.h"
56
#include "src/slurmrestd/operations.h"
Lines 124-129 static void _add_node_state_flags(data_t *flags, uint32_t state) Link Here
124
125
125
static int _dump_node(data_t *p, node_info_t *node)
126
static int _dump_node(data_t *p, node_info_t *node)
126
{
127
{
128
	uint32_t my_state = node->node_state;
129
	uint16_t alloc_cpus = 0;
130
	int idle_cpus;
131
	uint64_t alloc_memory;
132
	char *node_alloc_tres = NULL;
127
	data_t *d;
133
	data_t *d;
128
134
129
	if (!node->name) {
135
	if (!node->name) {
Lines 132-137 static int _dump_node(data_t *p, node_info_t *node) Link Here
132
		return SLURM_SUCCESS;
138
		return SLURM_SUCCESS;
133
	}
139
	}
134
140
141
   slurm_get_select_nodeinfo(node->select_nodeinfo,
142
							 SELECT_NODEDATA_SUBCNT,
143
							 NODE_STATE_ALLOCATED,
144
							 &alloc_cpus);
145
146
	idle_cpus = node->cpus - alloc_cpus;
147
148
	if (idle_cpus  && (idle_cpus != node->cpus)) {
149
		my_state &= NODE_STATE_FLAGS;
150
		my_state |= NODE_STATE_MIXED;
151
	}
152
135
	d = data_set_dict(data_list_append(p));
153
	d = data_set_dict(data_list_append(p));
136
154
137
	data_set_string(data_key_set(d, "architecture"), node->arch);
155
	data_set_string(data_key_set(d, "architecture"), node->arch);
Lines 182-188 static int _dump_node(data_t *p, node_info_t *node) Link Here
182
		data_set_string_own(data_key_set(d, "owner"),
200
		data_set_string_own(data_key_set(d, "owner"),
183
				    uid_to_string_or_null(node->owner));
201
				    uid_to_string_or_null(node->owner));
184
	}
202
	}
185
	// FIXME: data_set_string(data_key_set(d, "partitions"), node->partitions);
203
	data_set_string(data_key_set(d, "partitions"), node->partitions);
186
	data_set_int(data_key_set(d, "port"), node->port);
204
	data_set_int(data_key_set(d, "port"), node->port);
187
	data_set_int(data_key_set(d, "real_memory"), node->real_memory);
205
	data_set_int(data_key_set(d, "real_memory"), node->real_memory);
188
	data_set_string(data_key_set(d, "reason"), node->reason);
206
	data_set_string(data_key_set(d, "reason"), node->reason);
Lines 198-203 static int _dump_node(data_t *p, node_info_t *node) Link Here
198
	data_set_string(data_key_set(d, "tres"), node->tres_fmt_str);
216
	data_set_string(data_key_set(d, "tres"), node->tres_fmt_str);
199
	data_set_string(data_key_set(d, "slurmd_version"), node->version);
217
	data_set_string(data_key_set(d, "slurmd_version"), node->version);
200
218
219
	select_g_select_nodeinfo_get(node->select_nodeinfo,
220
	                              SELECT_NODEDATA_TRES_ALLOC_FMT_STR,
221
	                              NODE_STATE_ALLOCATED, &node_alloc_tres);
222
223
	if(node_alloc_tres)
224
		data_set_string(data_key_set(d, "tres_used"), node_alloc_tres);
225
	else
226
		data_set_null(data_key_set(d, "tres_used"));
227
228
	slurm_get_select_nodeinfo(node->select_nodeinfo,
229
	                          SELECT_NODEDATA_MEM_ALLOC,
230
	                          NODE_STATE_ALLOCATED,
231
	                          &alloc_memory);
232
233
	data_set_int(data_key_set(d, "alloc_memory"), alloc_memory);
234
	data_set_int(data_key_set(d, "alloc_cpus"), alloc_cpus);
235
	data_set_int(data_key_set(d, "idle_cpus"), idle_cpus);
236
201
	return SLURM_SUCCESS;
237
	return SLURM_SUCCESS;
202
}
238
}
203
239
Lines 210-215 static int _op_handler_nodes(const char *context_id, Link Here
210
	data_t *errors = populate_response_format(d);
246
	data_t *errors = populate_response_format(d);
211
	data_t *nodes = data_set_list(data_key_set(d, "nodes"));
247
	data_t *nodes = data_set_list(data_key_set(d, "nodes"));
212
	node_info_msg_t *node_info_ptr = NULL;
248
	node_info_msg_t *node_info_ptr = NULL;
249
	partition_info_msg_t *part_info_ptr = NULL;
213
	time_t update_time = 0;
250
	time_t update_time = 0;
214
251
215
	if (tag == URL_TAG_NODES) {
252
	if (tag == URL_TAG_NODES) {
Lines 237-242 static int _op_handler_nodes(const char *context_id, Link Here
237
		rc = errno;
274
		rc = errno;
238
		goto done;
275
		goto done;
239
	} else if (!rc && node_info_ptr && node_info_ptr->record_count)
276
	} else if (!rc && node_info_ptr && node_info_ptr->record_count)
277
		if(!slurm_load_partitions((time_t) NULL, &part_info_ptr, SHOW_ALL))
278
			slurm_populate_node_partitions(node_info_ptr, part_info_ptr);
279
240
		for (int i = 0; !rc && i < node_info_ptr->record_count; i++)
280
		for (int i = 0; !rc && i < node_info_ptr->record_count; i++)
241
			rc = _dump_node(nodes,
281
			rc = _dump_node(nodes,
242
					   &node_info_ptr->node_array[i]);
282
					   &node_info_ptr->node_array[i]);
(-)a/src/slurmrestd/plugins/openapi/v0.0.37/openapi.json (-13 / +45 lines)
Lines 908-915 Link Here
908
            }
908
            }
909
          },
909
          },
910
          "preemption_mode": {
910
          "preemption_mode": {
911
            "type": "string",
911
            "type": "array",
912
            "description": "preemption type"
912
            "description": "preemption type",
913
            "items": {
914
              "type": "string"
915
            }
913
          },
916
          },
914
          "allowed_allocation_nodes": {
917
          "allowed_allocation_nodes": {
915
            "type": "string",
918
            "type": "string",
Lines 1258-1264 Link Here
1258
            "description": "Charge resources used by this job to specified account"
1261
            "description": "Charge resources used by this job to specified account"
1259
          },
1262
          },
1260
          "accrue_time": {
1263
          "accrue_time": {
1261
            "type": "string",
1264
            "type": "integer",
1265
            "format": "int64",
1262
            "description": "time job is eligible for running"
1266
            "description": "time job is eligible for running"
1263
          },
1267
          },
1264
          "admin_comment": {
1268
          "admin_comment": {
Lines 1385-1395 Link Here
1385
            "description": "highest exit code of all job steps"
1389
            "description": "highest exit code of all job steps"
1386
          },
1390
          },
1387
          "eligible_time": {
1391
          "eligible_time": {
1388
            "type": "string",
1392
            "type": "integer",
1393
            "format": "int64",
1389
            "description": "time job is eligible for running"
1394
            "description": "time job is eligible for running"
1390
          },
1395
          },
1391
          "end_time": {
1396
          "end_time": {
1392
            "type": "string",
1397
            "type": "integer",
1398
            "format": "int64",
1393
            "description": "time of termination, actual or expected"
1399
            "description": "time of termination, actual or expected"
1394
          },
1400
          },
1395
          "excluded_nodes": {
1401
          "excluded_nodes": {
Lines 1531-1541 Link Here
1531
            "description": "minimum tmp disk per node"
1537
            "description": "minimum tmp disk per node"
1532
          },
1538
          },
1533
          "preempt_time": {
1539
          "preempt_time": {
1534
            "type": "string",
1540
            "type": "integer",
1541
            "format": "int64",
1535
            "description": "preemption signal time"
1542
            "description": "preemption signal time"
1536
          },
1543
          },
1537
          "pre_sus_time": {
1544
          "pre_sus_time": {
1538
            "type": "string",
1545
            "type": "integer",
1546
            "format": "int64",
1539
            "description": "time job ran prior to last suspend"
1547
            "description": "time job ran prior to last suspend"
1540
          },
1548
          },
1541
          "priority": {
1549
          "priority": {
Lines 1566-1572 Link Here
1566
            "description": "enable or disable job requeue option"
1574
            "description": "enable or disable job requeue option"
1567
          },
1575
          },
1568
          "resize_time": {
1576
          "resize_time": {
1569
            "type": "string",
1577
            "type": "integer",
1578
            "format": "int64",
1570
            "description": "time of latest size change"
1579
            "description": "time of latest size change"
1571
          },
1580
          },
1572
          "restart_cnt": {
1581
          "restart_cnt": {
Lines 1597-1603 Link Here
1597
            "description": "sockets per node required by job"
1606
            "description": "sockets per node required by job"
1598
          },
1607
          },
1599
          "start_time": {
1608
          "start_time": {
1600
            "type": "string",
1609
            "type": "integer",
1610
            "format": "int64",
1601
            "description": "time execution begins, actual or expected"
1611
            "description": "time execution begins, actual or expected"
1602
          },
1612
          },
1603
          "state_description": {
1613
          "state_description": {
Lines 1621-1631 Link Here
1621
            "description": "pathname of job's stdout file"
1631
            "description": "pathname of job's stdout file"
1622
          },
1632
          },
1623
          "submit_time": {
1633
          "submit_time": {
1624
            "type": "string",
1634
            "type": "integer",
1635
            "format": "int64",
1625
            "description": "time of job submission"
1636
            "description": "time of job submission"
1626
          },
1637
          },
1627
          "suspend_time": {
1638
          "suspend_time": {
1628
            "type": "string",
1639
            "type": "integer",
1640
            "format": "int64",
1629
            "description": "time job last suspended or resumed"
1641
            "description": "time job last suspended or resumed"
1630
          },
1642
          },
1631
          "system_comment": {
1643
          "system_comment": {
Lines 1769-1775 Link Here
1769
            "description": "features required for batch script's node"
1781
            "description": "features required for batch script's node"
1770
          },
1782
          },
1771
          "begin_time": {
1783
          "begin_time": {
1772
            "type": "string",
1784
            "type": "integer",
1785
            "format": "int64",
1773
            "description": "Submit the batch script to the Slurm controller immediately, like normal, but tell the controller to defer the allocation of the job until the specified time."
1786
            "description": "Submit the batch script to the Slurm controller immediately, like normal, but tell the controller to defer the allocation of the job until the specified time."
1774
          },
1787
          },
1775
          "burst_buffer": {
1788
          "burst_buffer": {
Lines 2207-2215 Link Here
2207
            "type": "string",
2220
            "type": "string",
2208
            "description": "TRES on node"
2221
            "description": "TRES on node"
2209
          },
2222
          },
2223
          "tres_used": {
2224
            "type": "string",
2225
            "description": "TRES used on node"
2226
          },
2210
          "slurmd_version": {
2227
          "slurmd_version": {
2211
            "type": "string",
2228
            "type": "string",
2212
            "description": "Slurmd version"
2229
            "description": "Slurmd version"
2230
          },
2231
          "alloc_cpus": {
2232
            "type": "integer",
2233
            "description": "Allocated CPUs"
2234
          },
2235
          "idle_cpus": {
2236
            "type": "integer",
2237
            "description": "Idle CPUs"
2238
          },
2239
          "partitions": {
2240
            "type": "string",
2241
            "description": "Node partitions"
2242
          },
2243
          "alloc_memory": {
2244
            "type": "integer",
2245
            "description": "Allocated memory"
2213
          }
2246
          }
2214
        }
2247
        }
2215
      },
2248
      },
2216
- 

Return to ticket 9131