This file is indexed.

/usr/lib/perl5/Slurm.pm is in libslurm-perl 2.3.2-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
package Slurm;

use 5.008;
use strict;
use warnings;
use Carp;

use Slurm::Hostlist;
use Slurm::Bitstr;
use Slurm::Stepctx;
use Slurm::Constant;

sub import {
    # export constants
    Slurm::Constant->import2() if grep(/^:constant$/, @_) || grep(/^:all$/, @_);
    
    # export job/node state testing macros
    my $callpkg = caller(0);
    {
	no strict "refs";
	my ($macro, $sub);
	while( ($macro, $sub) = each(%{Slurm::}) ) {
	    next unless $macro =~ /^IS_JOB_/ or $macro =~ /^IS_NODE_/;
	    *{$callpkg . "::$macro"} = $sub;
	}
    }
}

our $VERSION = '0.02';

# XSLoader will not work for SLURM because it does not honour dl_load_flags.
require DynaLoader;
our @ISA;
push @ISA, 'DynaLoader';
bootstrap Slurm $VERSION;

sub dl_load_flags { if($^O eq 'aix') { 0x00 } else { 0x01 }}


############################################################
# handy macros defined in slurm_protocol_defs.h
############################################################
# /* Defined job states */
sub IS_JOB_PENDING     { (($_[0]->{job_state} & JOB_STATE_BASE) == JOB_PENDING) }
sub IS_JOB_RUNNING     { (($_[0]->{job_state} & JOB_STATE_BASE) == JOB_RUNNING) }
sub IS_JOB_SUSPENDED   { (($_[0]->{job_state} & JOB_STATE_BASE) == JOB_SUSPENDED) }
sub IS_JOB_COMPLETE    { (($_[0]->{job_state} & JOB_STATE_BASE) == JOB_COMPLETE) }
sub IS_JOB_CANCELLED   { (($_[0]->{job_state} & JOB_STATE_BASE) == JOB_CANCELLED) }
sub IS_JOB_FAILED      { (($_[0]->{job_state} & JOB_STATE_BASE) == JOB_FAILED) }
sub IS_JOB_TIMEOUT     { (($_[0]->{job_state} & JOB_STATE_BASE) == JOB_TIMEOUT) }
sub IS_JOB_NODE_FAILED { (($_[0]->{job_state} & JOB_STATE_BASE) == JOB_NODE_FAIL) }
# /* Derived job states */
sub IS_JOB_COMPLETING  { ($_[0]->{job_state} & JOB_COMPLETING) }
sub IS_JOB_CONFIGURING { ($_[0]->{job_state} & JOB_CONFIGURING) }
sub IS_JOB_STARTED     { (($_[0]->{job_state} & JOB_STATE_BASE) >  JOB_PENDING) }
sub IS_JOB_FINISHED    { (($_[0]->{job_state} & JOB_STATE_BASE) >  JOB_SUSPENDED) }
sub IS_JOB_COMPLETED   { (IS_JOB_FINISHED($_[0]) && (($_[0]->{job_state} & JOB_COMPLETING) == 0)) }
sub IS_JOB_RESIZING    { ($_[0]->{job_state} & JOB_RESIZING) }
# /* Defined node states */
sub IS_NODE_UNKNOWN    { (($_[0]->{node_state} & NODE_STATE_BASE) == NODE_STATE_UNKNOWN) }
sub IS_NODE_DOWN       { (($_[0]->{node_state} & NODE_STATE_BASE) == NODE_STATE_DOWN) }
sub IS_NODE_IDLE       { (($_[0]->{node_state} & NODE_STATE_BASE) == NODE_STATE_IDLE) }
sub IS_NODE_ALLOCATED  { (($_[0]->{node_state} & NODE_STATE_BASE) == NODE_STATE_ALLOCATED) }
sub IS_NODE_ERROR      { (($_[0]->{node_state} & NODE_STATE_BASE) == NODE_STATE_ERROR) }
sub IS_NODE_MIXED      { (($_[0]->{node_state} & NODE_STATE_BASE) == NODE_STATE_MIXED) }
sub IS_NODE_FUTURE     { (($_[0]->{node_state} & NODE_STATE_BASE) == NODE_STATE_FUTURE) }
# /* Derived node states */
sub IS_NODE_DRAIN      { ($_[0]->{node_state} & NODE_STATE_DRAIN) }
sub IS_NODE_DRAINING   { (($_[0]->{node_state} & NODE_STATE_DRAIN) &&
			  (IS_NODE_ALLOCATED($_[0]) || IS_NODE_ERROR($_[0]) || IS_NODE_MIXED($_[0]))) }
sub IS_NODE_DRAINED    { (IS_NODE_DRAIN($_[0]) && !IS_NODE_DRAINING($_[0])) }
sub IS_NODE_COMPLETING { ($_[0]->{node_state} & NODE_STATE_COMPLETING) }
sub IS_NODE_NO_RESPOND { ($_[0]->{node_state} & NODE_STATE_NO_RESPOND) }
sub IS_NODE_POWER_SAVE { ($_[0]->{node_state} & NODE_STATE_POWER_SAVE) }
sub IS_NODE_POWER_UP   { ($_[0]->{node_state} & NODE_STATE_POWER_UP) }
sub IS_NODE_FAIL       { ($_[0]->{node_state} & NODE_STATE_FAIL) }
sub IS_NODE_MAINT      { ($_[0]->{node_state} & NODE_STATE_MAINT) }


1;
__END__

=head1 NAME

Slurm - Perl API for libslurm

=head1 SYNOPSIS

    use Slurm;

    my $slurm = Slurm::new();
    $nodes = $slurm->load_node();
    unless($nodes) {
        die "failed to load node info: " . $slurm->strerror();
    }

=head1 DESCRIPTION

The Slurm class provides Perl interface of the SLURM API functions in C<E<lt>slurm/slurm.hE<gt>>, with some extra frequently used functions exported by libslurm.

