.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Slurm::Hostlist 3pm" .TH Slurm::Hostlist 3pm 2024-02-25 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Slurm::Hostlist \- Hostlist functions in libslurm .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Slurm; \& \& $hostnames = "node1,node[2\-5,12]"; \& $hl = Slurm::Hostlist::create($hostnames); \& \& $cnt = $hl\->count; \& \& $hl\->push("node21,node[27\-34]"); \& \& while($host = $hl\->shift()) { \& print $host, "\en"; \& } \& \& print $hl\->ranged_string(), "\en"; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The Slurm::Hostlist class is a wrapper of the hostlist functions in libslurm. This package is loaded and bootstrapped with package Slurm. .SH METHODS .IX Header "METHODS" .ie n .SS "$hl = Slurm::Hostlist::new($str);" .el .SS "\f(CW$hl\fP = Slurm::Hostlist::new($str);" .IX Subsection "$hl = Slurm::Hostlist::new($str);" Create a new hostlist from a string representation. Returns an opaque hostlist object. This is a \fBCLASS METHOD\fR. .PP The string representation ($str) may contain one or more hostnames or bracketed hostlists separated by either `,' or whitespace. A bracketed hostlist is denoted by a common prefix followed by a list of numeric ranges contained within brackets: e.g. "tux[0\-5,12,20\-25]". .PP To support systems with 3\-D topography, a rectangular prism may be described using two three digit numbers separated by "x": e.g. "bgl[123x456]". This selects all nodes between 1 and 4 inclusive in the first dimension, between 2 and 5 in the second, and between 3 and 6 in the third dimension for a total of 4*4*4=64 nodes. .PP If \f(CW$str\fR is omitted, and empty hostlist is created and returned. .ie n .SS "$cnt = $hl\->\fBcount()\fP;" .el .SS "\f(CW$cnt\fP = \f(CW$hl\fP\->\fBcount()\fP;" .IX Subsection "$cnt = $hl->count();" Return the number of hosts in the hostlist. .ie n .SS "$pos = $hl\->find($hostname);" .el .SS "\f(CW$pos\fP = \f(CW$hl\fP\->find($hostname);" .IX Subsection "$pos = $hl->find($hostname);" Searches hostlist \f(CW$hl\fR for the first host matching \f(CW$hostname\fR and returns position in list if found. .PP Returns \-1 if host is not found. .ie n .SS "$cnt = $hl\->push($hosts);" .el .SS "\f(CW$cnt\fP = \f(CW$hl\fP\->push($hosts);" .IX Subsection "$cnt = $hl->push($hosts);" Push a string representation of hostnames onto a hostlist. The \f(CW$hosts\fR argument may take the same form as in \fBcreate()\fR. .PP Returns the number of hostnames inserted into the list, .ie n .SS "$cnt = $hl\->push_host($hostname);" .el .SS "\f(CW$cnt\fP = \f(CW$hl\fP\->push_host($hostname);" .IX Subsection "$cnt = $hl->push_host($hostname);" Push a single host onto the hostlist hl. .PP This function is more efficient than \fBslurm_hostlist_push()\fR for a single hostname, since the argument does not need to be checked for ranges. .PP Return value is 1 for success, 0 for failure. .ie n .SS "$str = $hl\->\fBranged_string()\fP;" .el .SS "\f(CW$str\fP = \f(CW$hl\fP\->\fBranged_string()\fP;" .IX Subsection "$str = $hl->ranged_string();" Return the string representation of the hostlist \f(CW$hl\fR. \fBranged_string()\fR will write a bracketed hostlist representation where possible. .ie n .SS "$host = $hl\->\fBshift()\fP;" .el .SS "\f(CW$host\fP = \f(CW$hl\fP\->\fBshift()\fP;" .IX Subsection "$host = $hl->shift();" Returns the string representation of the first host in the hostlist or `undef' if the hostlist is empty or there was an error allocating memory. The host is removed from the hostlist. .ie n .SS $hl\->\fBuniq()\fP; .el .SS \f(CW$hl\fP\->\fBuniq()\fP; .IX Subsection "$hl->uniq();" Sort the hostlist \f(CW$hl\fR and remove duplicate entries. .SH "SEE ALSO" .IX Header "SEE ALSO" Slurm .SH AUTHOR .IX Header "AUTHOR" This library is created by Hongjia Cao, and Danny Auble, . It is distributed with SLURM. .SH "COPYRIGHT AND LICENSE" .IX Header "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.