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

Collapse All | Expand All

(-)a/src/slurmrestd/openapi.c (-1 / +57 lines)
Lines 60-65 static pthread_rwlock_t paths_lock = PTHREAD_RWLOCK_INITIALIZER; Link Here
60
static List paths = NULL;
60
static List paths = NULL;
61
static int path_tag_counter = 0;
61
static int path_tag_counter = 0;
62
static const data_t *spec = NULL;
62
static const data_t *spec = NULL;
63
static const char *api_path_prefix = "/slurm/v0.0.35";
63
64
64
typedef enum {
65
typedef enum {
65
	OPENAPI_TYPE_UNKNOWN = 0,
66
	OPENAPI_TYPE_UNKNOWN = 0,
Lines 229-234 fail: Link Here
229
	return NULL;
230
	return NULL;
230
}
231
}
231
232
233
static entry_t *_parse_openapi_path_with_prefix(const char *prefix, const char *str_path)
234
{
235
	entry_t *entries = NULL;
236
	entry_t *entry = NULL;
237
	int count = 0;
238
239
	entry_t *prefix_entries = _parse_openapi_path(prefix);
240
	if(!prefix_entries)
241
		return NULL;
242
243
	entry_t *path_entries = _parse_openapi_path(str_path);
244
	if(!path_entries)
245
		return NULL;
246
247
	for (entry_t *pe = prefix_entries; pe->type; pe++)
248
		count++;
249
250
	for (entry_t *pe = path_entries; pe->type; pe++)
251
		count++;
252
253
	entry = entries = xcalloc((count + 1), sizeof(entry_t));
254
255
	for (entry_t *pe = prefix_entries; pe->type; pe++) {
256
		entry->entry = xstrdup(pe->entry);
257
		entry->type = pe->type;
258
		entry->name = xstrdup(pe->name);
259
260
		xfree(pe->entry);
261
		xfree(pe->name);
262
263
		entry++;
264
		xassert(entry <= entries + count);
265
	}
266
267
	for (entry_t *pe = path_entries; pe->type; pe++) {
268
		entry->entry = xstrdup(pe->entry);
269
		entry->type = pe->type;
270
		entry->name = xstrdup(pe->name);
271
272
		xfree(pe->entry);
273
		xfree(pe->name);
274
275
		entry++;
276
		xassert(entry <= entries + count);
277
	}
278
279
280
	/* last is always NULL */
281
	xassert(!entry->type);
282
	xfree(prefix_entries);
283
	xfree(path_entries);
284
285
	return entries;
286
}
287
232
typedef struct {
288
typedef struct {
233
	const char *str_path;
289
	const char *str_path;
234
	const data_t *found;
290
	const data_t *found;
Lines 363-369 static data_for_each_cmd_t _populate_methods(const char *key, Link Here
363
extern int register_path_tag(const char *str_path)
419
extern int register_path_tag(const char *str_path)
364
{
420
{
365
	path_t *path = NULL;
421
	path_t *path = NULL;
366
	entry_t *entries = _parse_openapi_path(str_path);
422
	entry_t *entries = _parse_openapi_path_with_prefix(api_path_prefix, str_path);
367
	const data_t *spec_entry;
423
	const data_t *spec_entry;
368
	populate_methods_t args = {0};
424
	populate_methods_t args = {0};
369
425
(-)a/src/slurmrestd/openapi.json (-86 / +661 lines)
Lines 12-53 Link Here
12
  },
12
  },
13
  "servers": [
13
  "servers": [
14
    {
14
    {
15
      "url": "/"
15
      "url": "/slurm/v0.0.35"
16
    }
16
    }
17
  ],
17
  ],
18
  "paths": {
18
  "paths": {
19
    "/slurm/v0.0.35/diag/": {
19
    "/diag": {
20
      "get": {
20
      "get": {
21
        "operationId": "diag",
21
        "summary": "get diagnostics",
22
        "summary": "get diagnostics",
22
        "responses": {
23
        "responses": {
23
          "200": {
24
          "200": {
24
            "description": "dictionary of statistics"
25
            "description": "dictionary of statistics",
26
            "content": {
27
               "application/json": {
28
                 "schema": {
29
                   "$ref": "#/components/schemas/diag"
30
                 }
31
               }
32
            }
25
          }
33
          }
26
        }
34
        }
27
      }
35
      }
28
    },
36
    },
29
    "/slurm/v0.0.35/ping/": {
37
    "/ping": {
30
      "get": {
38
      "get": {
39
        "operationId": "ping",
31
        "summary": "ping test",
40
        "summary": "ping test",
32
        "responses": {
41
        "responses": {
33
          "200": {
42
          "200": {
34
            "description": "results of ping test"
43
            "description": "results of ping test",
44
            "content": {
45
               "application/json": {
46
                 "schema": {
47
                   "$ref": "#/components/schemas/pings"
48
                 }
49
               }
50
            }
35
          }
51
          }
36
        }
52
        }
37
      }
53
      }
38
    },
54
    },
39
    "/slurm/v0.0.35/jobs/": {
55
    "/jobs": {
40
      "get": {
56
      "get": {
57
        "operationId": "jobs",
41
        "summary": "get list of jobs",
58
        "summary": "get list of jobs",
42
        "responses": {
59
        "responses": {
43
          "200": {
60
          "200": {
44
            "description": "array of all job information in slurmctld"
61
            "description": "array of all job information in slurmctld",
62
            "content": {
63
               "application/json": {
64
                   "schema": {
65
                      "type": "array",
66
                      "items": {
67
                          "$ref": "#/components/schemas/job_properties"
68
                      }
69
                   }
70
               }
71
            }
45
          }
72
          }
46
        }
73
        }
47
      }
74
      }
48
    },
75
    },
49
    "/slurm/v0.0.35/job/{job_id}": {
76
    "/job/{job_id}": {
50
      "get": {
77
      "get": {
78
        "operationId": "getJob",
51
        "summary": "get job info",
79
        "summary": "get job info",
52
        "parameters": [
80
        "parameters": [
53
          {
81
          {
Lines 65-71 Link Here
65
        ],
93
        ],
66
        "responses": {
94
        "responses": {
67
          "200": {
95
          "200": {
68
            "description": "job information"
96
            "description": "job information",
97
            "content": {
98
              "application/json": {
99
                "schema": {
100
                  "$ref": "#/components/schemas/job_properties"
101
                }
102
              }
103
            }
69
          },
104
          },
70
          "500": {
105
          "500": {
71
            "description": "job not found"
106
            "description": "job not found"
Lines 73-78 Link Here
73
        }
108
        }
74
      },
109
      },
75
      "post": {
110
      "post": {
111
        "operationId": "updateJob",
76
        "summary": "update job",
112
        "summary": "update job",
77
        "parameters": [
113
        "parameters": [
78
          {
114
          {
Lines 114-119 Link Here
114
        }
150
        }
115
      },
151
      },
116
      "delete": {
152
      "delete": {
153
        "operationId": "cancelJob",
117
        "summary": "cancel or signal job",
154
        "summary": "cancel or signal job",
118
        "parameters": [
155
        "parameters": [
119
          {
156
          {
Lines 150-157 Link Here
150
        }
187
        }
151
      }
188
      }
152
    },
189
    },
153
    "/slurm/v0.0.35/job/submit": {
190
    "/job/submit": {
154
      "post": {
191
      "post": {
192
        "operationId": "submitJob",
155
        "summary": "submit new job",
193
        "summary": "submit new job",
156
        "requestBody": {
194
        "requestBody": {
157
          "description": "submit new job",
195
          "description": "submit new job",
Lines 179-190 Link Here
179
        }
217
        }
180
      }
218
      }
181
    },
219
    },
182
    "/slurm/v0.0.35/nodes/": {
220
    "/nodes": {
183
      "get": {
221
      "get": {
222
        "operationId": "nodes",
184
        "summary": "get all node info",
223
        "summary": "get all node info",
185
        "responses": {
224
        "responses": {
186
          "200": {
225
          "200": {
187
            "description": "nodes information"
226
            "description": "nodes information",
227
            "content": {
228
               "application/json": {
229
                 "schema": {
230
                   "$ref": "#/components/schemas/node_info"
231
                 }
232
               }
233
            }
188
          },
234
          },
189
          "500": {
235
          "500": {
190
            "description": "no nodes in cluster"
236
            "description": "no nodes in cluster"
Lines 192-199 Link Here
192
        }
238
        }
193
      }
239
      }
194
    },
240
    },
195
    "/slurm/v0.0.35/node/{node_name}": {
241
    "/node/{node_name}": {
196
      "get": {
242
      "get": {
243
        "operationId": "getNode",
197
        "summary": "get node info",
244
        "summary": "get node info",
198
        "parameters": [
245
        "parameters": [
199
          {
246
          {
Lines 210-216 Link Here
210
        ],
257
        ],
211
        "responses": {
258
        "responses": {
212
          "200": {
259
          "200": {
213
            "description": "node information"
260
            "description": "node information",
261
            "content": {
262
               "application/json": {
263
                 "schema": {
264
                   "$ref": "#/components/schemas/node_info"
265
                 }
266
               }
267
            }
214
          },
268
          },
215
          "500": {
269
          "500": {
216
            "description": "node not found"
270
            "description": "node not found"
Lines 218-229 Link Here
218
        }
272
        }
219
      }
273
      }
220
    },
274
    },
221
    "/slurm/v0.0.35/partitions/": {
275
    "/partitions": {
222
      "get": {
276
      "get": {
277
        "operationId": "partitions",
223
        "summary": "get all partition info",
278
        "summary": "get all partition info",
224
        "responses": {
279
        "responses": {
225
          "200": {
280
          "200": {
226
            "description": "partitions information"
281
            "description": "partitions information",
282
            "content": {
283
               "application/json": {
284
                 "schema": {
285
                   "$ref": "#/components/schemas/partition_info"
286
                 }
287
               }
288
            }
227
          },
289
          },
228
          "500": {
290
          "500": {
229
            "description": "no partitions in cluster"
291
            "description": "no partitions in cluster"
Lines 231-238 Link Here
231
        }
293
        }
232
      }
294
      }
233
    },
295
    },
234
    "/slurm/v0.0.35/partition/{partition_name}": {
296
    "/partition/{partition_name}": {
235
      "get": {
297
      "get": {
298
        "operationId": "getPartition",
236
        "summary": "get partition info",
299
        "summary": "get partition info",
237
        "parameters": [
300
        "parameters": [
238
          {
301
          {
Lines 249-255 Link Here
249
        ],
312
        ],
250
        "responses": {
313
        "responses": {
251
          "200": {
314
          "200": {
252
            "description": "partition information"
315
            "description": "partition information",
316
            "content": {
317
               "application/json": {
318
                 "schema": {
319
                   "$ref": "#/components/schemas/partition_info"
320
                 }
321
               }
322
            }
253
          },
323
          },
254
          "500": {
324
          "500": {
255
            "description": "partition not found"
325
            "description": "partition not found"
Lines 300-337 Link Here
300
  },
370
  },
301
  "components": {
371
  "components": {
302
    "schemas": {
372
    "schemas": {
303
	  "signal": {
373
      "signal": {
304
		"oneOf": [
374
         "type": "string",
305
		  {
375
         "description": "POSIX signal name",
306
			"type": "integer",
376
         "format": "int32",
307
			"description": "POSIX signal number",
377
         "enum": [
308
			"format": "int32"
378
           "HUP",
309
		  },
379
           "INT",
310
		  {
380
           "QUIT",
311
			"type": "string",
381
           "ABRT",
312
			"description": "POSIX signal name",
382
           "KILL",
313
			"format": "int32",
383
           "ALRM",
314
			"enum": [
384
           "TERM",
315
			  "HUP",
385
           "USR1",
316
			  "INT",
386
           "USR2",
317
			  "QUIT",
387
           "URG",
318
			  "ABRT",
388
           "CONT",
319
			  "KILL",
389
           "STOP",
320
			  "ALRM",
390
           "TSTP",
321
			  "TERM",
391
           "TTIN",
322
			  "USR1",
392
           "TTOU"
323
			  "USR2",
393
         ]
324
			  "URG",
394
      },
325
			  "CONT",
326
			  "STOP",
327
			  "TSTP",
328
			  "TTIN",
329
			  "TTOU"
330
			]
331
		  }
332
		]
333
	  },
334
      "job_properties": {
395
      "job_properties": {
396
        "type": "object",
335
        "properties": {
397
        "properties": {
336
          "account": {
398
          "account": {
337
            "type": "string",
399
            "type": "string",
Lines 409-415 Link Here
409
            "description": "Instruct Slurm to connect the batch script's standard output directly to the file name."
471
            "description": "Instruct Slurm to connect the batch script's standard output directly to the file name."
410
          },
472
          },
411
          "deadline": {
473
          "deadline": {
412
            "type": "string",
474
            "type": "integer",
413
            "description": "Remove the job if no ending is possible before this deadline (start > (deadline - time[-min]))."
475
            "description": "Remove the job if no ending is possible before this deadline (start > (deadline - time[-min]))."
414
          },
476
          },
415
          "delay_boot": {
477
          "delay_boot": {
Lines 429-449 Link Here
429
            "description": "Dictionary of environment entries."
491
            "description": "Dictionary of environment entries."
430
          },
492
          },
431
          "exclusive": {
493
          "exclusive": {
432
            "oneOf": [
494
            "type": "string",
433
              {
495
            "description": "Request exclusive use of nodes."
434
                "type": "string",
435
                "description": "The job allocation can share nodes just other users with the \"user\" option or with the \"mcs\" option).",
436
                "enum": [
437
                  "user",
438
                  "mcs"
439
                ]
440
              },
441
              {
442
                "type": "boolean",
443
                "description": "Request exclusive use of nodes.",
444
                "default": true
445
              }
446
            ]
447
          },
496
          },
448
          "get_user_environment": {
497
          "get_user_environment": {
449
            "type": "boolean",
498
            "type": "boolean",
Lines 546-566 Link Here
546
            "description": "Do not automatically terminate a job if one of the nodes it has been allocated fails."
595
            "description": "Do not automatically terminate a job if one of the nodes it has been allocated fails."
547
          },
596
          },
548
          "nodes": {
597
          "nodes": {
549
            "oneOf": [
598
            "type": "integer",
550
              {
599
            "description": "Request that a minimum of minnodes nodes and a maximum node count."
551
                "type": "integer",
552
                "description": "Request that a minimum of minnodes nodes be allocated to this job."
553
              },
554
              {
555
                "maxItems": 2,
556
                "minItems": 2,
557
                "type": "array",
558
                "description": "Request that a minimum of minnodes nodes and a maximum node count.",
559
                "items": {
560
                  "type": "integer"
561
                }
562
              }
563
            ]
564
          },
600
          },
565
          "open_mode": {
601
          "open_mode": {
566
            "type": "string",
602
            "type": "string",
Lines 576-582 Link Here
576
            "description": "Request a specific partition for the resource allocation."
612
            "description": "Request a specific partition for the resource allocation."
577
          },
613
          },
578
          "priority": {
614
          "priority": {
579
            "type": "string",
615
            "type": "integer",
580
            "description": "Request a specific job priority."
616
            "description": "Request a specific job priority."
581
          },
617
          },
582
          "qos": {
618
          "qos": {
Lines 591-601 Link Here
591
            "type": "string",
627
            "type": "string",
592
            "description": "Allocate resources for the job from the named reservation."
628
            "description": "Allocate resources for the job from the named reservation."
593
          },
629
          },
594
		  "signal" : {
630
          "signal": {
595
			"pattern" : "[B:]<sig_num>[@<sig_time>]",
631
            "pattern": "[B:]<sig_num>[@<sig_time>]",
596
			"type" : "string",
632
            "type": "string",
597
			"description" : "When a job is within sig_time seconds of its end time, send it the signal sig_num."
633
            "description": "When a job is within sig_time seconds of its end time, send it the signal sig_num."
598
		  },
634
          },
599
          "sockets_per_node": {
635
          "sockets_per_node": {
600
            "type": "integer",
636
            "type": "integer",
601
            "description": "Restrict node selection to nodes with at least the specified number of sockets."
637
            "description": "Restrict node selection to nodes with at least the specified number of sockets."
Lines 655-661 Link Here
655
          "wckey": {
691
          "wckey": {
656
            "type": "string",
692
            "type": "string",
657
            "description": "Specify wckey to be used with job."
693
            "description": "Specify wckey to be used with job."
694
          }
695
        }
696
      },
697
      "error": {
698
        "type": "object",
699
        "properties": {
700
          "error": {
701
            "type": "string",
702
            "description": "error message"
703
          },
704
          "errno": {
705
            "type": "integer",
706
            "description": "error number"
707
          }
708
        }
709
      },
710
      "statistics": {
711
        "type": "object",
712
        "properties": {
713
          "parts_packed": {
714
            "type": "integer",
715
            "description": ""
716
          },
717
          "req_time": {
718
            "type": "integer",
719
            "format": "int64",
720
            "description": ""
721
          },
722
          "req_time_start": {
723
            "type": "integer",
724
            "format": "int64",
725
            "description": ""
726
          },
727
          "server_thread_count": {
728
            "type": "integer",
729
            "description": ""
730
          },
731
          "agent_queue_size": {
732
            "type": "integer",
733
            "description": ""
734
          },
735
          "agent_count": {
736
            "type": "integer",
737
            "description": ""
738
          },
739
          "dbd_agent_queue_size": {
740
            "type": "integer",
741
            "description": ""
742
          },
743
          "gettimeofday_latency": {
744
            "type": "integer",
745
            "description": ""
746
          },
747
          "schedule_cycle_max": {
748
            "type": "integer",
749
            "description": ""
750
          },
751
          "schedule_cycle_last": {
752
            "type": "integer",
753
            "description": ""
754
          },
755
          "schedule_cycle_sum": {
756
            "type": "integer",
757
            "description": ""
758
          },
759
          "schedule_cycle_counter": {
760
            "type": "integer",
761
            "description": ""
762
          },
763
          "schedule_cycle_depth": {
764
            "type": "integer",
765
            "description": ""
766
          },
767
          "schedule_queue_len": {
768
            "type": "integer",
769
            "description": ""
770
          },
771
          "jobs_submitted": {
772
            "type": "integer",
773
            "description": ""
774
          },
775
          "jobs_started": {
776
            "type": "integer",
777
            "description": ""
778
          },
779
          "jobs_completed": {
780
            "type": "integer",
781
            "description": ""
782
          },
783
          "jobs_canceled": {
784
            "type": "integer",
785
            "description": ""
786
          },
787
          "jobs_failed": {
788
            "type": "integer",
789
            "description": ""
790
          },
791
          "jobs_pending": {
792
            "type": "integer",
793
            "description": ""
794
          },
795
          "jobs_running": {
796
            "type": "integer",
797
            "description": ""
658
          },
798
          },
799
          "job_states_ts": {
800
            "type": "integer",
801
            "description": ""
802
          },
803
          "bf_backfilled_jobs": {
804
            "type": "integer",
805
            "description": ""
806
          },
807
          "bf_last_backfilled_jobs": {
808
            "type": "integer",
809
            "description": ""
810
          },
811
          "bf_backfilled_het_jobs": {
812
            "type": "integer",
813
            "description": ""
814
          },
815
          "bf_cycle_counter": {
816
            "type": "integer",
817
            "description": ""
818
          },
819
          "bf_cycle_sum": {
820
            "type": "integer",
821
            "description": ""
822
          },
823
          "bf_cycle_last": {
824
            "type": "integer",
825
            "description": ""
826
          },
827
          "bf_cycle_max": {
828
            "type": "integer",
829
            "description": ""
830
          },
831
          "bf_last_depth": {
832
            "type": "integer",
833
            "description": ""
834
          },
835
          "bf_last_depth_try": {
836
            "type": "integer",
837
            "description": ""
838
          },
839
          "bf_depth_sum": {
840
            "type": "integer",
841
            "description": ""
842
          },
843
          "bf_depth_try_sum": {
844
            "type": "integer",
845
            "description": ""
846
          },
847
          "bf_queue_len": {
848
            "type": "integer",
849
            "description": ""
850
          },
851
          "bf_queue_len_sum": {
852
            "type": "integer",
853
            "description": ""
854
          },
855
          "bf_when_last_cycle": {
856
            "type": "integer",
857
            "description": ""
858
          },
859
          "bf_active": {
860
            "type": "integer",
861
            "description": ""
862
          }
863
        }
864
      },
865
      "diag": {
866
        "type": "object",
867
        "properties": {
868
          "errors": {
869
            "type": "array",
870
            "description": "slurm errors",
871
            "items": {
872
              "$ref": "#/components/schemas/error"
873
            }
874
          },
875
          "statistics": {
876
            "type": "object",
877
            "description": "slurm schedular statistics",
878
            "$ref": "#/components/schemas/statistics"
879
          }
880
        }
881
      },
882
      "ping": {
883
        "type": "object",
884
        "properties": {
885
          "hostname": {
886
            "type": "string",
887
            "description": "slurm controller hostname"
888
          },
889
          "ping": {
890
            "type": "string",
891
            "description": "slurm controller host up",
892
            "enum": [
893
              "UP",
894
              "DOWN"
895
            ]
896
          },
897
          "mode": {
898
            "type": "string",
899
            "description": "slurm controller mode"
900
          },
901
          "status": {
902
            "type": "integer",
903
            "description": "slurm controller status"
904
          }
905
        }
906
      },
907
      "pings": {
908
        "type": "object",
909
        "properties": {
910
          "errors": {
911
            "type": "array",
912
            "description": "slurm errors",
913
            "items": {
914
              "$ref": "#/components/schemas/error"
915
            }
916
          },
917
          "pings": {
918
            "type": "array",
919
            "description": "slurm controller pings",
920
            "items": {
921
              "$ref": "#/components/schemas/ping"
922
            }
923
          }
924
        }
925
      },
926
      "node": {
927
        "type": "object",
928
        "properties": {
929
          "architecture": {
930
            "type": "string",
931
            "description": ""
932
          },
933
          "burstbuffer_network_address": {
934
            "type": "string",
935
            "description": ""
936
          },
937
          "boards": {
938
            "type": "integer",
939
            "description": ""
940
          },
941
          "boot_time": {
942
            "type": "integer",
943
            "format": "int64",
944
            "description": ""
945
          },
946
          "cores": {
947
            "type": "integer",
948
            "description": ""
949
          },
950
          "cpu_binding": {
951
            "type": "integer",
952
            "description": ""
953
          },
954
          "cpu_load": {
955
            "type": "integer",
956
            "format": "int64",
957
            "description": ""
958
          },
959
          "free_memory": {
960
            "type": "integer",
961
            "description": ""
962
          },
963
          "cpus": {
964
            "type": "integer",
965
            "description": ""
966
          },
967
          "features": {
968
            "type": "string",
969
            "description": ""
970
          },
971
          "active_features": {
972
            "type": "string",
973
            "description": ""
974
          },
975
          "gres": {
976
            "type": "string",
977
            "description": ""
978
          },
979
          "gres_drained": {
980
            "type": "string",
981
            "description": ""
982
          },
983
          "gres_used": {
984
            "type": "string",
985
            "description": ""
986
          },
987
          "mcs_label": {
988
            "type": "string",
989
            "description": ""
990
          },
991
          "name": {
992
            "type": "string",
993
            "description": ""
994
          },
995
          "next_state_after_reboot": {
996
            "type": "string",
997
            "description": ""
998
          },
999
          "address": {
1000
            "type": "string",
1001
            "description": ""
1002
          },
1003
          "hostname": {
1004
            "type": "string",
1005
            "description": ""
1006
          },
1007
          "state": {
1008
            "type": "string",
1009
            "description": ""
1010
          },
1011
          "operating_system": {
1012
            "type": "string",
1013
            "description": ""
1014
          },
1015
          "owner": {
1016
            "type": "string",
1017
            "description": ""
1018
          },
1019
          "port": {
1020
            "type": "integer",
1021
            "description": ""
1022
          },
1023
          "real_memory": {
1024
            "type": "integer",
1025
            "description": ""
1026
          },
1027
          "reason": {
1028
            "type": "string",
1029
            "description": ""
1030
          },
1031
          "reason_changed_at": {
1032
            "type": "integer",
1033
            "description": ""
1034
          },
1035
          "reason_set_by_user": {
1036
            "type": "string",
1037
            "description": ""
1038
          },
1039
          "slurmd_start_time": {
1040
            "type": "integer",
1041
            "format": "int64",
1042
            "description": ""
1043
          },
1044
          "sockets": {
1045
            "type": "integer",
1046
            "description": ""
1047
          },
1048
          "threads": {
1049
            "type": "integer",
1050
            "description": ""
1051
          },
1052
          "temporary_disk": {
1053
            "type": "integer",
1054
            "description": ""
1055
          },
1056
          "weight": {
1057
            "type": "integer",
1058
            "description": ""
1059
          },
1060
          "tres": {
1061
            "type": "",
1062
            "description": ""
1063
          },
1064
          "slurmd_version": {
1065
            "type": "string",
1066
            "description": ""
1067
          }
1068
        }
1069
      },
1070
      "node_info": {
1071
        "type": "object",
1072
        "properties": {
1073
          "errors": {
1074
            "type": "array",
1075
            "description": "slurm errors",
1076
            "items": {
1077
              "$ref": "#/components/schemas/error"
1078
            }
1079
          },
1080
          "nodes": {
1081
            "type": "array",
1082
            "description": "nodes info",
1083
            "items": {
1084
              "$ref": "#/components/schemas/node"
1085
            }
1086
          }
1087
        }
1088
      },
1089
      "partition": {
1090
        "type": "object",
1091
        "properties": {
1092
          "flags": {
1093
            "type": "array",
1094
            "description": "",
1095
            "items": {
1096
              "type": "string"
1097
            }
1098
          },
1099
          "preemption_mode": {
1100
            "type": "array",
1101
            "description": "",
1102
            "items": {
1103
              "type": "string"
1104
            }
1105
          },
1106
          "allowed_allocation_nodes": {
1107
            "type": "string",
1108
            "description": ""
1109
          },
1110
          "allowed_accounts": {
1111
            "type": "string",
1112
            "description": ""
1113
          },
1114
          "allowed_groups": {
1115
            "type": "string",
1116
            "description": ""
1117
          },
1118
          "allowed_qos": {
1119
            "type": "string",
1120
            "description": ""
1121
          },
1122
          "alternative": {
1123
            "type": "string",
1124
            "description": ""
1125
          },
1126
          "billing_weights": {
1127
            "type": "string",
1128
            "description": ""
1129
          },
1130
          "default_memory_per_cpu": {
1131
            "type": "integer",
1132
            "format": "int64",
1133
            "description": ""
1134
          },
1135
          "default_time_limit": {
1136
            "type": "integer",
1137
            "format": "int64",
1138
            "description": ""
1139
          },
1140
          "denied_accounts": {
1141
            "type": "string",
1142
            "description": ""
1143
          },
1144
          "denied_qos": {
1145
            "type": "string",
1146
            "description": ""
1147
          },
1148
          "preemption_grace_time": {
1149
            "type": "integer",
1150
            "format": "int64",
1151
            "description": ""
1152
          },
1153
          "maximum_cpus_per_node": {
1154
            "type": "integer",
1155
            "description": ""
1156
          },
1157
          "maximum_memory_per_node": {
1158
            "type": "integer",
1159
            "format": "int64",
1160
            "description": ""
1161
          },
1162
          "maximum_nodes_per_job": {
1163
            "type": "integer",
1164
            "description": ""
1165
          },
1166
          "max_time_limit": {
1167
            "type": "integer",
1168
            "format": "int64",
1169
            "description": ""
1170
          },
1171
          "min_nodes_per_job": {
1172
            "type": "integer",
1173
            "description": ""
1174
          },
1175
          "name": {
1176
            "type": "string",
1177
            "description": ""
1178
          },
1179
          "nodes": {
1180
            "type": "string",
1181
            "description": ""
1182
          },
1183
          "over_time_limit": {
1184
            "type": "integer",
1185
            "description": ""
1186
          },
1187
          "priority_job_factor": {
1188
            "type": "integer",
1189
            "description": ""
1190
          },
1191
          "priority_tier": {
1192
            "type": "integer",
1193
            "description": ""
1194
          },
1195
          "qos": {
1196
            "type": "string",
1197
            "description": ""
1198
          },
1199
          "nodes_online": {
1200
            "type": "integer",
1201
            "description": ""
1202
          },
1203
          "total_cpus": {
1204
            "type": "integer",
1205
            "description": ""
1206
          },
1207
          "total_nodes": {
1208
            "type": "integer",
1209
            "description": ""
1210
          },
1211
          "tres": {
1212
            "type": "string",
1213
            "description": ""
1214
          }
1215
        }
1216
      },
1217
      "partition_info": {
1218
        "type": "object",
1219
        "properties": {
1220
          "errors": {
1221
            "type": "array",
1222
            "description": "slurm errors",
1223
            "items": {
1224
              "$ref": "#/components/schemas/error"
1225
            }
1226
          },
1227
          "partitions": {
1228
            "type": "array",
1229
            "description": "partition info",
1230
            "items": {
1231
              "$ref": "#/components/schemas/partition"
1232
            }
1233
          }
659
        }
1234
        }
660
      }
1235
      }
661
    }
1236
    }
(-)a/src/slurmrestd/ops/diag.c (-12 / +14 lines)
Lines 176-183 static int _op_handler_ping(const char *context_id, Link Here
176
			    __func__);
176
			    __func__);
177
177
178
	if (slurm_ctl_conf_ptr) {
178
	if (slurm_ctl_conf_ptr) {
179
		data_t *pings = data_key_set(resp_ptr, "ping");
179
		data_t *pings = data_key_set(resp_ptr, "pings");
180
		data_set_dict(pings);
180
		data_set_list(pings);
181
181
182
		xassert(slurm_ctl_conf_ptr->control_cnt);
182
		xassert(slurm_ctl_conf_ptr->control_cnt);
183
		for (size_t i = 0; i < slurm_ctl_conf_ptr->control_cnt; i++) {
183
		for (size_t i = 0; i < slurm_ctl_conf_ptr->control_cnt; i++) {
Lines 187-205 static int _op_handler_ping(const char *context_id, Link Here
187
			if (i == 0)
187
			if (i == 0)
188
				snprintf(mode, sizeof(mode), "primary");
188
				snprintf(mode, sizeof(mode), "primary");
189
			else if ((i == 1) &&
189
			else if ((i == 1) &&
190
				 (slurm_ctl_conf_ptr->control_cnt == 2))
190
					(slurm_ctl_conf_ptr->control_cnt == 2))
191
				snprintf(mode, sizeof(mode), "backup");
191
				snprintf(mode, sizeof(mode), "backup");
192
			else
192
			else
193
				snprintf(mode, sizeof(mode), "backup%zu", i);
193
				snprintf(mode, sizeof(mode), "backup%zu", i);
194
194
195
			data_t *ping = data_key_set(
195
			data_t *ping = data_set_dict(data_list_append(pings));
196
				pings, slurm_ctl_conf_ptr->control_machine[i]);
196
197
			data_set_dict(ping);
197
			data_set_string(data_key_set(ping, "hostname"),
198
			data_set_string(data_key_set(pings, "ping"),
198
					slurm_ctl_conf_ptr->control_machine[i]);
199
200
			data_set_string(data_key_set(ping, "ping"),
199
					status == SLURM_SUCCESS ? "UP" :
201
					status == SLURM_SUCCESS ? "UP" :
200
								  "DOWN");
202
					"DOWN");
201
			data_set_int(data_key_set(pings, "status"), status);
203
			data_set_int(data_key_set(ping, "status"), status);
202
			data_set_string(data_key_set(pings, "mode"), mode);
204
			data_set_string(data_key_set(ping, "mode"), mode);
203
		}
205
		}
204
	} else {
206
	} else {
205
		_ping_error("%s: slurmctl config is missing", __func__);
207
		_ping_error("%s: slurmctl config is missing", __func__);
Lines 214-224 extern int init_op_diag(void) Link Here
214
{
216
{
215
	int rc;
217
	int rc;
216
218
217
	if ((rc = bind_operation_handler("/slurm/v0.0.35/diag/",
219
	if ((rc = bind_operation_handler("/diag",
218
					     _op_handler_diag, URL_TAG_DIAG)))
220
					     _op_handler_diag, URL_TAG_DIAG)))
219
		/* no-op */;
221
		/* no-op */;
220
	else
222
	else
221
		rc = bind_operation_handler("/slurm/v0.0.35/ping/",
223
		rc = bind_operation_handler("/ping",
222
						_op_handler_ping, URL_TAG_DIAG);
224
						_op_handler_ping, URL_TAG_DIAG);
223
	return rc;
225
	return rc;
224
}
226
}
(-)a/src/slurmrestd/ops/jobs.c (-3 / +3 lines)
Lines 1551-1565 extern int init_op_jobs(void) Link Here
1551
		}
1551
		}
1552
	}
1552
	}
1553
1553
1554
	if ((rc = bind_operation_handler("/slurm/v0.0.35/jobs/",
1554
	if ((rc = bind_operation_handler("/jobs",
1555
					     _op_handler_jobs, URL_TAG_JOBS)))
1555
					     _op_handler_jobs, URL_TAG_JOBS)))
1556
		/* no-op */;
1556
		/* no-op */;
1557
	else if ((rc = bind_operation_handler("/slurm/v0.0.35/job/{job_id}",
1557
	else if ((rc = bind_operation_handler("/job/{job_id}",
1558
						  _op_handler_job,
1558
						  _op_handler_job,
1559
						  URL_TAG_JOB)))
1559
						  URL_TAG_JOB)))
1560
		/* no-op */;
1560
		/* no-op */;
1561
	else
1561
	else
1562
		rc = bind_operation_handler("/slurm/v0.0.35/job/submit",
1562
		rc = bind_operation_handler("/job/submit",
1563
						_op_handler_submit_job,
1563
						_op_handler_submit_job,
1564
						URL_TAG_JOB_SUBMIT);
1564
						URL_TAG_JOB_SUBMIT);
1565
1565
(-)a/src/slurmrestd/ops/nodes.c (-4 / +4 lines)
Lines 91-97 static int _dump_node(data_t *p, node_info_t *node) Link Here
91
		return SLURM_SUCCESS;
91
		return SLURM_SUCCESS;
92
	}
92
	}
93
93
94
	d = data_set_dict(data_key_set(p, node->name));
94
	d = data_set_dict(data_list_append(p));
95
95
96
	data_set_string(data_key_set(d, "architecture"), node->arch);
96
	data_set_string(data_key_set(d, "architecture"), node->arch);
97
	data_set_string(data_key_set(d, "burstbuffer_network_address"),
97
	data_set_string(data_key_set(d, "burstbuffer_network_address"),
Lines 155-161 static int _op_handler_nodes(const char *context_id, Link Here
155
	int rc = SLURM_SUCCESS;
155
	int rc = SLURM_SUCCESS;
156
	data_t *d = data_set_dict(resp);
156
	data_t *d = data_set_dict(resp);
157
	data_t *errors = data_set_list(data_key_set(d, "errors"));
157
	data_t *errors = data_set_list(data_key_set(d, "errors"));
158
	data_t *nodes = data_set_dict(data_key_set(d, "nodes"));
158
	data_t *nodes = data_set_list(data_key_set(d, "nodes"));
159
	node_info_msg_t *node_info_ptr = NULL;
159
	node_info_msg_t *node_info_ptr = NULL;
160
160
161
	if (tag == URL_TAG_NODES)
161
	if (tag == URL_TAG_NODES)
Lines 198-209 extern int init_op_nodes(void) Link Here
198
{
198
{
199
	int rc;
199
	int rc;
200
200
201
	if ((rc = bind_operation_handler("/slurm/v0.0.35/nodes/",
201
	if ((rc = bind_operation_handler("/nodes",
202
					     _op_handler_nodes, URL_TAG_NODES)))
202
					     _op_handler_nodes, URL_TAG_NODES)))
203
		/* no-op */;
203
		/* no-op */;
204
	else
204
	else
205
		rc = bind_operation_handler(
205
		rc = bind_operation_handler(
206
			"/slurm/v0.0.35/node/{node_name}", _op_handler_nodes,
206
			"/node/{node_name}", _op_handler_nodes,
207
			URL_TAG_NODE);
207
			URL_TAG_NODE);
208
	return rc;
208
	return rc;
209
}
209
}
(-)a/src/slurmrestd/ops/partitions.c (-13 / +9 lines)
Lines 61-67 typedef enum { Link Here
61
61
62
static int _dump_part(data_t *p, partition_info_t *part)
62
static int _dump_part(data_t *p, partition_info_t *part)
63
{
63
{
64
	data_t *d = data_set_dict(data_key_set(p, part->name));
64
	data_t *d = data_set_dict(data_list_append(p));
65
	data_t *flags = data_set_list(data_key_set(d, "flags"));
65
	data_t *flags = data_set_list(data_key_set(d, "flags"));
66
	data_t *pm = data_set_list(data_key_set(d, "preemption_mode"));
66
	data_t *pm = data_set_list(data_key_set(d, "preemption_mode"));
67
67
Lines 78-85 static int _dump_part(data_t *p, partition_info_t *part) Link Here
78
	data_set_int(data_key_set(d, "default_memory_per_cpu"),
78
	data_set_int(data_key_set(d, "default_memory_per_cpu"),
79
		     part->def_mem_per_cpu);
79
		     part->def_mem_per_cpu);
80
	if (part->default_time == INFINITE)
80
	if (part->default_time == INFINITE)
81
		data_set_string(data_key_set(d, "default_time_limit"),
81
		data_set_int(data_key_set(d, "default_time_limit"), -1);
82
				"INFINITE");
83
	if (part->default_time == NO_VAL)
82
	if (part->default_time == NO_VAL)
84
		data_set_null(data_key_set(d, "default_time_limit"));
83
		data_set_null(data_key_set(d, "default_time_limit"));
85
	else
84
	else
Lines 110-117 static int _dump_part(data_t *p, partition_info_t *part) Link Here
110
		     part->grace_time);
109
		     part->grace_time);
111
110
112
	if (part->max_cpus_per_node == INFINITE)
111
	if (part->max_cpus_per_node == INFINITE)
113
		data_set_string(data_key_set(d, "maximum_cpus_per_node"),
112
		data_set_int(data_key_set(d, "maximum_cpus_per_node"), -1);
114
				"INFINITE");
115
	else if (part->max_cpus_per_node == NO_VAL)
113
	else if (part->max_cpus_per_node == NO_VAL)
116
		data_set_null(data_key_set(d, "maximum_cpus_per_node"));
114
		data_set_null(data_key_set(d, "maximum_cpus_per_node"));
117
	else
115
	else
Lines 122-138 static int _dump_part(data_t *p, partition_info_t *part) Link Here
122
		     part->max_mem_per_cpu);
120
		     part->max_mem_per_cpu);
123
121
124
	if (part->max_nodes == INFINITE)
122
	if (part->max_nodes == INFINITE)
125
		data_set_string(data_key_set(d, "maximum_nodes_per_job"),
123
		data_set_int(data_key_set(d, "maximum_nodes_per_job"), -1);
126
				"INFINITE");
127
	else
124
	else
128
		data_set_int(data_key_set(d, "maximum_nodes_per_job"),
125
		data_set_int(data_key_set(d, "maximum_nodes_per_job"),
129
			     part->max_nodes);
126
			     part->max_nodes);
130
127
131
	if (part->max_time == INFINITE)
128
	if (part->max_time == INFINITE)
132
		data_set_string(data_key_set(d, "max_time_limit"), "INFINITE");
129
		data_set_int(data_key_set(d, "max_time_limit"), -1);
133
	else
130
	else
134
		data_set_int(data_key_set(d, "max_time_limit"), part->max_time);
131
		data_set_int(data_key_set(d, "max_time_limit"), part->max_time);
135
	data_set_int(data_key_set(d, "min nodes per job"), part->min_nodes);
132
	data_set_int(data_key_set(d, "min_nodes_per_job"), part->min_nodes);
136
	data_set_string(data_key_set(d, "name"), part->name);
133
	data_set_string(data_key_set(d, "name"), part->name);
137
	// TODO: int32_t *node_inx;	/* list index pairs into node_table:
134
	// TODO: int32_t *node_inx;	/* list index pairs into node_table:
138
	// 			 * start_range_1, end_range_1,
135
	// 			 * start_range_1, end_range_1,
Lines 173-179 static int _op_handler_partitions(const char *context_id, Link Here
173
	int rc = SLURM_SUCCESS;
170
	int rc = SLURM_SUCCESS;
174
	data_t *d = data_set_dict(resp);
171
	data_t *d = data_set_dict(resp);
175
	data_t *errors = data_set_list(data_key_set(d, "errors"));
172
	data_t *errors = data_set_list(data_key_set(d, "errors"));
176
	data_t *partitions = data_set_dict(data_key_set(d, "partitions"));
173
	data_t *partitions = data_set_list(data_key_set(d, "partitions"));
177
	char *name = NULL;
174
	char *name = NULL;
178
	partition_info_msg_t *part_info_ptr = NULL;
175
	partition_info_msg_t *part_info_ptr = NULL;
179
176
Lines 223-235 extern int init_op_partitions(void) Link Here
223
{
220
{
224
	int rc;
221
	int rc;
225
222
226
	if ((rc = bind_operation_handler("/slurm/v0.0.35/partitions/",
223
	if ((rc = bind_operation_handler("/partitions",
227
					 _op_handler_partitions,
224
					 _op_handler_partitions,
228
					 URL_TAG_PARTITIONS)))
225
					 URL_TAG_PARTITIONS)))
229
		/* no-op */;
226
		/* no-op */;
230
	else
227
	else
231
		rc = bind_operation_handler(
228
		rc = bind_operation_handler(
232
			"/slurm/v0.0.35/partition/{partition_name}",
229
			"/partition/{partition_name}",
233
			_op_handler_partitions, URL_TAG_PARTITION);
230
			_op_handler_partitions, URL_TAG_PARTITION);
234
	return rc;
231
	return rc;
235
}
232
}
236
- 

Return to ticket 9131