=head2 METHODS

To use the API, first create a Slurm object:

    $slurm = Slurm::new($conf);

Then call the desired functions:

    $resp = $slurm->load_jobs();

In the following L</"METHODS"> section, if a parameter is omitted, it will be listed as "param=val" , where "val" is the default value of the parameter.
    
=head2 DATA STRUCTURES
    
Typicaly, C structures are converted to (maybe blessed) Perl hash references, with field names as hash keys. Arrays in C are converted to arrays in Perl. For example, there is a structure C<job_info_msg_t>:

    typedef struct job_info_msg {
        time_t last_update;     /* time of latest info */
        uint32_t record_count;  /* number of records */
        job_info_t *job_array;  /* the job records */
    } job_info_msg_t;

This will be converted to a hash reference with the following structure:

    {
        last_update => 1285847672,
        job_array => [ {account => 'test', alloc_node => 'ln0', alloc_sid => 1234, ...},
                       {account => 'debug', alloc_node => 'ln2', alloc_sid => 5678, ...},
                       ...
                     ]
    }

Note the missing of the C<record_count> field in the hash. It can be derived from the number of elements in array C<job_array>.
    
To pass parameters to the API functions, use the corresponding hash references, for example:

    $rc = $slurm->update_node({node_names => 'node[0-7]', node_state => NODE_STATE_DRAIN});

Please see C<E<lt>slurm/slurm.hE<gt>> for the definition of the structures.

=head2 CONSTANTS

The enumerations and macro definitions are available in the Slurm package. If ':constant' is given when using the Slurm package, the constants will be exported to the calling package.

Please see L<Slurm::Constant> for the available constants.
    
=head1 METHODS

=head2 CONSTRUCTOR/DESTRUCTOR

=head3 $slurm = Slurm::new($conf_file=undef);

Create a Slurm object. For now the object is just a hash reference with no members.

=over 2

=item * IN $conf_file: the SLURM configuration file. If omitted, the default SLURM configuration file will be used (file specified by environment variable SLURM_CONF or the file slurm.conf under directroy specified in compile time).

=item * RET: blessed opaque Slurm object. On error C<undef> is returned.
    
=back


    
    
=head2 ERROR INFORMATION FUNCTIONS

=head3 $errno = $slurm->get_errno();

Get the error number associated with last operation.

=over 2

=item * RET: error number associated with last operation.

=back    

=head3 $str = $slurm->strerror($errno=0)

Get the string describing the specified error number.

=over 2

=item * IN $errno: error number. If omitted or 0, the error number returned by C<$slurm->get_errno()> will be used.
    
=item * RET: error string.

=back    



    
=head2 ENTITY STATE/REASON/FLAG/TYPE STRING FUNCTIONS

=head3 $str = $slurm->preempt_mode_string($mode_num);

Get the string describing the specified preemt mode number.

=over 2

=item * IN $mode_num: preempt mode number.
    
=item * RET: preempt mode string.

=back    

=head3 $num = $slurm->preempt_mode_num($mode_str);

Get the preempt mode number of the specified preempt mode string.

=over 2

=item * IN $mode_str: preempt mode string.
    
=item * RET: preempt mode number.

=back    

=head3 $str = $slurm->job_reason_string($num);

Get the string representation of the specified job state reason number.

=over 2

=item * IN $num: job reason number.
    
=item * RET: job reason string.

=back    

=head3 $str = $slurm->job_state_string($num);

Get the string representation of the specified job state number.

=over 2

=item * IN $num: job state number.
    
=item * RET: job state string.

=back    

=head3 $str = $slurm->job_state_string_compact($num);

Get the compact string representation of the specified job state number.

=over 2

=item * IN $num: job state number.
    
=item * RET: compact job state string.

=back    

=head3 $num = $slurm->job_state_num($str);

Get the job state number of the specified (compact) job state string.

=over 2

=item * IN $str: job state string.
    
=item * RET: job state number.

=back    

=head3 $str = $slurm->reservation_flags_string($flags);

Get the string representation of the specified reservation flags.

=over 2

=item * IN $num: reservation flags number.
    
=item * RET: reservation flags string.

=back    

=head3 $str = $slurm->node_state_string($num);

Get the string representation of the specified node state number.

=over 2

=item * IN $num: node state number.
    
=item * RET: node state string.

=back    

=head3 $str = $slurm->node_state_string_compact($num);

Get the compact string representation of the specified node state number.

=over 2

=item * IN $num: node state number.
    
=item * RET: compact node state string.

=back    

=head3 $str = $slurm->private_data_string($num);

Get the string representation of the specified private data type.

=over 2

=item * IN $num: private data type number.
    
=item * RET: private data type string.

=back    

=head3 $str = $slurm->accounting_enforce_string($num);

Get the string representation of the specified accounting enforce type.

=over 2

=item * IN $num: accounting enforce type number.
    
=item * RET: accounting enforce type string.

=back    

=head3 $str = $slurm->conn_type_string($num);

Get the string representation of the specified connection type.

=over 2

=item * IN $num: connection type number.
    
=item * RET: connection type string.

=back    

=head3 $str = $slurm->node_use_string($num);

Get the string representation of the specified node usage type.

=over 2

=item * IN $num: node usage type number.
    
=item * RET: node usage type string.

=back    

=head3 $str = $slurm->bg_block_state_string($num);

Get the string representation of the specified BlueGene block state.

=over 2

=item * IN $num: BG block state number.
    
=item * RET: BG block state string.

=back    


    

=head2 RESOURCE ALLOCATION FUNCTIONS

=head3 $resp = $slurm->allocate_resources($job_desc);

Allocate resources for a job request. If the requested resources are not immediately available, the slurmctld will send the job_alloc_resp_msg to the sepecified node and port.

=over 2

