1Slurm API(3)               Slurm host list functions              Slurm API(3)
2
3
4

NAME

6       slurm_hostlist_create,  slurm_hostlist_shift,  slurm_hostlist_destroy -
7       Slurm host list support functions
8
9

SYNTAX

11       #include <slurm/slurm.h>
12
13       hostlist_t slurm_hostlist_create (
14            char *node_list
15       );
16
17       char * slurm_hostlist_shift (
18            hostlist_t host_list
19       );
20
21       void slurm_hostlist_destroy (
22            hostlist_t host_list
23       );
24
25

ARGUMENTS

27       node_list
28              A list of nodes as returned by the  slurm_job_step_create  func‐
29              tions.  The  returned value may include a simple range format to
30              describe numeric ranges of values and/or multiple numeric values
31              (e.g.  "linux[1-3,6]"  represents  "linux1", "linux2", "linux3",
32              and "linux6").
33
34       host_list
35              A hostlist created by the slurm_hostlist_create function.
36
37

DESCRIPTION

39       slurm_hostlist_create creates a database of node  names  from  a  range
40       format  describing  node  names.  Use slurm_hostlist_destroy to release
41       storage associated with the database when no longer required.
42
43       slurm_hostlist_shift extracts the first entry from the host list  data‐
44       base created by the slurm_hostlist_create function.
45
46       slurm_hostlist_destroy releases storage associated with a database cre‐
47       ated by slurm_hostlist_create when no longer required.
48
49

RETURN VALUE

51       slurm_hostlist_create returns the host list database or NULL if  memory
52       can not be allocated for the database.
53
54
55       slurm_hostlist_shift  returns  a character string or NULL if no entries
56       remain in the database.
57
58

EXAMPLE

60       #include <stdio.h>
61       #include <hostlist.h>
62       #include <slurm.h>
63
64       int main (int argc, char *argv[])
65       {
66            hostlist_t my_hostlist;
67            char *hostnames, *host;
68
69            /* generate a list of hostnames, possibly using a */
70            /*    slurm job step creation function */
71
72            my_hostlist = slurm_hostlist_create (hostnames);
73            if (my_hostlist == NULL) {
74                 fprintf (stderr, "No memory\n");
75                 exit (1);
76            }
77
78            while ( (host = slurm_hostlist_shift(my_hostlist)) )
79                 printf ("host = %s\n", host);
80
81            slurm_hostlist_destroy (my_hostlist) ;
82            exit (0);
83       }
84
85

NOTE

87       These functions are included in the libslurm  library,  which  must  be
88       linked to your process for use (e.g. "cc -lslurm myprog.c").
89
90

COPYING

92       Copyright  (C)  2002-2006  The Regents of the University of California.
93       Produced at Lawrence Livermore National  Laboratory  (cf,  DISCLAIMER).
94       CODE-OCEC-09-009. All rights reserved.
95
96       This  file  is  part  of  Slurm,  a  resource  management program.  For
97       details, see <https://slurm.schedmd.com/>.
98
99       Slurm is free software; you can redistribute it and/or modify it  under
100       the  terms  of  the GNU General Public License as published by the Free
101       Software Foundation; either version 2  of  the  License,  or  (at  your
102       option) any later version.
103
104       Slurm  is  distributed  in the hope that it will be useful, but WITHOUT
105       ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY  or
106       FITNESS  FOR  A PARTICULAR PURPOSE.  See the GNU General Public License
107       for more details.
108
109

SEE ALSO

111       slurm_get_job_steps(3), slurm_load_jobs(3), slurm_load_partitions(3)
112
113
114
115April 2015                 Slurm host list functions              Slurm API(3)
Impressum