1Slurm::Hostlist(3)    User Contributed Perl Documentation   Slurm::Hostlist(3)
2
3
4

NAME

6       Slurm::Hostlist - Hostlist functions in libslurm
7

SYNOPSIS

9        use Slurm;
10
11        $hostnames = "node1,node[2-5,12]";
12        $hl = Slurm::Hostlist::create($hostnames);
13
14        $cnt = $hl->count;
15
16        $hl->push("node21,node[27-34]");
17
18        while($host = $hl->shift()) {
19               print $host, "\n";
20        }
21
22        print $hl->ranged_string(), "\n";
23

DESCRIPTION

25       The Slurm::Hostlist class is a wrapper of the hostlist functions in
26       libslurm. This package is loaded and bootstrapped with package Slurm.
27

METHODS

29   $hl = Slurm::Hostlist::new($str);
30       Create a new hostlist from a string representation. Returns an opaque
31       hostlist object. This is a CLASS METHOD.
32
33       The string representation ($str) may contain one or more hostnames or
34       bracketed hostlists separated by either `,' or whitespace. A bracketed
35       hostlist is denoted by a common prefix followed by a list of numeric
36       ranges contained within brackets: e.g. "tux[0-5,12,20-25]".
37
38       To support systems with 3-D topography, a rectangular prism may be
39       described using two three digit numbers separated by "x": e.g.
40       "bgl[123x456]". This selects all nodes between 1 and 4 inclusive in the
41       first dimension, between 2 and 5 in the second, and between 3 and 6 in
42       the third dimension for a total of 4*4*4=64 nodes.
43
44       If $str is omitted, and empty hostlist is created and returned.
45
46   $cnt = $hl->count();
47       Return the number of hosts in the hostlist.
48
49   $pos = $hl->find($hostname);
50       Searches hostlist $hl for the first host matching $hostname and returns
51       position in list if found.
52
53       Returns -1 if host is not found.
54
55   $cnt = $hl->push($hosts);
56       Push a string representation of hostnames onto a hostlist. The $hosts
57       argument may take the same form as in create().
58
59       Returns the number of hostnames inserted into the list,
60
61   $cnt = $hl->push_host($hostname);
62       Push a single host onto the hostlist hl.
63
64       This function is more efficient than slurm_hostlist_push() for a single
65       hostname, since the argument does not need to be checked for ranges.
66
67       Return value is 1 for success, 0 for failure.
68
69   $str = $hl->ranged_string();
70       Return the string representation of the hostlist $hl. ranged_string()
71       will write a bracketed hostlist representation where possible.
72
73   $host = $hl->shift();
74       Returns the string representation of the first host in the hostlist or
75       `undef' if the hostlist is empty or there was an error allocating
76       memory. The host is removed from the hostlist.
77
78   $hl->uniq();
79       Sort the hostlist $hl and remove duplicate entries.
80

SEE ALSO

82       Slurm
83

AUTHOR

85       This library is created by Hongjia Cao, <hjcao(AT)nudt.edu.cn> and
86       Danny Auble, <da(AT)llnl.gov>. It is distributed with SLURM.
87
89       This library is free software; you can redistribute it and/or modify it
90       under the same terms as Perl itself, either Perl version 5.8.4 or, at
91       your option, any later version of Perl 5 you may have available.
92
93
94
95perl v5.30.1                      2019-11-18                Slurm::Hostlist(3)
Impressum