=item * IN $job_desc: description of resource allocation request, with sturcture of C<job_desc_msg_t>.

=item * RET: response to request, with structure of C<resource_allocation_response_msg_t>.  This only represents a job allocation if resources are immediately available.  Otherwise it just contains the job id of the enqueued job request. On failure C<undef> is returned.
    
=back    

=head3 $resp = $slurm->allocate_resources_blocking($job_desc, $timeout=0, $pending_callbacks=undef);

Allocate resources for a job request.  This call will block until the allocation is granted, or the specified timeout limit is reached.
    
=over 2

=item * IN $job_desc: description of resource allocation request, with sturcture of C<job_desc_msg_t>.

=item * IN $timeout: amount of time, in seconds, to wait for a response before giving up. A timeout of zero will wait indefinitely.    

=item * IN $pending_callbacks: If the allocation cannot be granted immediately, the controller will put the job in the PENDING state.  If
pending callback is given, it will be called with the job id of the pending job as the sole parameter.
    
=item * RET: allcation response, with structure of C<resource_allocation_response_msg_t>. On failure C<undef> is returned, with errno set.
    
=back

=head3 $resp = $slurm->allocation_lookup($job_id);

Retrieve info for an existing resource allocation.

=over 2

=item * IN $job_id: job allocation identifier.

=item * RET: job allocation info, with structure of C<job_alloc_info_response_msg_t>. On failure C<undef> is returned with errno set.    

=back

=head3 $resp = $slurm->allocatiion_lookup_lite($job_id);

Retrieve minor info for an existing resource allocation.

=over 2

=item * IN $job_id: job allocation identifier.

=item * RET: job allocation info, with structure of C<resource_allocation_response_msg_t>. On failure C<undef> is returned with errno set.    

=back

=head3 $str = $slurm->read_hostfile($filename, $n);

Read a specified SLURM hostfile. The file must contain a list of SLURM NodeNames, one per line.

=over 2

=item * IN $filename: name of SLURM hostlist file to be read.

=item * IN $n: number of NodeNames required.

=item * RET: a string representing the hostlist. Returns NULL if there are fewer than $n hostnames in the file, or if an error occurs.
    
=back
    
=head3 $msg_thr = $slurm->allocation_msg_thr_create($port, $callbacks);

Startup a message handler talking with the controller dealing with messages from the controller during an allocation.

=over 2
    
=item * OUT $port: port we are listening for messages on from the controller.
    
=item * IN $callbacks: callbacks for different types of messages, with structure of C<slurm_allocation_callbacks_t>.
    
=item * RET: opaque object of C<allocation_msg_thread_t *>,  or NULL on failure.
    
=back

=head3 $slurm->allocation_msg_thr_destroy($msg_thr);

Shutdown the message handler talking with the controller dealing with messages from the controller during an allocation.

=over 2
    
=item * IN $msg_thr: opaque object of C<allocation_msg_thread_t> pointer.
    
=back

=head3 $resp = $slurm->submit_batch_job($job_desc_msg);

Issue RPC to submit a job for later execution.

=over 2    

=item * IN $job_desc_msg: description of batch job request, with structure of C<job_desc_msg_t>.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.
    
=back

=head3 $rc = $slurm->job_will_run($job_desc_msg);

Determine if a job would execute immediately if submitted now.

=over 2
    
=item * IN $job_desc_msg: description of resource allocation request, with structure of C<job_desc_msg_t>.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.
    
=back

=head3 $resp = $slurm->sbcast_lookup($job_id);

Retrieve info for an existing resource allocation including a credential needed for sbcast.

=over 2
    
=item * IN $jobid: job allocation identifier.
    
=item * RET: job allocation information includeing a credential for sbcast, with structure of C<job_sbcast_cred_msg_t>. On failure C<undef> is returned with errno set.
    
=back



    
=head2 JOB/STEP SIGNALING FUNCTIONS

=head3 $rc = $slurm->kill_job($job_id, $signal, $batch_flag=0);

Send the specified signal to all steps of an existing job.

=over 2
    
=item * IN $job_id: the job's id.
    
=item * IN $signal: signal number.
    
=item * IN $batch_flag: 1 to signal batch shell only, otherwise 0.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.
    
=back
    
=head3 $rc = $slurm->kill_job_step($job_id, $step_id, $signal);

Send the specified signal to an existing job step.

=over 2
    
=item * IN $job_id: the job's id.
    
=item * IN $step_id: the job step's id.
    
=item * IN $signal: signal number.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.
    
=back
    
=head3 $rc = $slurm->signal_job($job_id, $signal);

Send the specified signal to all steps of an existing job.

=over 2
    
=item * IN $job_id: the job's id.
    
=item * IN $signal: signal number.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.
    
=back
    
=head3 $rc = $slurm->signal_job_step($job_id, $step_id, $signal);

Send the specified signal to an existing job step.

=over 2
    
=item * IN $job_id: the job's id.
    
=item * IN $step_id: the job step's id.
    
=item * IN $signal: signal number.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.
    
=back
    


    
=head2 JOB/STEP COMPLETION FUNCTIONS

=head3 $rc = $slurm->complete_job($job_id, $job_rc=0);

Note the completion of a job and all of its steps.

=over 2
    
=item * IN $job_id: the job's id.
    
=item * IN $job_rc: the highest exit code of any task of the job.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.
    
=back

=head3 $rc = $slurm->terminate_job($job_id);

Terminates all steps of an existing job by sending a REQUEST_TERMINATE_JOB rpc to all slurmd in the the job allocation, and then calls slurm_complete_job().

=over 2
    
=item * IN $job_id: the job's id.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.
    
=back
    
=head3 $rc = $slurm->terminate_job_step($job_id, $step_id);

Terminates a job step by sending a REQUEST_TERMINATE_TASKS rpc to all slurmd of a job step, and then calls slurm_complete_job_step() after verifying that all nodes in the job step no longer have running tasks from the job step.  (May take over 35 seconds to return.)

