1Slurm(3) User Contributed Perl Documentation Slurm(3)
2
3
4
6 Slurm - Perl API for libslurm
7
9 use Slurm;
10
11 my $slurm = Slurm::new();
12 $nodes = $slurm->load_node();
13 unless($nodes) {
14 die "failed to load node info: " . $slurm->strerror();
15 }
16
18 The Slurm class provides Perl interface of the SLURM API functions in
19 "<slurm/slurm.h>", with some extra frequently used functions exported
20 by libslurm.
21
22 METHODS
23 To use the API, first create a Slurm object:
24
25 $slurm = Slurm::new($conf);
26
27 Then call the desired functions:
28
29 $resp = $slurm->load_jobs();
30
31 In the following "METHODS" section, if a parameter is omitted, it will
32 be listed as "param=val" , where "val" is the default value of the
33 parameter.
34
35 DATA STRUCTURES
36 Typically, C structures are converted to (maybe blessed) Perl hash
37 references, with field names as hash keys. Arrays in C are converted to
38 arrays in Perl. For example, there is a structure "job_info_msg_t":
39
40 typedef struct job_info_msg {
41 time_t last_update; /* time of latest info */
42 uint32_t record_count; /* number of records */
43 job_info_t *job_array; /* the job records */
44 } job_info_msg_t;
45
46 This will be converted to a hash reference with the following
47 structure:
48
49 {
50 last_update => 1285847672,
51 job_array => [ {account => 'test', alloc_node => 'ln0', alloc_sid => 1234, ...},
52 {account => 'debug', alloc_node => 'ln2', alloc_sid => 5678, ...},
53 ...
54 ]
55 }
56
57 Note the missing of the "record_count" field in the hash. It can be
58 derived from the number of elements in array "job_array".
59
60 To pass parameters to the API functions, use the corresponding hash
61 references, for example:
62
63 $rc = $slurm->update_node({node_names => 'node[0-7]', node_state => NODE_STATE_DRAIN});
64
65 Please see "<slurm/slurm.h>" for the definition of the structures.
66
67 CONSTANTS
68 The enumerations and macro definitions are available in the Slurm
69 package. If ':constant' is given when using the Slurm package, the
70 constants will be exported to the calling package.
71
72 Please see Slurm::Constant for the available constants.
73
75 CONSTRUCTOR/DESTRUCTOR
76 $slurm = Slurm::new($conf_file=undef);
77
78 Create a Slurm object. For now the object is just a hash reference with
79 no members.
80
81 · IN $conf_file: the SLURM configuration file. If omitted, the default
82 SLURM configuration file will be used (file specified by environment
83 variable SLURM_CONF or the file slurm.conf under directroy specified
84 in compile time).
85
86 · RET: blessed opaque Slurm object. On error "undef" is returned.
87
88 ERROR INFORMATION FUNCTIONS
89 $errno = $slurm->get_errno();
90
91 Get the error number associated with last operation.
92
93 · RET: error number associated with last operation.
94
95 $str = $slurm->strerror($errno=0)
96
97 Get the string describing the specified error number.
98
99 · IN $errno: error number. If omitted or 0, the error number returned
100 by "$slurm-"get_errno()> will be used.
101
102 · RET: error string.
103
104 ENTITY STATE/REASON/FLAG/TYPE STRING FUNCTIONS
105 $str = $slurm->preempt_mode_string($mode_num);
106
107 Get the string describing the specified preemt mode number.
108
109 · IN $mode_num: preempt mode number.
110
111 · RET: preempt mode string.
112
113 $num = $slurm->preempt_mode_num($mode_str);
114
115 Get the preempt mode number of the specified preempt mode string.
116
117 · IN $mode_str: preempt mode string.
118
119 · RET: preempt mode number.
120
121 $str = $slurm->job_reason_string($num);
122
123 Get the string representation of the specified job state reason number.
124
125 · IN $num: job reason number.
126
127 · RET: job reason string.
128
129 $str = $slurm->job_state_string($num);
130
131 Get the string representation of the specified job state number.
132
133 · IN $num: job state number.
134
135 · RET: job state string.
136
137 $str = $slurm->job_state_string_compact($num);
138
139 Get the compact string representation of the specified job state
140 number.
141
142 · IN $num: job state number.
143
144 · RET: compact job state string.
145
146 $num = $slurm->job_state_num($str);
147
148 Get the job state number of the specified (compact) job state string.
149
150 · IN $str: job state string.
151
152 · RET: job state number.
153
154 $str = $slurm->reservation_flags_string($flags);
155
156 Get the string representation of the specified reservation flags.
157
158 · IN $num: reservation flags number.
159
160 · RET: reservation flags string.
161
162 $str = $slurm->node_state_string($num);
163
164 Get the string representation of the specified node state number.
165
166 · IN $num: node state number.
167
168 · RET: node state string.
169
170 $str = $slurm->node_state_string_compact($num);
171
172 Get the compact string representation of the specified node state
173 number.
174
175 · IN $num: node state number.
176
177 · RET: compact node state string.
178
179 $str = $slurm->private_data_string($num);
180
181 Get the string representation of the specified private data type.
182
183 · IN $num: private data type number.
184
185 · RET: private data type string.
186
187 $str = $slurm->accounting_enforce_string($num);
188
189 Get the string representation of the specified accounting enforce type.
190
191 · IN $num: accounting enforce type number.
192
193 · RET: accounting enforce type string.
194
195 $str = $slurm->node_use_string($num);
196
197 Get the string representation of the specified node usage type.
198
199 · IN $num: node usage type number.
200
201 · RET: node usage type string.
202
203 RESOURCE ALLOCATION FUNCTIONS
204 $resp = $slurm->allocate_resources($job_desc);
205
206 Allocate resources for a job request. If the requested resources are
207 not immediately available, the slurmctld will send the
208 job_alloc_resp_msg to the sepecified node and port.
209
210 · IN $job_desc: description of resource allocation request, with
211 structure of "job_desc_msg_t".
212
213 · RET: response to request, with structure of
214 "resource_allocation_response_msg_t". This only represents a job
215 allocation if resources are immediately available. Otherwise it just
216 contains the job id of the enqueued job request. On failure "undef"
217 is returned.
218
219 $resp = $slurm->allocate_resources_blocking($job_desc, $timeout=0,
220 $pending_callbacks=undef);
221
222 Allocate resources for a job request. This call will block until the
223 allocation is granted, or the specified timeout limit is reached.
224
225 · IN $job_desc: description of resource allocation request, with
226 structure of "job_desc_msg_t".
227
228 · IN $timeout: amount of time, in seconds, to wait for a response
229 before giving up. A timeout of zero will wait indefinitely.
230
231 · IN $pending_callbacks: If the allocation cannot be granted
232 immediately, the controller will put the job in the PENDING state.
233 If pending callback is given, it will be called with the job id of
234 the pending job as the sole parameter.
235
236 · RET: allcation response, with structure of
237 "resource_allocation_response_msg_t". On failure "undef" is returned,
238 with errno set.
239
240 $resp = $slurm->allocatiion_lookup($job_id);
241
242 Retrieve info for an existing resource allocation.
243
244 · IN $job_id: job allocation identifier.
245
246 · RET: job allocation info, with structure of
247 "resource_allocation_response_msg_t". On failure "undef" is returned
248 with errno set.
249
250 $str = $slurm->read_hostfile($filename, $n);
251
252 Read a specified SLURM hostfile. The file must contain a list of SLURM
253 NodeNames, one per line.
254
255 · IN $filename: name of SLURM hostlist file to be read.
256
257 · IN $n: number of NodeNames required.
258
259 · RET: a string representing the hostlist. Returns NULL if there are
260 fewer than $n hostnames in the file, or if an error occurs.
261
262 $msg_thr = $slurm->allocation_msg_thr_create($port, $callbacks);
263
264 Startup a message handler talking with the controller dealing with
265 messages from the controller during an allocation.
266
267 · OUT $port: port we are listening for messages on from the controller.
268
269 · IN $callbacks: callbacks for different types of messages, with
270 structure of "slurm_allocation_callbacks_t".
271
272 · RET: opaque object of "allocation_msg_thread_t *", or NULL on
273 failure.
274
275 $slurm->allocation_msg_thr_destroy($msg_thr);
276
277 Shutdown the message handler talking with the controller dealing with
278 messages from the controller during an allocation.
279
280 · IN $msg_thr: opaque object of "allocation_msg_thread_t" pointer.
281
282 $resp = $slurm->submit_batch_job($job_desc_msg);
283
284 Issue RPC to submit a job for later execution.
285
286 · IN $job_desc_msg: description of batch job request, with structure of
287 "job_desc_msg_t".
288
289 · RET: 0 on success, otherwise return -1 and set errno to indicate the
290 error.
291
292 $rc = $slurm->job_will_run($job_desc_msg);
293
294 Determine if a job would execute immediately if submitted now.
295
296 · IN $job_desc_msg: description of resource allocation request, with
297 structure of "job_desc_msg_t".
298
299 · RET: 0 on success, otherwise return -1 and set errno to indicate the
300 error.
301
302 $resp = $slurm->sbcast_lookup($job_id);
303
304 Retrieve info for an existing resource allocation including a
305 credential needed for sbcast.
306
307 · IN $jobid: job allocation identifier.
308
309 · RET: job allocation information includeing a credential for sbcast,
310 with structure of "job_sbcast_cred_msg_t". On failure "undef" is
311 returned with errno set.
312
313 JOB/STEP SIGNALING FUNCTIONS
314 $rc = $slurm->kill_job($job_id, $signal, $batch_flag=0);
315
316 Send the specified signal to all steps of an existing job.
317
318 · IN $job_id: the job's id.
319
320 · IN $signal: signal number.
321
322 · IN $batch_flag: 1 to signal batch shell only, otherwise 0.
323
324 · RET: 0 on success, otherwise return -1 and set errno to indicate the
325 error.
326
327 $rc = $slurm->kill_job_step($job_id, $step_id, $signal);
328
329 Send the specified signal to an existing job step.
330
331 · IN $job_id: the job's id.
332
333 · IN $step_id: the job step's id.
334
335 · IN $signal: signal number.
336
337 · RET: 0 on success, otherwise return -1 and set errno to indicate the
338 error.
339
340 $rc = $slurm->signal_job($job_id, $signal);
341
342 Send the specified signal to all steps of an existing job.
343
344 · IN $job_id: the job's id.
345
346 · IN $signal: signal number.
347
348 · RET: 0 on success, otherwise return -1 and set errno to indicate the
349 error.
350
351 $rc = $slurm->signal_job_step($job_id, $step_id, $signal);
352
353 Send the specified signal to an existing job step.
354
355 · IN $job_id: the job's id.
356
357 · IN $step_id: the job step's id.
358
359 · IN $signal: signal number.
360
361 · RET: 0 on success, otherwise return -1 and set errno to indicate the
362 error.
363
364 JOB/STEP COMPLETION FUNCTIONS
365 $rc = $slurm->complete_job($job_id, $job_rc=0);
366
367 Note the completion of a job and all of its steps.
368
369 · IN $job_id: the job's id.
370
371 · IN $job_rc: the highest exit code of any task of the job.
372
373 · RET: 0 on success, otherwise return -1 and set errno to indicate the
374 error.
375
376 $rc = $slurm->terminate_job_step($job_id, $step_id);
377
378 Terminates a job step by sending a REQUEST_TERMINATE_TASKS rpc to all
379 slurmd of a job step, and then calls slurm_complete_job_step() after
380 verifying that all nodes in the job step no longer have running tasks
381 from the job step. (May take over 35 seconds to return.)
382
383 · IN $job_id: the job's id.
384
385 · IN $step_id: the job step's id - use SLURM_BATCH_SCRIPT as the
386 step_id to terminate a job's batch script.
387
388 · RET: 0 on success, otherwise return -1 and set errno to indicate the
389 error.
390
391 SLURM TASK SPAWNING FUNCTIONS
392 $ctx = $slurm->step_ctx_create($params);
393
394 Create a job step and its context.
395
396 · IN $params: job step parameters, with structure of
397 "slurm_step_ctx_params_t".
398
399 · RET: the step context. On failure "undef" is returned with errno set.
400
401 $ctx = $slurm->step_ctx_create_no_alloc($params);
402
403 Create a job step and its context without getting an allocation.
404
405 · IN $params: job step parameters, with structure of
406 "slurm_step_ctx_params_t"..
407
408 · IN $step_id: fake job step id.
409
410 · RET: the step context. On failure "undef" is returned with errno set.
411
412 SLURM CONTROL CONFIGURATION READ/PRINT/UPDATE FUNCTIONS
413 ($major, $minor, $micro) = $slurm->api_version();
414
415 Get the SLURM API's version number.
416
417 · RET: a three element list of the major, minor, and micro version
418 number.
419
420 $resp = $slurm->load_ctl_conf($update_time=0);
421
422 Issue RPC to get SLURM control configuration information if changed.
423
424 · IN $update_time: time of current configuration data.
425
426 · RET: SLURM configuration data, with structure of "slurm_ctl_conf_t".
427 On failure "undef" is returned with errno set.
428
429 $slurm->print_ctl_conf($out, $conf);
430
431 Output the contents of SLURM control configuration message as loaded
432 using "load_ctl_conf()".
433
434 · IN $out: file to write to.
435
436 · IN $conf: SLURM control configuration, with structure of
437 "slurm_ctl_conf_t".
438
439 $list = $slurm->ctl_conf_2_key_pairs($conf);
440
441 Put the SLURM configuration data into a List of opaque data type
442 "config_key_pair_t".
443
444 · IN $conf: SLURM control configuration, with structure of
445 "slurm_ctl_conf_t".
446
447 · RET: List of opaque data type "config_key_pair_t".
448
449 $resp = $slurm->load_slurmd_status();
450
451 Issue RPC to get the status of slurmd daemon on this machine.
452
453 · RET: slurmd status info, with structure of "slurmd_status_t". On
454 failure "undef" is returned with errno set.
455
456 $slurm->print_slurmd_status($out, $slurmd_status);
457
458 Output the contents of slurmd status message as loaded using
459 "load_slurmd_status()".
460
461 · IN $out: file to write to.
462
463 · IN $slurmd_status: slurmd status info, with structure of
464 "slurmd_status_t".
465
466 $slurm->print_key_pairs($out, $key_pairs, $title);
467
468 Output the contents of key_pairs which is a list of opaque data type
469 "config_key_pair_t".
470
471 · IN $out: file to write to.
472
473 · IN $key_pairs: List containing key pairs to be printed.
474
475 · IN $title: title of key pair list.
476
477 $rc = $slurm->update_step($step_msg);
478
479 Update the time limit of a job step.
480
481 · IN $step_msg: step update messasge descriptor, with structure of
482 "step_update_request_msg_t".
483
484 · RET: 0 or -1 on error.
485
486 SLURM JOB RESOURCES READ/PRINT FUNCTIONS
487 $num = $slurm->job_cpus_allocated_on_node_id($job_res, $node_id);
488
489 Get the number of cpus allocated to a job on a node by node id.
490
491 · IN $job_res: job resources data, with structure of "job_resources_t".
492
493 · IN $node_id: zero-origin node id in allocation.
494
495 · RET: number of CPUs allocated to job on this node or -1 on error.
496
497 $num = $slurm->job_cpus_allocated_on_node($job_res, $node_name);
498
499 Get the number of cpus allocated to a job on a node by node name.
500
501 · IN $job_res: job resources data, with structure of "job_resources_t".
502
503 · IN $node_name: name of node.
504
505 · RET: number of CPUs allocated to job on this node or -1 on error.
506
507 SLURM JOB CONFIGURATION READ/PRINT/UPDATE FUNCTIONS
508 $time = $slurm->get_end_time($job_id);
509
510 Get the expected end time for a given slurm job.
511
512 · IN $jobid: SLURM job id.
513
514 · RET: scheduled end time for the job. On failure "undef" is returned
515 with errno set.
516
517 $secs = $slurm->get_rem_time($job_id);
518
519 Get the expected time remaining for a given job.
520
521 · IN $jobid: SLURM job id.
522
523 · RET: remaining time in seconds or -1 on error.
524
525 $rc = $slurm->job_node_ready($job_id);
526
527 Report if nodes are ready for job to execute now.
528
529 · IN $job_id: SLURM job id.
530
531 · RET:
532
533 · READY_JOB_FATAL: fatal error
534
535 · READY_JOB_ERROR: ordinary error
536
537 · READY_NODE_STATE: node is ready
538
539 · READY_JOB_STATE: job is ready to execute
540
541 $resp = $slurm->load_job($job_id, $show_flags=0);
542
543 Issue RPC to get job information for one job ID.
544
545 · IN $job_id: ID of job we want information about.
546
547 · IN $show_flags: job filtering options.
548
549 · RET: job information, with structure of "job_info_msg_t". On failure
550 "undef" is returned with errno set.
551
552 $resp = $slurm->load_jobs($update_time=0, $show_flags=0);
553
554 Issue RPC to get all SLURM job information if changed.
555
556 · IN $update_time: time of current job information data.
557
558 · IN $show_flags: job filtering options.
559
560 · RET: job information, with structure of "job_info_msg_t". On failure
561 "undef" is returned with errno set.
562
563 $rc = $slurm->notify_job($job_id, $message);
564
565 Send message to the job's stdout, usable only by user root.
566
567 · IN $job_id: SLURM job id or 0 for all jobs.
568
569 · IN $message: arbitrary message.
570
571 · RET: 0 or -1 on error.
572
573 $job_id = $slurm->pid2jobid($job_pid);
574
575 Issue RPC to get the SLURM job ID of a given process ID on this
576 machine.
577
578 · IN $job_pid: process ID of interest on this machine.
579
580 · RET: corresponding job ID. On failure "undef" is returned.
581
582 $slurm->print_job_info($out, $job_info, $one_liner=0);
583
584 Output information about a specific SLURM job based upon message as
585 loaded using "load_jobs()".
586
587 · IN $out: file to write to.
588
589 · IN $job_info: an individual job information record, with structure of
590 "job_info_t".
591
592 · IN $one_liner: print as a single line if true.
593
594 $slurm->print_job_info_msg($out, $job_info_msg, $one_liner=0);
595
596 Output information about all SLURM jobs based upon message as loaded
597 using "load_jobs()".
598
599 · IN $out: file to write to.
600
601 · IN $job_info_msg: job information message, with structure of
602 "job_info_msg_t".
603
604 · IN $one_liner: print as a single line if true.
605
606 $str = $slurm->sprint_job_info($job_info, $one_liner=0);
607
608 Output information about a specific SLURM job based upon message as
609 loaded using "load_jobs()".
610
611 · IN $job_info: an individual job information record, with structure of
612 "job_info_t".
613
614 · IN $one_liner: print as a single line if true.
615
616 · RET: string containing formatted output.
617
618 $rc = $slurm->update_job($job_info);
619
620 Issue RPC to a job's configuration per request only usable by user root
621 or (for some parameters) the job's owner.
622
623 · IN $job_info: description of job updates, with structure of
624 "job_desc_msg_t".
625
626 · RET: 0 on success, otherwise return -1 and set errno to indicate the
627 error.
628
629 SLURM JOB STEP CONFIGURATION READ/PRINT/UPDATE FUNCTIONS
630 $resp = $slurm->get_job_steps($update_time=0, $job_id=NO_VAL,
631 $step_id=NO_VAL, $show_flags=0);
632
633 Issue RPC to get specific slurm job step configuration information if
634 changed since update_time.
635
636 · IN $update_time: time of current configuration data.
637
638 · IN $job_id: get information for specific job id, NO_VAL for all jobs.
639
640 · IN $step_id: get information for specific job step id, NO_VAL for all
641 job steps.
642
643 · IN $show_flags: job step filtering options.
644
645 · RET: job step information, with structure of
646 "job_step_info_response_msg_t". On failure "undef" is returned with
647 errno set.
648
649 $slurm->print_job_step_info_msg($out, $step_info_msg, $one_liner);
650
651 Output information about all SLURM job steps based upon message as
652 loaded using "get_job_steps()".
653
654 · IN $out: file to write to.
655
656 · IN $step_info_msg: job step information message, with structure of
657 "job_step_info_response_msg_t".
658
659 · IN $one_liner: print as a single line if true.
660
661 $slurm->print_job_step_info($out, $step_info, $one_liner);
662
663 Output information about a specific SLURM job step based upon message
664 as loaded using "get_job_steps()".
665
666 · IN $out: file to write to.
667
668 · IN $step_info: job step information, with structure of
669 "job_step_info_t".
670
671 · IN $one_liner: print as a single line if true.
672
673 $str = $slurm->sprint_job_step_info($step_info, $one_liner);
674
675 Output information about a specific SLURM job step based upon message
676 as loaded using "get_job_steps()".
677
678 · IN $step_info: job step information, with structure of
679 "job_step_info_t".
680
681 · IN $one_liner: print as a single line if true.
682
683 · RET: string containing formatted output.
684
685 $layout = $slurm->job_step_layout_get($job_id, $step_id);
686
687 Get the layout structure for a particular job step.
688
689 · IN $job_id: SLURM job ID.
690
691 · IN $step_id: SLURM step ID.
692
693 · RET: layout of the job step, with structure of "slurm_step_layout_t".
694 On failure "undef" is returned with errno set.
695
696 $resp = $slurm->job_step_stat($job_id, $step_id, $nodelist=undef);
697
698 Get status of a current step.
699
700 · IN $job_id : SLURM job ID.
701
702 · IN $step_id: SLURM step ID.
703
704 · IN $nodelist: nodes to check status of step. If omitted, all nodes in
705 step are used.
706
707 · RET: response of step status, with structure of
708 "job_step_stat_response_msg_t". On failure "undef" is returned.
709
710 $resp = $slurm->job_step_get_pids($job_id, $step_id, $nodelist);
711
712 Get the complete list of pids for a given job step.
713
714 · IN $job_id: SLURM job ID.
715
716 · IN $step_id: SLURM step ID.
717
718 · IN $nodelist: nodes to check pids of step. If omitted, all nodes in
719 step are used.
720
721 · RET: response of pids information, with structure of
722 "job_step_pids_response_msg_t". On failure "undef" is returned.
723
724 SLURM NODE CONFIGURATION READ/PRINT/UPDATE FUNCTIONS
725 $resp = $slurm->load_node($update_time=0, $show_flags=0);
726
727 Issue RPC to get all node configuration information if changed.
728
729 · IN $update_time: time of current configuration data.
730
731 · IN $show_flags: node filtering options.
732
733 · RET: response hash reference with structure of "node_info_msg_t". On
734 failure "undef" is returned with errno set.
735
736 $slurm->print_node_info_msg($out, $node_info_msg, $one_liner=0);
737
738 Output information about all SLURM nodes based upon message as loaded
739 using "load_node()".
740
741 · IN $out: FILE handle to write to.
742
743 · IN $node_info_msg: node information message to print, with structure
744 of "node_info_msg_t".
745
746 · IN $one_liner: if true, each node info will be printed as a single
747 line.
748
749 $slurm->print_node_table($out, $node_info, $one_liner=0);
750
751 Output information about a specific SLURM node based upon message as
752 loaded using "load_node()".
753
754 · IN $out: FILE handle to write to.
755
756 · IN $node_info: an individual node information record with structure
757 of "node_info_t".
758
759 · IN $one_liner: whether to print as a single line.
760
761 $str = $slurm->sprint_node_table($node_info, $one_liner=0);
762
763 Output information about a specific SLURM node based upon message as
764 loaded using "load_node".
765
766 · IN $node_info: an individual node information record with structure
767 of "node_info_t".
768
769 · IN $one_liner: whether to print as a single line.
770
771 · RET: string containing formatted output on success, "undef" on
772 failure.
773
774 $rc = $slurm->update_node($node_info);
775
776 Issue RPC to modify a node's configuration per request, only usable by
777 user root.
778
779 · IN $node_info: description of node updates, with structure of
780 "update_node_msg_t".
781
782 · RET: 0 on success, -1 on failure with errno set.
783
784 SLURM SWITCH TOPOLOGY CONFIGURATION READ/PRINT FUNCTIONS
785 $resp = $slurm->load_topo();
786
787 Issue RPC to get all switch topology configuration information.
788
789 · RET: response hash reference with structure of
790 "topo_info_response_msg_t". On failure "undef" is returned with errno
791 set.
792
793 $slurm->print_topo_info_msg($out, $topo_info_msg, $one_liner=0);
794
795 Output information about all switch topology configuration information
796 based upon message as loaded using "load_topo()".
797
798 · IN $out: FILE handle to write to.
799
800 · IN $topo_info_msg: swith topology information message, with structure
801 of "topo_info_response_msg_t".
802
803 · IN $one_liner: print as a single line if not zero.
804
805 $slurm->print_topo_record($out, $topo_info, $one_liner);
806
807 Output information about a specific SLURM topology record based upon
808 message as loaded using "load_topo()".
809
810 · IN $out: FILE handle to write to.
811
812 · IN $topo_info: an individual switch information record, with
813 structure of "topo_info_t".
814
815 · IN $one_liner: print as a single line if not zero.
816
817 SLURM SELECT READ/PRINT/UPDATE FUNCTIONS
818 $rc = $slurm->get_select_nodeinfo($nodeinfo, $data_type, $state,
819 $data);
820
821 Get data from a select node credential.
822
823 · IN $nodeinfo: select node credential to get data from.
824
825 · IN $data_type: type of data to get.
826
827 · TODO: enumerate data type and returned value.
828
829 · IN $state: state of node query.
830
831 · OUT $data: the data got.
832
833 SLURM PARTITION CONFIGURATION READ/PRINT/UPDATE FUNCTIONS
834 $resp = $slurm->load_partitions($update_time=0, $show_flags=0);
835
836 Issue RPC to get all SLURM partition configuration information if
837 changed.
838
839 · IN $update_time: time of current configuration data.
840
841 · IN $show_flags: partitions filtering options.
842
843 · RET: response hash reference with structure of
844 "partition_info_msg_t".
845
846 $slurm->print_partition_info_msg($out, $part_info_msg, $one_liner=0);
847
848 Output information about all SLURM partitions based upon message as
849 loaded using "load_partitions()".
850
851 · IN $out: FILE handle to write to.
852
853 · IN $part_info_msg: partitions information message, with structure of
854 "partition_info_msg_t".
855
856 · IN $one_liner: print as a single line if true.
857
858 $slurm->print_partition_info($out, $part_info, $one_liner=0);
859
860 Output information about a specific SLURM partition based upon message
861 as loaded using "load_partitions()".
862
863 · IN $out: FILE handle to write to.
864
865 · IN $part_info: an individual partition information record, with
866 structure of "partition_info_t".
867
868 · IN $one_liner: print as a single ine if true.
869
870 $str = $slurm->sprint_partition_info($part_info, $one_liner=0);
871
872 Output information about a specific SLURM partition based upon message
873 as loaded using "load_reservations()".
874
875 · IN $part_info: an individual partition information record, with
876 structure of "partition_info_t".
877
878 · IN $one_liner: print as a single line if true.
879
880 · RET: string containing formatted output. On failure "undef" is
881 returned.
882
883 $rc = $slurm->create_partition($part_info);
884
885 Create a new partition, only usable by user root.
886
887 · IN $part_info: description of partition configuration with structure
888 of "update_part_msg_t".
889
890 · RET: 0 on success, -1 on failure with errno set.
891
892 $rc = $slurm->update_partition($part_info);
893
894 Issue RPC to update a partition's configuration per request, only
895 usable by user root.
896
897 · IN $part_info: description of partition updates with structure of
898 "update_part_msg_t".
899
900 · RET: 0 on success, -1 on failure with errno set.
901
902 $rc = $slurm->delete_partition($part_info)
903
904 Issue RPC to delete a partition, only usable by user root.
905
906 · IN $part_info: description of partition to delete, with structure of
907 "delete_part_msg_t".
908
909 · RET: 0 on success, -1 on failure with errno set.
910
911 SLURM RESERVATION CONFIGURATION READ/PRINT/UPDATE FUNCTIONS
912 $name = $slurm->create_reservation($resv_info);
913
914 Create a new reservation, only usable by user root.
915
916 · IN $resv_info: description of reservation, with structure of
917 "resv_desc_msg_t".
918
919 · RET: name of reservation created. On failure "undef" is returned with
920 errno set.
921
922 $rc = $slurm->update_reservation($resv_info);
923
924 Modify an existing reservation, only usable by user root.
925
926 · IN $resv_info: description of reservation, with structure of
927 "resv_desc_msg_t".
928
929 · RET: error code.
930
931 $rc = $slurm->delete_reservation($resv_info);
932
933 Issue RPC to delete a reservation, only usable by user root.
934
935 · IN $resv_info: description of reservation to delete, with structure
936 of "reservation_name_msg_t".
937
938 · RET: error code
939
940 $resp = $slurm->load_reservations($update_time=0);
941
942 Issue RPC to get all SLURM reservation configuration information if
943 changed.
944
945 · IN $update_time: time of current configuration data.
946
947 · RET: response of reservation information, with structure of
948 "reserve_info_msg_t". On failure "undef" is returned with errno set.
949
950 $slurm->print_reservation_info_msg($out, $resv_info_msg, $one_liner=0);
951
952 Output information about all SLURM reservations based upon message as
953 loaded using "load_reservation()".
954
955 · IN $out: FILE handle to write to.
956
957 · IN $resv_info_msg: reservation information message, with structure of
958 "reserve_info_msg_t".
959
960 · IN $one_liner: print as a single line if true.
961
962 $slurm->print_reservation_info($out, $resv_info, $one_liner=0);
963
964 Output information about a specific SLURM reservation based upon
965 message as loaded using "load_reservation()".
966
967 · IN $out: FILE handle to write to.
968
969 · IN $resv_info: an individual reservation information record, with
970 structure of "reserve_info_t".
971
972 · IN $one_liner: print as a single line if true.
973
974 $str = $slurm->sprint_reservation_info($resv_info, $one_liner=0);
975
976 Output information about a specific SLURM reservation based upon
977 message as loaded using "load_reservations()".
978
979 · IN $resv_info: an individual reservation information record, with
980 structure of "reserve_info_t".
981
982 · IN $one_liner: print as a single line if true.
983
984 · RET: string containing formatted output. On failure "undef" is
985 returned.
986
987 SLURM PING/RECONFIGURE/SHUTDOWN FUNCTIONS
988 $rc = $slurm->ping($primary);
989
990 Issue RPC to ping Slurm controller (slurmctld).
991
992 · IN primary: 1 for primary controller, 2 for secondary controller.
993
994 · RET: error code.
995
996 $rc = $slurm->reconfigure()
997
998 Issue RPC to have Slurm controller (slurmctld) reload its configuration
999 file.
1000
1001 · RET: error code.
1002
1003 $rc = $slurm->shutdown($options);
1004
1005 Issue RPC to have Slurm controller (slurmctld) cease operations, both
1006 the primary and backup controller are shutdown.
1007
1008 · IN $options:
1009
1010 · 0: all slurm daemons are shutdown.
1011
1012 · 1: slurmctld generates a core file.
1013
1014 · 2: only the slurmctld is shutdown (no core file).
1015
1016 · RET: error code.
1017
1018 $rc = $slurm->takeover();
1019
1020 Issue RPC to have Slurm backup controller take over the primary
1021 controller. REQUEST_CONTROL is sent by the backup to the primary
1022 controller to take control.
1023
1024 · RET: error code.
1025
1026 $rc = $slurm->set_debug_level($debug_level)
1027
1028 Issue RPC to set slurm controller debug level.
1029
1030 · IN $debug_level: requested debug level.
1031
1032 · RET: 0 on success, -1 on error with errno set.
1033
1034 $rc = $slurm->set_schedlog_level($schedlog_level);
1035
1036 Issue RPC to set slurm scheduler log level.
1037
1038 · schedlog_level: requested scheduler log level.
1039
1040 · RET: 0 on success, -1 on error with errno set.
1041
1042 SLURM JOB SUSPEND FUNCTIONS
1043 $rc = $slurm->suspend($job_id);
1044
1045 Suspend execution of a job.
1046
1047 · IN $job_id: job on which top perform operation.
1048
1049 · RET: error code.
1050
1051 $rc = $slurm->resume($job_id);
1052
1053 Resume execution of a previously suspended job.
1054
1055 · IN $job_id: job on which to perform operation.
1056
1057 · RET: error code.
1058
1059 $rc = $slurm->requeue($job_id);
1060
1061 Re-queue a batch job, if already running then terminate it first.
1062
1063 · IN $job_id: job on which to perform operation.
1064
1065 · RET: error code.
1066
1067 SLURM JOB CHECKPOINT FUNCTIONS
1068 $rc = $slurm->checkpoint_able($job_id, $step_id, $start_time);
1069
1070 Determine if the specified job step can presently be checkpointed.
1071
1072 · IN $job_id: job on which to perform operation.
1073
1074 · IN $step_id: job step on which to perform operation.
1075
1076 · OUT $start_time: time at which checkpoint request was issued.
1077
1078 · RET: 0 (can be checkpoined) or a slurm error code.
1079
1080 $rc = $slurm->checkpoint_disable($job_id, $step_id);
1081
1082 Disable checkpoint requests for some job step.
1083
1084 · IN $job_id: job on which to perform operation.
1085
1086 · IN $step_id: job step on which to perform operation.
1087
1088 · RET: error code.
1089
1090 $rc = $slurm->checkpoint_enable($job_id, $step_id);
1091
1092 Enable checkpoint requests for some job step.
1093
1094 · IN $job_id: job on which to perform operation.
1095
1096 · IN $step_id: job step on which to perform operation.
1097
1098 · RET: error code.
1099
1100 $rc = $slurm->checkpoint_create($job_id, $step_id, $max_wait,
1101 $image_dir);
1102
1103 Initiate a checkpoint requests for some job step. The job will continue
1104 execution after the checkpoint operation completes.
1105
1106 · IN $job_id: job on which to perform operation.
1107
1108 · IN $step_id: job step on which to perform operation.
1109
1110 · IN $max_wait: maximum wait for operation to complete, in seconds.
1111
1112 · IN $image_dir: directory to store image files.
1113
1114 · RET: error code.
1115
1116 $rc = $slurm->checkpoint_vacate($job_id, $step_id, $max_wait,
1117 $image_dir);
1118
1119 Initiate a checkpoint requests for some job step. The job will
1120 terminate after the checkpoint operation completes.
1121
1122 · IN $job_id: job on which to perform operation.
1123
1124 · IN $step_id: job step on which to perform operation.
1125
1126 · IN $max_wait: maximum wait for operation to complete, in seconds.
1127
1128 · IN $image_dir: directory to store image files.
1129
1130 · RET: error code.
1131
1132 $rc = $slurm->checkpoint_restart($job_id, $step_id, $stick, $image_dir)
1133
1134 Restart execution of a checkpointed job step.
1135
1136 · IN $job_id: job on which to perform operation.
1137
1138 · IN $step_id: job step on which to perform operation.
1139
1140 · IN $stick: if true, stick to nodes previously running on.
1141
1142 · IN $image_dir: directory to find checkpoint image files.
1143
1144 · RET: error code.
1145
1146 $rc = $slurm->checkpoint_complete($job_id, $step_id, $begin_time,
1147 $error_code, $error_msg);
1148
1149 Note the completion of a job step's checkpoint operation.
1150
1151 · IN $job_id: job on which to perform operation.
1152
1153 · IN $step_id: job step on which to perform operation.
1154
1155 · IN $begin_time: time at which checkpoint began.
1156
1157 · IN $error_code: error code, highest value for all complete calls is
1158 preserved.
1159
1160 · IN $error_msg: error message, preserved for highest error_code.
1161
1162 · RET: error code.
1163
1164 checkpoint_task_complete($job_id, $step_id, $task_id, $begin_time,
1165 $error_code, $error_msg);
1166
1167 Note the completion of a task's checkpoint operation.
1168
1169 · IN $job_id: job on which to perform operation.
1170
1171 · IN $step_id: job step on which to perform operation.
1172
1173 · IN $task_id: task which completed the operation.
1174
1175 · IN $begin_time: time at which checkpoint began.
1176
1177 · IN $error_code: error code, highest value for all complete calls is
1178 preserved.
1179
1180 · IN $error_msg: error message, preserved for highest error_code.
1181
1182 · RET: error code.
1183
1184 $rc = $slurm->checkpoint_error($job_id, $step_id, $error_code,
1185 $error_msg);
1186
1187 Gather error information for the last checkpoint operation for some job
1188 step.
1189
1190 · IN $job_id: job on which to perform operation.
1191
1192 · IN $step_id: job step on which to perform operation.
1193
1194 · OUT $error_code: error number associated with the last checkpoint
1195 operation.
1196
1197 · OUT $error_msg: error message associated with the last checkpoint
1198 operation.
1199
1200 · RET: error code.
1201
1202 $rc = $slurm->checkpoint_tasks($job_id, $step_id, $image_dir,
1203 $max_wait, $nodelist);
1204
1205 Send checkoint request to tasks of specified job step.
1206
1207 · IN $job_id: job on which to perform operation.
1208
1209 · IN $step_id: job step on which to perform operation.
1210
1211 · IN $image_dir: location to store checkpoint image files.
1212
1213 · IN $max_wait: seconds to wait for the operation to complete.
1214
1215 · IN $nodelist: nodes to send the request.
1216
1217 · RET: 0 on success, non-zero on failure with errno set.
1218
1219 SLURM TRIGGER FUNCTIONS
1220 $rc = $slurm->set_trigger($trigger_info);
1221
1222 Set an event trigger.
1223
1224 · IN $trigger_info: hash reference of specification of trigger to
1225 create, with structure of "trigger_info_t".
1226
1227 · RET: error code.
1228
1229 $rc = $slurm->clear_trigger($trigger_info);
1230
1231 Clear an existing event trigger.
1232
1233 · IN $trigger_info: hash reference of specification of trigger to
1234 remove, with structure of "trigger_info_t".
1235
1236 · RET: error code.
1237
1238 $resp = $slurm->get_triggers();
1239
1240 Get all event trigger information.
1241
1242 · RET: hash reference with structure of "trigger_info_msg_t". On
1243 failure "undef" is returned with errno set.
1244
1245 JOB/NODE STATE TESTING FUNCTIONS
1246 The following are functions to test job/node state, based on the macros
1247 defined in src/common/slurm_protocol_defs.h. The functions take a
1248 parameter of a hash reference of a job/node, and return a boolean
1249 value. For job, $job->{job_state} is tested. For node,
1250 $node->{node_state} is tested.
1251
1252 $cond = IS_JOB_PENDING($job);
1253
1254 $cond = IS_JOB_RUNNING($job);
1255
1256 $cond = IS_JOB_SUSPENDED($job);
1257
1258 $cond = IS_JOB_COMPLETE($job);
1259
1260 $cond = IS_JOB_CANCELLED($job);
1261
1262 $cond = IS_JOB_FAILED($job);
1263
1264 $cond = IS_JOB_TIMEOUT($job);
1265
1266 $cond = IS_JOB_NODE_FAILED($job);
1267
1268 $cond = IS_JOB_COMPLETING($job);
1269
1270 $cond = IS_JOB_CONFIGURING($job);
1271
1272 $cond = IS_JOB_STARTED($job);
1273
1274 $cond = IS_JOB_FINISHED($job);
1275
1276 $cond = IS_JOB_COMPLETED($job);
1277
1278 $cond = IS_JOB_RESIZING($job);
1279
1280 $cond = IS_NODE_UNKNOWN($node);
1281
1282 $cond = IS_NODE_DOWN($node);
1283
1284 $cond = IS_NODE_IDLE($node);
1285
1286 $cond = IS_NODE_ALLOCATED($node);
1287
1288 $cond = IS_NODE_ERROR($node);
1289
1290 $cond = IS_NODE_MIXED($node);
1291
1292 $cond = IS_NODE_FUTURE($node);
1293
1294 $cond = IS_NODE_DRAIN($node);
1295
1296 $cond = IS_NODE_DRAINING($node);
1297
1298 $cond = IS_NODE_DRAINED($node);
1299
1300 $cond = IS_NODE_COMPLETING($node);
1301
1302 $cond = IS_NODE_NO_RESPOND($node);
1303
1304 $cond = IS_NODE_POWER_SAVE($node);
1305
1306 $cond = IS_NODE_POWER_UP($node);
1307
1308 $cond = IS_NODE_FAIL($node);
1309
1310 $cond = IS_NODE_MAINT($node);
1311
1313 The job/node state testing functions are exported by default.
1314
1315 If ':constant' if specified, all constants are exported.
1316
1318 Slurm::Constant, Slurm::Hostlist, Slurm::Stepctx, Slurm::Bitstr
1319
1320 <slurm/slurm.h> for various hash reference structures.
1321
1322 Home page of SLURM: <http://www.llnl.gov/linux/slurm/>.
1323
1325 This library is created by Hongjia Cao, <hjcao(AT)nudt.edu.cn> and
1326 Danny Auble, <da(AT)llnl.gov>. It is distributed with SLURM.
1327
1329 This library is free software; you can redistribute it and/or modify it
1330 under the same terms as Perl itself, either Perl version 5.8.4 or, at
1331 your option, any later version of Perl 5 you may have available.
1332
1333
1334
1335perl v5.28.2 2019-04-12 Slurm(3)