=over 2    

=item * IN $job_id: the job's id.
    
=item * IN $step_id: the job step's id - use SLURM_BATCH_SCRIPT as the step_id to terminate a job's batch script.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.
    
=back



    
=head2 SLURM TASK SPAWNING FUNCTIONS

=head3 $ctx = $slurm->step_ctx_create($params);

Create a job step and its context. 

=over 2

=item * IN $params: job step parameters, with structure of C<slurm_step_ctx_params_t>.
    
=item * RET: the step context. On failure C<undef> is returned with errno set.

=back    

=head3 $ctx = $slurm->step_ctx_create_no_alloc($params);

Create a job step and its context without getting an allocation. 

=over 2

=item * IN $params: job step parameters, with structure of C<slurm_step_ctx_params_t>..
    
=item * IN $step_id: fake job step id.
    
=item * RET: the step context. On failure C<undef> is returned with errno set.

=back    




=head2 SLURM CONTROL CONFIGURATION READ/PRINT/UPDATE FUNCTIONS

=head3 ($major, $minor, $micro) = $slurm->api_version();

Get the SLURM API's version number.

=over 2

=item * RET: a three element list of the major, minor, and micro version number.

=back    

=head3 $resp = $slurm->load_ctl_conf($update_time=0);

Issue RPC to get SLURM control configuration information if changed.

=over 2
    
=item * IN $update_time: time of current configuration data.

=item * RET: SLURM configuration data, with structure of C<slurm_ctl_conf_t>. On failure C<undef> is returned with errno set.

=back

=head3 $slurm->print_ctl_conf($out, $conf);

Output the contents of SLURM control configuration message as loaded using C<load_ctl_conf()>.

=over 2
    
=item * IN $out: file to write to.
    
=item * IN $conf: SLURM control configuration, with structure of C<slurm_ctl_conf_t>.

=back

=head3 $list = $slurm->ctl_conf_2_key_pairs($conf);

Put the SLURM configuration data into a List of opaque data type C<config_key_pair_t>.

=over 2
    
=item * IN $conf: SLURM control configuration, with structure of C<slurm_ctl_conf_t>.
    
=item * RET: List of opaque data type C<config_key_pair_t>.

=back    

=head3 $resp = $slurm->load_slurmd_status();

Issue RPC to get the status of slurmd daemon on this machine.

=over 2

=item * RET: slurmd status info, with structure of C<slurmd_status_t>. On failure C<undef> is returned with errno set.    

=back    

=head3 $slurm->print_slurmd_status($out, $slurmd_status);

Output the contents of slurmd status message as loaded using C<load_slurmd_status()>.

=over 2
    
=item * IN $out: file to write to.
    
=item * IN $slurmd_status: slurmd status info, with structure of C<slurmd_status_t>.

=back    

=head3 $slurm->print_key_pairs($out, $key_pairs, $title);

Output the contents of key_pairs which is a list of opaque data type C<config_key_pair_t>.

=over 2
    
=item * IN $out: file to write to.
    
=item * IN $key_pairs: List containing key pairs to be printed.
    
=item * IN $title: title of key pair list.

=back    

=head3 $rc = $slurm->update_step($step_msg);

Update the time limit of a job step.

=over 2
    
=item * IN $step_msg: step update messasge descriptor, with structure of C<step_update_request_msg_t>.
    
=item * RET: 0 or -1 on error.

=back    



    
=head2 SLURM JOB RESOURCES READ/PRINT FUNCTIONS

=head3 $num = $slurm->job_cpus_allocated_on_node_id($job_res, $node_id);

Get the number of cpus allocated to a job on a node by node id.

=over 2
    
=item * IN $job_res: job resources data, with structure of C<job_resources_t>.
    
=item * IN $node_id: zero-origin node id in allocation.
    
=item * RET: number of CPUs allocated to job on this node or -1 on error.

=back    

=head3 $num = $slurm->job_cpus_allocated_on_node($job_res, $node_name);

Get the number of cpus allocated to a job on a node by node name.

=over 2
    
=item * IN $job_res: job resources data, with structure of C<job_resources_t>.
    
=item * IN $node_name: name of node.
    
=item * RET: number of CPUs allocated to job on this node or -1 on error.

=back    




=head2 SLURM JOB CONFIGURATION READ/PRINT/UPDATE FUNCTIONS

=head3 $time = $slurm->get_end_time($job_id);

Get the expected end time for a given slurm job.

=over 2
    
=item * IN $jobid: SLURM job id.
    
=item * RET: scheduled end time for the job. On failure C<undef> is returned with errno set.

=back    

=head3 $secs = $slurm->get_rem_time($job_id);

Get the expected time remaining for a given job.

=over 2
    
=item * IN $jobid: SLURM job id.
    
=item * RET: remaining time in seconds or -1 on error.

=back
    
=head3 $rc = $slurm->job_node_ready($job_id);

Report if nodes are ready for job to execute now.

=over 2
    
=item * IN $job_id: SLURM job id.
    
=item * RET: 

=over 2

=item * READY_JOB_FATAL: fatal error
    
=item * READY_JOB_ERROR: ordinary error
    
=item * READY_NODE_STATE: node is ready
    
=item * READY_JOB_STATE: job is ready to execute

=back    

=back    

=head3 $resp = $slurm->load_job($job_id, $show_flags=0);

Issue RPC to get job information for one job ID.

=over 2    

=item * IN $job_id: ID of job we want information about.
    
=item * IN $show_flags: job filtering options.
    
=item * RET: job information, with structure of C<job_info_msg_t>. On failure C<undef> is returned with errno set.

=back    

=head3 $resp = $slurm->load_jobs($update_time=0, $show_flags=0);

Issue RPC to get all SLURM job information if changed.

=over 2    

=item * IN $update_time: time of current job information data.
    
=item * IN $show_flags: job filtering options.
    
=item * RET: job information, with structure of C<job_info_msg_t>. On failure C<undef> is returned with errno set.

=back    

=head3 $rc = $slurm->notify_job($job_id, $message);

Send message to the job's stdout, usable only by user root.

=over 2
    
=item * IN $job_id: SLURM job id or 0 for all jobs.

=item * IN $message: arbitrary message.
    
=item * RET: 0 or -1 on error.

=back

=head3 $job_id = $slurm->pid2jobid($job_pid);

Issue RPC to get the SLURM job ID of a given process ID on this machine.

=over 2
    
=item * IN $job_pid: process ID of interest on this machine.
    
=item * RET: corresponding job ID. On failure C<undef> is returned.

=back    
    
=head3 $slurm->print_job_info($out, $job_info, $one_liner=0);

Output information about a specific SLURM job based upon message as loaded using C<load_jobs()>.

=over 2
    
=item * IN $out: file to write to.
    
=item * IN $job_info: an individual job information record, with structure of C<job_info_t>.
    
=item * IN $one_liner: print as a single line if true.
    
=back

=head3 $slurm->print_job_info_msg($out, $job_info_msg, $one_liner=0);

Output information about all SLURM jobs based upon message as loaded using C<load_jobs()>.

=over 2    

=item * IN $out: file to write to.
    
=item * IN $job_info_msg: job information message, with structure of C<job_info_msg_t>.
    
=item * IN $one_liner: print as a single line if true.

=back    

=head3 $str = $slurm->sprint_job_info($job_info, $one_liner=0);

Output information about a specific SLURM job based upon message as loaded using C<load_jobs()>.

=over 2
    
=item * IN $job_info: an individual job information record, with structure of C<job_info_t>.
    
=item * IN $one_liner: print as a single line if true.
    
=item * RET: string containing formatted output.

=back    
    
=head3 $rc = $slurm->update_job($job_info);

Issue RPC to a job's configuration per request only usable by user root or (for some parameters) the job's owner.

=over 2
    
=item * IN $job_info: description of job updates, with structure of C<job_desc_msg_t>.
    
=item * RET: 0 on success, otherwise return -1 and set errno to indicate the error.

=back


    
    
=head2 SLURM JOB STEP CONFIGURATION READ/PRINT/UPDATE FUNCTIONS

=head3 $resp = $slurm->get_job_steps($update_time=0, $job_id=NO_VAL, $step_id=NO_VAL, $show_flags=0);

Issue RPC to get specific slurm job step configuration information if changed since update_time.

=over 2
    
=item * IN $update_time: time of current configuration data.
    
=item * IN $job_id: get information for specific job id, NO_VAL for all jobs.
    
=item * IN $step_id: get information for specific job step id, NO_VAL for all job steps.
    
=item * IN $show_flags: job step filtering options.
    
=item * RET: job step information, with structure of C<job_step_info_response_msg_t>. On failure C<undef> is returned with errno set.

=back    

=head3 $slurm->print_job_step_info_msg($out, $step_info_msg, $one_liner);

Output information about all SLURM job steps based upon message as loaded using C<get_job_steps()>.

=over 2
    
=item * IN $out: file to write to.
    
=item * IN $step_info_msg: job step information message, with structure of C<job_step_info_response_msg_t>.
    
=item * IN $one_liner: print as a single line if true.

=back    

=head3 $slurm->print_job_step_info($out, $step_info, $one_liner);

Output information about a specific SLURM job step based upon message as loaded using C<get_job_steps()>.

=over 2
    
=item * IN $out: file to write to.
    
=item * IN $step_info: job step information, with structure of C<job_step_info_t>.
    
=item * IN $one_liner: print as a single line if true.

=back    

=head3 $str = $slurm->sprint_job_step_info($step_info, $one_liner);

Output information about a specific SLURM job step based upon message as loaded using C<get_job_steps()>.

=over 2
    
=item * IN $step_info: job step information, with structure of C<job_step_info_t>.
    
=item * IN $one_liner: print as a single line if true.

=item * RET: string containing formatted output.
    
=back    

=head3 $layout = $slurm->job_step_layout_get($job_id, $step_id);

Get the layout structure for a particular job step.

=over 2

=item * IN $job_id: SLURM job ID.

=item * IN $step_id: SLURM step ID.

=item * RET: layout of the job step, with structure of C<slurm_step_layout_t>. On failure C<undef> is returned with errno set.

=back    

=head3 $resp = $slurm->job_step_stat($job_id, $step_id, $nodelist=undef);

Get status of a current step.

=over 2    

=item * IN $job_id : SLURM job ID.
    
=item * IN $step_id: SLURM step ID.
    
=item * IN $nodelist: nodes to check status of step. If omitted, all nodes in step are used.

=item * RET: response of step status, with structure of C<job_step_stat_response_msg_t>. On failure C<undef> is returned.

=back
    
=head3 $resp = $slurm->job_step_get_pids($job_id, $step_id, $nodelist);
    
Get the complete list of pids for a given job step.

=over 2    

=item * IN $job_id: SLURM job ID.
    
=item * IN $step_id: SLURM step ID.

=item * IN $nodelist: nodes to check pids of step. If omitted, all nodes in step are used.
    
=item * RET: response of pids information, with structure of C<job_step_pids_response_msg_t>. On failure C<undef> is returned.

=back    



    
=head2 SLURM NODE CONFIGURATION READ/PRINT/UPDATE FUNCTIONS

=head3 $resp = $slurm->load_node($update_time=0, $show_flags=0);

Issue RPC to get all node configuration information if changed.

=over 2

=item * IN $update_time: time of current configuration data.

=item * IN $show_flags: node filtering options.

=item * RET: response hash reference with structure of C<node_info_msg_t>. On failure C<undef> is returned with errno set.

=back    

=head3 $slurm->print_node_info_msg($out, $node_info_msg, $one_liner=0);

Output information about all SLURM nodes based upon message as loaded using C<load_node()>.

=over 2

=item * IN $out: FILE handle to write to.

=item * IN $node_info_msg: node information message to print, with structure of C<node_info_msg_t>.

=item * IN $one_liner: if true, each node info will be printed as a single line.

=back    

=head3 $slurm->print_node_table($out, $node_info, $node_scaling=1, $one_liner=0);

Output information about a specific SLURM node based upon message as loaded using C<load_node()>.

=over 2
    
=item * IN $out: FILE handle to write to.

=item * IN $node_info: an individual node information record with structure of C<node_info_t>.

=item * IN $node_scaling: the number of nodes each node information record represents.

=item * IN $one_liner: whether to print as a single line.

=back    

=head3 $str = $slurm->sprint_node_table($node_info, $node_scaling=1, $one_liner=0);

Output information about a specific SLURM node based upon message as loaded using C<load_node>.

=over 2

=item * IN $node_info: an individual node information record with structure of C<node_info_t>.

=item * IN $node_scaling: number of nodes each node information record represents.

=item * IN $one_liner: whether to print as a single line.

=item * RET: string containing formatted output on success, C<undef> on failure.

=back
    
=head3 $rc = $slurm->update_node($node_info);

Issue RPC to modify a node's configuration per request, only usable by user root.

=over 2

=item * IN $node_info: description of node updates, with structure of C<update_node_msg_t>.

=item * RET: 0 on success, -1 on failure with errno set.

=back    


    

=head2 SLURM SWITCH TOPOLOGY CONFIGURATION READ/PRINT FUNCTIONS

=head3 $resp = $slurm->load_topo();

Issue RPC to get all switch topology configuration information. 

=over 2

=item * RET: response hash reference with structure of C<topo_info_response_msg_t>. On failure C<undef> is returned with errno set.

=back
    
=head3 $slurm->print_topo_info_msg($out, $topo_info_msg, $one_liner=0);

Output information about all switch topology configuration information based upon message as loaded using C<load_topo()>. 

=over 2

=item * IN $out: FILE handle to write to.

=item * IN $topo_info_msg: swith topology information message, with structure of C<topo_info_response_msg_t>.

=item * IN $one_liner: print as a single line if not zero.

=back

=head3 $slurm->print_topo_record($out, $topo_info, $one_liner);

Output information about a specific SLURM topology record based upon message as loaded using C<load_topo()>.

=over 2

=item * IN $out: FILE handle to write to.

=item * IN $topo_info: an individual switch information record, with structure of C<topo_info_t>.

=item * IN $one_liner: print as a single line if not zero.

=back




=head2 SLURM SELECT READ/PRINT/UPDATE FUNCTIONS

=head3 $rc = $slurm->get_select_jobinfo($jobinfo, $data_type, $data)

Get data from a select job credential. 

=over 2

=item * IN $jobinfo: select job credential to get data from. Opaque object.

=item * IN $data_type: type of data to get.

=over 2    

=item * TODO: enumerate data type and returned value.

=back

=item * OUT $data: the data got.

=item * RET: error code.    

=back

=head3 $rc = $slurm->get_select_nodeinfo($nodeinfo, $data_type, $state, $data);

Get data from a select node credential. 


=over 2

=item * IN $nodeinfo: select node credential to get data from.

=item * IN $data_type: type of data to get.

=over 2

=item * TODO: enumerate data type and returned value.
    
=back    
    
=item * IN $state: state of node query.

=item * OUT $data: the data got.

=back





=head2 SLURM PARTITION CONFIGURATION READ/PRINT/UPDATE FUNCTIONS

=head3 $resp = $slurm->load_partitions($update_time=0, $show_flags=0);

Issue RPC to get all SLURM partition configuration information if changed.

=over 2

=item * IN $update_time: time of current configuration data.

=item * IN $show_flags: partitions filtering options.

=item * RET: response hash reference with structure of C<partition_info_msg_t>.
    
=back

=head3 $slurm->print_partition_info_msg($out, $part_info_msg, $one_liner=0);

Output information about all SLURM partitions based upon message as loaded using C<load_partitions()>.

=over 2

=item * IN $out: FILE handle to write to.

=item * IN $part_info_msg: partitions information message, with structure of C<partition_info_msg_t>.

=item * IN $one_liner: print as a single line if true.

=back

=head3 $slurm->print_partition_info($out, $part_info, $one_liner=0);

Output information about a specific SLURM partition based upon message as loaded using C<load_partitions()>.

=over 2

=item * IN $out: FILE handle to write to.

=item * IN $part_info: an individual partition information record, with structure of C<partition_info_t>.

=item * IN $one_liner: print as a single ine if true.

=back

=head3 $str = $slurm->sprint_partition_info($part_info, $one_liner=0);

Output information about a specific SLURM partition based upon message as loaded using C<load_reservations()>. 

=over 2

=item * IN $part_info: an individual partition information record, with structure of C<partition_info_t>.

=item * IN $one_liner: print as a single line if true.

=item * RET: string containing formatted output. On failure C<undef> is returned.
    
=back

=head3 $rc = $slurm->create_partition($part_info);

Create a new partition, only usable by user root. 

=over 2

=item * IN $part_info: description of partition configuration with structure of C<update_part_msg_t>.

=item * RET: 0 on success, -1 on failure with errno set.
    
=back

=head3 $rc = $slurm->update_partition($part_info);

Issue RPC to update a partition's configuration per request, only usable by user root.

=over 2

=item * IN $part_info: description of partition updates with structure of C<update_part_msg_t>.

=item * RET: 0 on success, -1 on failure with errno set.
    
=back

=head3 $rc = $slurm->delete_partition($part_info)

Issue RPC to delete a partition, only usable by user root.

=over 2

=item * IN $part_info: description of partition to delete, with structure of C<delete_part_msg_t>.

=item * RET: 0 on success, -1 on failure with errno set.
    
=back





=head2 SLURM RESERVATION CONFIGURATION READ/PRINT/UPDATE FUNCTIONS

=head3 $name = $slurm->create_reservation($resv_info);

Create a new reservation, only usable by user root.

=over 2

=item * IN $resv_info: description of reservation, with structure of C<resv_desc_msg_t>.

=item * RET: name of reservation created. On failure C<undef> is returned with errno set.
    
=back

=head3 $rc = $slurm->update_reservation($resv_info);

Modify an existing reservation, only usable by user root.

=over 2

=item * IN $resv_info: description of reservation, with structure of C<resv_desc_msg_t>.

=item * RET: error code.
    
=back

=head3 $rc = $slurm->delete_reservation($resv_info);

Issue RPC to delete a reservation, only usable by user root. 

=over 2

=item * IN $resv_info: description of reservation to delete, with structure of C<reservation_name_msg_t>.

=item * RET: error code
    
=back

=head3 $resp = $slurm->load_reservations($update_time=0);

Issue RPC to get all SLURM reservation configuration information if changed.

=over 2

=item * IN $update_time: time of current configuration data.

=item * RET: response of reservation information, with structure of C<reserve_info_msg_t>. On failure C<undef> is returned with errno set.
    
=back

=head3 $slurm->print_reservation_info_msg($out, $resv_info_msg, $one_liner=0);

Output information about all SLURM reservations based upon message as loaded using C<load_reservation()>.

=over 2

=item * IN $out: FILE handle to write to.

=item * IN $resv_info_msg: reservation information message, with structure of C<reserve_info_msg_t>.

=item * IN $one_liner: print as a single line if true.

=back

=head3 $slurm->print_reservation_info($out, $resv_info, $one_liner=0);

Output information about a specific SLURM reservation based upon message as loaded using C<load_reservation()>.

=over 2

=item * IN $out: FILE handle to write to.

=item * IN $resv_info: an individual reservation information record, with structure of C<reserve_info_t>.

=item * IN $one_liner: print as a single line if true.

=back

=head3 $str = $slurm->sprint_reservation_info($resv_info, $one_liner=0);

Output information about a specific SLURM reservation based upon message as loaded using C<load_reservations()>.

=over 2

=item * IN $resv_info: an individual reservation information record, with structure of C<reserve_info_t>.

=item * IN $one_liner: print as a single line if true.

=item * RET: string containing formatted output. On failure C<undef> is returned.
    
=back



    
=head2 SLURM PING/RECONFIGURE/SHUTDOWN FUNCTIONS

=head3 $rc = $slurm->ping($primary);

Issue RPC to ping Slurm controller (slurmctld).

=over 2

=item * IN primary: 1 for primary controller, 2 for secondary controller.

=item * RET: error code.
    
=back

=head3 $rc = $slurm->reconfigure()

Issue RPC to have Slurm controller (slurmctld) reload its configuration file.

=over 2

=item * RET: error code.
    
=back

=head3 $rc = $slurm->shutdown($options);

Issue RPC to have Slurm controller (slurmctld) cease operations, both the primary and backup controller are shutdown.

=over 2

=item * IN $options:

=over 4

=item * 0: all slurm daemons are shutdown.

=item * 1: slurmctld generates a core file.

=item * 2: only the slurmctld is shutdown (no core file).

=back

=item * RET: error code.
    
=back

=head3 $rc = $slurm->takeover();

Issue RPC to have Slurm backup controller take over the primary controller. REQUEST_CONTROL is sent by the backup to the primary controller to take control. 

=over 2

=item * RET: error code.
    
=back

=head3 $rc = $slurm->set_debug_level($debug_level)

Issue RPC to set slurm controller debug level.

=over 2

=item * IN $debug_level: requested debug level.

=item * RET: 0 on success, -1 on error with errno set.
    
=back

=head3 $rc = $slurm->set_schedlog_level($schedlog_level);

Issue RPC to set slurm scheduler log level.
    
=over 2

=item * schedlog_level: requested scheduler log level.

=item * RET: 0 on success, -1 on error with errno set.
    
=back



    
=head2 SLURM JOB SUSPEND FUNCTIONS

=head3 $rc = $slurm->suspend($job_id);

Suspend execution of a job.

=over 2

=item * IN $job_id: job on which top perform operation.

=item * RET: error code.    

=back

=head3 $rc = $slurm->resume($job_id);

Resume execution of a previously suspended job.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * RET: error code.
    
=back

=head3 $rc = $slurm->requeue($job_id);

Re-queue a batch job, if already running then terminate it first.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * RET: error code.

=back


    

=head2 SLURM JOB CHECKPOINT FUNCTIONS

=head3 $rc = $slurm->checkpoint_able($job_id, $step_id, $start_time);

Determine if the specified job step can presently be checkpointed.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * OUT $start_time: time at which checkpoint request was issued.

=item * RET: 0 (can be checkpoined) or a slurm error code.
    
=back

=head3 $rc = $slurm->checkpoint_disable($job_id, $step_id);

Disable checkpoint requests for some job step.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * RET: error code.
    
=back

=head3 $rc = $slurm->checkpoint_enable($job_id, $step_id);

Enable checkpoint requests for some job step.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * RET: error code.
    
=back

=head3 $rc = $slurm->checkpoint_create($job_id, $step_id, $max_wait, $image_dir);

Initiate a checkpoint requests for some job step. The job will continue execution after the checkpoint operation completes.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * IN $max_wait: maximum wait for operation to complete, in seconds.

=item * IN $image_dir: directory to store image files.

=item * RET: error code.    
    
=back

=head3 $rc = $slurm->checkpoint_vacate($job_id, $step_id, $max_wait, $image_dir);

Initiate a checkpoint requests for some job step. The job will terminate after the checkpoint operation completes.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * IN $max_wait: maximum wait for operation to complete, in seconds.

=item * IN $image_dir: directory to store image files.

=item * RET: error code.
    
=back

=head3 $rc = $slurm->checkpoint_restart($job_id, $step_id, $stick, $image_dir)

Restart execution of a checkpointed job step.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * IN $stick: if true, stick to nodes previously running on.

=item * IN $image_dir: directory to find checkpoint image files.

=item * RET: error code.
    
=back

=head3 $rc = $slurm->checkpoint_complete($job_id, $step_id, $begin_time, $error_code, $error_msg);

Note the completion of a job step's checkpoint operation. 

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * IN $begin_time: time at which checkpoint began.

=item * IN $error_code: error code, highest value for all complete calls is preserved.

=item * IN $error_msg: error message, preserved for highest error_code.

=item * RET: error code.
    
=back

=head3 checkpoint_task_complete($job_id, $step_id, $task_id, $begin_time, $error_code, $error_msg);

Note the completion of a task's checkpoint operation.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * IN $task_id: task which completed the operation.

=item * IN $begin_time: time at which checkpoint began.

=item * IN $error_code: error code, highest value for all complete calls is preserved.

=item * IN $error_msg: error message, preserved for highest error_code.

=item * RET: error code.
    
=back

=head3 $rc = $slurm->checkpoint_error($job_id, $step_id, $error_code, $error_msg);

Gather error information for the last checkpoint operation for some job step.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * OUT $error_code: error number associated with the last checkpoint operation.

=item * OUT $error_msg: error message associated with the last checkpoint operation.

=item * RET: error code.

=back

=head3 $rc = $slurm->checkpoint_tasks($job_id, $step_id, $image_dir, $max_wait, $nodelist);

Send checkoint request to tasks of specified job step.

=over 2

=item * IN $job_id: job on which to perform operation.

=item * IN $step_id: job step on which to perform operation.

=item * IN $image_dir: location to store checkpoint image files.

=item * IN $max_wait: seconds to wait for the operation to complete.

=item * IN $nodelist: nodes to send the request.    

=item * RET: 0 on success, non-zero on failure with errno set.
    
=back


    

=head2 SLURM TRIGGER FUNCTIONS

=head3 $rc = $slurm->set_trigger($trigger_info);

Set an event trigger.

=over 2

=item * IN $trigger_info: hash reference of specification of trigger to create, with structure of C<trigger_info_t>.

=item * RET: error code.

=back

=head3 $rc = $slurm->clear_trigger($trigger_info);

Clear an existing event trigger. 

=over 2

=item * IN $trigger_info: hash reference of specification of trigger to remove, with structure of C<trigger_info_t>.

=item * RET: error code.

=back

=head3 $resp = $slurm->get_triggers();

Get all event trigger information.

=over 2

=item * RET: hash reference with structure of C<trigger_info_msg_t>. On failure C<undef> is returned with errno set.
    
=back


    
    
=head2 JOB/NODE STATE TESTING FUNCTIONS

The following are functions to test job/node state, based on the macros defined in F<src/common/slurm_protocol_defs.h>. The functions take a parameter of a hash reference of a job/node, and return a boolean value. For job, $job->{job_state} is tested. For node, $node->{node_state} is tested.

=head3 $cond = IS_JOB_PENDING($job);

=head3 $cond = IS_JOB_RUNNING($job);

=head3 $cond = IS_JOB_SUSPENDED($job);

=head3 $cond = IS_JOB_COMPLETE($job); 

=head3 $cond = IS_JOB_CANCELLED($job);

=head3 $cond = IS_JOB_FAILED($job);

=head3 $cond = IS_JOB_TIMEOUT($job);

=head3 $cond = IS_JOB_NODE_FAILED($job);

=head3 $cond = IS_JOB_COMPLETING($job);

=head3 $cond = IS_JOB_CONFIGURING($job);

=head3 $cond = IS_JOB_STARTED($job);

=head3 $cond = IS_JOB_FINISHED($job);

=head3 $cond = IS_JOB_COMPLETED($job);

=head3 $cond = IS_JOB_RESIZING($job);

=head3 $cond = IS_NODE_UNKNOWN($node);

=head3 $cond = IS_NODE_DOWN($node);

=head3 $cond = IS_NODE_IDLE($node);

=head3 $cond = IS_NODE_ALLOCATED($node);

=head3 $cond = IS_NODE_ERROR($node);

=head3 $cond = IS_NODE_MIXED($node);

=head3 $cond = IS_NODE_FUTURE($node);

=head3 $cond = IS_NODE_DRAIN($node);

=head3 $cond = IS_NODE_DRAINING($node);

=head3 $cond = IS_NODE_DRAINED($node);

=head3 $cond = IS_NODE_COMPLETING($node);

=head3 $cond = IS_NODE_NO_RESPOND($node);

=head3 $cond = IS_NODE_POWER_SAVE($node);

=head3 $cond = IS_NODE_POWER_UP($node);

=head3 $cond = IS_NODE_FAIL($node);

=head3 $cond = IS_NODE_MAINT($node);



    
=head1 EXPORT

The job/node state testing functions are exported by default.

If ':constant' if specified, all constants are exported.

=head1 SEE ALSO

L<Slurm::Constant>, L<Slurm::Hostlist>, L<Slurm::Stepctx>, L<Slurm::Bitstr>

<slurm/slurm.h> for various hash reference structures.

Home page of SLURM: L<http://www.llnl.gov/linux/slurm/>.

=head1 AUTHOR

This library is created by Hongjia Cao, E<lt>hjcao(AT)nudt.edu.cnE<gt> and Danny Auble, E<lt>da(AT)llnl.govE<gt>. It is distributed with SLURM.

=head1 COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.4 or,
at your option, any later version of Perl 5 you may have available.


=cut