~ubuntu-branches/ubuntu/precise/slurm-llnl/precise

« back to all changes in this revision

Viewing changes to .pc/mail-path-patch/src/common/read_config.h

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2011-04-08 11:21:17 UTC
  • mfrom: (3.3.16 sid)
  • Revision ID: james.westby@ubuntu.com-20110408112117-nfnyq9dtm55hqoaw
Tags: 2.2.4-1
* New upstream releases 
* Cleaning spare file and directories, not belonging to the sources
  generated by the building process and not removed by distclean.
  Added debian/clean with spare files and rm -rf inside debian/rules
  for directories.
* Added new packages libslurm-perl, libslurmdb-perl, slurm-llnl-torque
  (Closes: #575822) thanks to Julien Blache

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 *  read_config.h - definitions for reading the overall slurm configuration
 
3
 *  file
 
4
 *****************************************************************************
 
5
 *  Copyright (C) 2002-2007 The Regents of the University of California.
 
6
 *  Copyright (C) 2008-2010 Lawrence Livermore National Security.
 
7
 *  Portions Copyright (C) 2008 Vijay Ramasubramanian.
 
8
 *  Portions Copyright (C) 2010 SchedMD <http://www.schedmd.com>.
 
9
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
 
10
 *  Written by Morris Mette <jette1@llnl.gov>.
 
11
 *  CODE-OCEC-09-009. All rights reserved.
 
12
 *
 
13
 *  This file is part of SLURM, a resource management program.
 
14
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
15
 *  Please also read the included file: DISCLAIMER.
 
16
 *
 
17
 *  SLURM is free software; you can redistribute it and/or modify it under
 
18
 *  the terms of the GNU General Public License as published by the Free
 
19
 *  Software Foundation; either version 2 of the License, or (at your option)
 
20
 *  any later version.
 
21
 *
 
22
 *  In addition, as a special exception, the copyright holders give permission
 
23
 *  to link the code of portions of this program with the OpenSSL library under
 
24
 *  certain conditions as described in each individual source file, and
 
25
 *  distribute linked combinations including the two. You must obey the GNU
 
26
 *  General Public License in all respects for all of the code used other than
 
27
 *  OpenSSL. If you modify file(s) with this exception, you may extend this
 
28
 *  exception to your version of the file(s), but you are not obligated to do
 
29
 *  so. If you do not wish to do so, delete this exception statement from your
 
30
 *  version.  If you delete this exception statement from all source files in
 
31
 *  the program, then also delete it here.
 
32
 *
 
33
 *  SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
 
34
 *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
35
 *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
36
 *  details.
 
37
 *
 
38
 *  You should have received a copy of the GNU General Public License along
 
39
 *  with SLURM; if not, write to the Free Software Foundation, Inc.,
 
40
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 
41
\*****************************************************************************/
 
42
 
 
43
#ifndef _READ_CONFIG_H
 
44
#define _READ_CONFIG_H
 
45
 
 
46
#include "src/common/slurm_protocol_defs.h"
 
47
#include "src/common/slurm_protocol_socket_common.h"
 
48
#include "src/common/parse_config.h"
 
49
 
 
50
extern slurm_ctl_conf_t slurmctld_conf;
 
51
extern char *default_slurm_config_file;
 
52
extern char *default_plugin_path;
 
53
extern char *default_plugstack;
 
54
 
 
55
#define ACCOUNTING_ENFORCE_ASSOCS 0x0001
 
56
#define ACCOUNTING_ENFORCE_LIMITS 0x0002
 
57
#define ACCOUNTING_ENFORCE_WCKEYS 0x0004
 
58
#define ACCOUNTING_ENFORCE_QOS    0x0008
 
59
 
 
60
#define DEFAULT_ACCOUNTING_DB      "slurm_acct_db"
 
61
#define DEFAULT_ACCOUNTING_ENFORCE  0
 
62
#define DEFAULT_ACCOUNTING_STORAGE_TYPE "accounting_storage/none"
 
63
#define DEFAULT_AUTH_TYPE          "auth/munge"
 
64
#define DEFAULT_BATCH_START_TIMEOUT 10
 
65
#define DEFAULT_COMPLETE_WAIT       0
 
66
#define DEFAULT_CRYPTO_TYPE        "crypto/munge"
 
67
#define DEFAULT_EPILOG_MSG_TIME     2000
 
68
#define DEFAULT_FAST_SCHEDULE       1
 
69
#define DEFAULT_FIRST_JOB_ID        1
 
70
#define DEFAULT_GET_ENV_TIMEOUT     2
 
71
#define DEFAULT_GROUP_INFO          600
 
72
/* NOTE: DEFAULT_INACTIVE_LIMIT must be 0 for Blue Gene/L systems */
 
73
#define DEFAULT_INACTIVE_LIMIT      0
 
74
#define DEFAULT_JOB_ACCT_GATHER_TYPE  "jobacct_gather/none"
 
75
#define JOB_ACCT_GATHER_TYPE_NONE "jobacct_gather/none"
 
76
#define DEFAULT_JOB_ACCT_GATHER_FREQ  30
 
77
#define ACCOUNTING_STORAGE_TYPE_NONE "accounting_storage/none"
 
78
#define DEFAULT_DISABLE_ROOT_JOBS   0
 
79
#define DEFAULT_ENFORCE_PART_LIMITS 0
 
80
#define DEFAULT_JOB_CKPT_DIR        "/var/slurm/checkpoint"
 
81
#define DEFAULT_JOB_COMP_TYPE       "jobcomp/none"
 
82
#define DEFAULT_JOB_COMP_LOC        "/var/log/slurm_jobcomp.log"
 
83
#define DEFAULT_JOB_COMP_DB         "slurm_jobcomp_db"
 
84
#define DEFAULT_KILL_ON_BAD_EXIT    0
 
85
#define DEFAULT_KILL_TREE           0
 
86
#define DEFAULT_KILL_WAIT           30
 
87
#define DEFAULT_MAIL_PROG           "/bin/mail"
 
88
#define DEFAULT_MAX_JOB_COUNT       10000
 
89
#define DEFAULT_MEM_PER_CPU         0
 
90
#define DEFAULT_MAX_MEM_PER_CPU     0
 
91
#define DEFAULT_MIN_JOB_AGE         300
 
92
#define DEFAULT_MPI_DEFAULT         "none"
 
93
#define DEFAULT_MSG_TIMEOUT         10
 
94
#ifdef HAVE_AIX         /* AIX specific default configuration parameters */
 
95
#  define DEFAULT_CHECKPOINT_TYPE   "checkpoint/aix"
 
96
#  define DEFAULT_PROCTRACK_TYPE    "proctrack/aix"
 
97
#else
 
98
#  define DEFAULT_CHECKPOINT_TYPE   "checkpoint/none"
 
99
#  define DEFAULT_PROCTRACK_TYPE    "proctrack/pgid"
 
100
#endif
 
101
#define DEFAULT_PREEMPT_TYPE        "preempt/none"
 
102
#define DEFAULT_PRIORITY_DECAY      604800 /* 7 days */
 
103
#define DEFAULT_PRIORITY_CALC_PERIOD 300 /* in seconds */
 
104
#define DEFAULT_PRIORITY_TYPE       "priority/basic"
 
105
#define DEFAULT_RETURN_TO_SERVICE   0
 
106
#define DEFAULT_RESUME_RATE         300
 
107
#define DEFAULT_RESUME_TIMEOUT      60
 
108
#define DEFAULT_SAVE_STATE_LOC      "/tmp"
 
109
#define DEFAULT_SCHEDROOTFILTER     1
 
110
#define DEFAULT_SCHEDULER_PORT      7321
 
111
#define DEFAULT_SCHED_LOG_LEVEL     0
 
112
#define DEFAULT_SCHED_TIME_SLICE    30
 
113
#define DEFAULT_SCHEDTYPE           "sched/builtin"
 
114
#ifdef HAVE_BG  /* Blue Gene specific default configuration parameters */
 
115
#  ifdef HAVE_BGQ
 
116
#     define DEFAULT_SELECT_TYPE       "select/bgq"
 
117
#  else
 
118
#     define DEFAULT_SELECT_TYPE       "select/bluegene"
 
119
#  endif
 
120
#else
 
121
#  ifdef HAVE_CRAY /* Cray specific default configuration parameters */
 
122
#     define DEFAULT_SELECT_TYPE       "select/cray"
 
123
#  else
 
124
#     define DEFAULT_SELECT_TYPE       "select/linear"
 
125
#  endif
 
126
#endif
 
127
#define DEFAULT_SLURMCTLD_PIDFILE   "/var/run/slurmctld.pid"
 
128
#define DEFAULT_SLURMCTLD_TIMEOUT   120
 
129
#define DEFAULT_SLURMD_PIDFILE      "/var/run/slurmd.pid"
 
130
#define DEFAULT_SLURMD_TIMEOUT      300
 
131
#define DEFAULT_SPOOLDIR            "/var/spool/slurmd"
 
132
#define DEFAULT_STORAGE_HOST        "localhost"
 
133
#define DEFAULT_STORAGE_LOC         "/var/log/slurm_jobacct.log"
 
134
#define DEFAULT_STORAGE_USER        "root"
 
135
#define DEFAULT_STORAGE_PORT        0
 
136
#define DEFAULT_PGSQL_PORT          5432
 
137
#define DEFAULT_MYSQL_PORT          3306
 
138
#define DEFAULT_SUSPEND_RATE        60
 
139
#define DEFAULT_SUSPEND_TIME        0
 
140
#define DEFAULT_SUSPEND_TIMEOUT     30
 
141
#define DEFAULT_SWITCH_TYPE         "switch/none"
 
142
#define DEFAULT_TASK_PLUGIN         "task/none"
 
143
#define DEFAULT_TMP_FS              "/tmp"
 
144
#ifdef HAVE_3D
 
145
#  define DEFAULT_TOPOLOGY_PLUGIN     "topology/3d_torus"
 
146
#else
 
147
#  define DEFAULT_TOPOLOGY_PLUGIN     "topology/none"
 
148
#endif
 
149
#define DEFAULT_WAIT_TIME           0
 
150
#define DEFAULT_TREE_WIDTH          50
 
151
#define DEFAULT_UNKILLABLE_TIMEOUT  60 /* seconds */
 
152
#define DEFAULT_MAX_TASKS_PER_NODE  128
 
153
 
 
154
typedef struct slurm_conf_node {
 
155
        char *nodenames;
 
156
        char *hostnames;
 
157
        char *addresses;
 
158
        char *gres;             /* arbitrary list of node's generic resources */
 
159
        char *feature;          /* arbitrary list of node's features */
 
160
        uint16_t port;
 
161
        uint16_t cpus;          /* count of cpus running on the node */
 
162
        uint16_t sockets;       /* number of sockets per node */
 
163
        uint16_t cores;         /* number of cores per CPU */
 
164
        uint16_t threads;       /* number of threads per core */
 
165
        uint32_t real_memory;   /* MB real memory on the node */
 
166
        char *reason;
 
167
        char *state;
 
168
        uint32_t tmp_disk;      /* MB total storage in TMP_FS file system */
 
169
        uint32_t weight;        /* arbitrary priority of node for
 
170
                                 * scheduling work on */
 
171
} slurm_conf_node_t;
 
172
 
 
173
typedef struct slurm_conf_partition {
 
174
        char *allow_alloc_nodes;/* comma delimited list of allowed
 
175
                                 * allocating nodes
 
176
                                 * NULL indicates all */
 
177
        char *allow_groups;     /* comma delimited list of groups,
 
178
                                 * NULL indicates all */
 
179
        char *alternate;        /* name of alternate partition */
 
180
        bool default_flag;      /* Set if default partition */
 
181
        uint32_t default_time;  /* minutes or INFINITE */
 
182
        uint16_t disable_root_jobs; /* if set then user root can't run
 
183
                                     * jobs if NO_VAL use global
 
184
                                     * default */
 
185
 
 
186
        bool     hidden_flag;   /* 1 if hidden by default */
 
187
        uint16_t max_share;     /* number of jobs to gang schedule */
 
188
        uint32_t max_time;      /* minutes or INFINITE */
 
189
        uint32_t max_nodes;     /* per job or INFINITE */
 
190
        uint32_t min_nodes;     /* per job */
 
191
        char    *name;          /* name of the partition */
 
192
        char    *nodes;         /* comma delimited list names of nodes */
 
193
        uint16_t preempt_mode;  /* See PREEMPT_MODE_* in slurm/slurm.h */
 
194
        uint16_t priority;      /* scheduling priority for jobs */
 
195
        bool     root_only_flag;/* 1 if allocate/submit RPC can only be
 
196
                                   issued by user root */
 
197
        uint16_t state_up;      /* for states see PARTITION_* in slurm.h */
 
198
        uint32_t total_nodes;   /* total number of nodes in the partition */
 
199
        uint32_t total_cpus;    /* total number of cpus in the partition */
 
200
} slurm_conf_partition_t;
 
201
 
 
202
typedef struct slurm_conf_downnodes {
 
203
        char *nodenames;
 
204
        char *reason;
 
205
        char *state;
 
206
} slurm_conf_downnodes_t;
 
207
 
 
208
typedef struct {
 
209
        char *name;
 
210
        char *value;
 
211
} config_key_pair_t;
 
212
 
 
213
/*
 
214
 * slurm_conf_init - load the slurm configuration from the a file.
 
215
 * IN file_name - name of the slurm configuration file to be read
 
216
 *      If file_name is NULL, then this routine tries to use
 
217
 *      the value in the SLURM_CONF env variable.  Failing that,
 
218
 *      it uses the compiled-in default file name.
 
219
 *      If the conf structures have already been initialized by a call to
 
220
 *      slurm_conf_init, any subsequent calls will do nothing until
 
221
 *      slurm_conf_destroy is called.
 
222
 * RET SLURM_SUCCESS if conf file is initialized.  If the slurm conf
 
223
 *       was already initialied, return SLURM_ERROR.
 
224
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
225
 */
 
226
extern int slurm_conf_init(const char *file_name);
 
227
 
 
228
/*
 
229
 * slurm_conf_reinit - reload the slurm configuration from a file.
 
230
 * IN file_name - name of the slurm configuration file to be read
 
231
 *      If file_name is NULL, then this routine tries to use
 
232
 *      the value in the SLURM_CONF env variable.  Failing that,
 
233
 *      it uses the compiled-in default file name.
 
234
 *      Unlike slurm_conf_init, slurm_conf_reinit will always reread the
 
235
 *      file and reinitialize the configuration structures.
 
236
 * RET SLURM_SUCCESS if conf file is reinitialized, otherwise SLURM_ERROR.
 
237
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
238
 */
 
239
extern int slurm_conf_reinit(const char *file_name);
 
240
 
 
241
/*
 
242
 * slurm_conf_mutex_init - init the slurm_conf mutex
 
243
 */
 
244
extern void slurm_conf_mutex_init(void);
 
245
 
 
246
/* slurm_conf_install_fork_handlers
 
247
 * installs what to do with a fork with the conf mutex
 
248
 */
 
249
void slurm_conf_install_fork_handlers();
 
250
 
 
251
/*
 
252
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
253
 */
 
254
extern int slurm_conf_destroy(void);
 
255
 
 
256
extern slurm_ctl_conf_t *slurm_conf_lock(void);
 
257
 
 
258
extern void slurm_conf_unlock(void);
 
259
 
 
260
/*
 
261
 * Set "ptr_array" with the pointer to an array of pointers to
 
262
 * slurm_conf_node_t structures.
 
263
 *
 
264
 * Return value is the length of the array.
 
265
 */
 
266
extern int slurm_conf_nodename_array(slurm_conf_node_t **ptr_array[]);
 
267
 
 
268
/*
 
269
 * Set "ptr_array" with the pointer to an array of pointers to
 
270
 * slurm_conf_partition_t structures.
 
271
 *
 
272
 * Return value is the length of the array.
 
273
 */
 
274
extern int slurm_conf_partition_array(slurm_conf_partition_t **ptr_array[]);
 
275
 
 
276
/*
 
277
 * Set "ptr_array" with the pointer to an array of pointers to
 
278
 * slurm_conf_downnodes_t structures.
 
279
 *
 
280
 * Return value is the length of the array.
 
281
 */
 
282
extern int slurm_conf_downnodes_array(slurm_conf_downnodes_t **ptr_array[]);
 
283
 
 
284
/*
 
285
 * slurm_conf_get_hostname - Return the NodeHostname for given NodeName
 
286
 *
 
287
 * Returned string was allocated with xmalloc(), and must be freed by
 
288
 * the caller using xfree().
 
289
 *
 
290
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
291
 */
 
292
extern char *slurm_conf_get_hostname(const char *node_name);
 
293
 
 
294
/*
 
295
 * slurm_conf_get_nodename - Return the NodeName for given NodeHostname
 
296
 *
 
297
 * NOTE: Call xfree() to release returned value's memory.
 
298
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
299
 */
 
300
extern char *slurm_conf_get_nodename(const char *node_hostname);
 
301
 
 
302
/*
 
303
 * slurm_conf_get_aliases - Return all the nodes NodeName value
 
304
 * associated to a given NodeHostname (usefull in case of multiple-slurmd
 
305
 * to get the list of virtual nodes associated with a real node)
 
306
 *
 
307
 * NOTE: Call xfree() to release returned value's memory.
 
308
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
309
 */
 
310
extern char *slurm_conf_get_aliases(const char *node_hostname);
 
311
 
 
312
/*
 
313
 * slurm_conf_get_nodeaddr - Return the NodeAddr for given NodeHostname
 
314
 *
 
315
 * NOTE: Call xfree() to release returned value's memory.
 
316
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
317
 */
 
318
extern char *slurm_conf_get_nodeaddr(const char *node_hostname);
 
319
 
 
320
/*
 
321
 * slurm_conf_get_aliased_nodename - Return the NodeName matching an alias
 
322
 * of the local hostname
 
323
 *
 
324
 * Returned string was allocated with xmalloc(), and must be freed by
 
325
 * the caller using xfree().
 
326
 *
 
327
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
328
 */
 
329
extern char *slurm_conf_get_aliased_nodename(void);
 
330
 
 
331
/*
 
332
 * slurm_conf_get_port - Return the port for a given NodeName
 
333
 *
 
334
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
335
 */
 
336
extern uint16_t slurm_conf_get_port(const char *node_name);
 
337
 
 
338
/*
 
339
 * slurm_conf_get_addr - Return the slurm_addr_t for a given NodeName in
 
340
 *      the parameter "address".  The return code is SLURM_SUCCESS on success,
 
341
 *      and SLURM_FAILURE if the address lookup failed.
 
342
 *
 
343
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
344
 */
 
345
extern int slurm_conf_get_addr(const char *node_name, slurm_addr_t *address);
 
346
 
 
347
/*
 
348
 * slurm_conf_get_cpus_sct -
 
349
 * Return the cpus, sockets, cores, and threads configured for a given NodeName
 
350
 * Returns SLURM_SUCCESS on success, SLURM_FAILURE on failure.
 
351
 *
 
352
 * NOTE: Caller must NOT be holding slurm_conf_lock().
 
353
 */
 
354
extern int slurm_conf_get_cpus_sct(const char *node_name,
 
355
                                   uint16_t *procs, uint16_t *sockets,
 
356
                                   uint16_t *cores, uint16_t *threads);
 
357
 
 
358
/*
 
359
 * init_slurm_conf - initialize or re-initialize the slurm configuration
 
360
 *      values defaults (NULL or NO_VAL). Note that the configuration
 
361
 *      file pathname (slurm_conf) is not changed.
 
362
 * IN/OUT ctl_conf_ptr - pointer to data structure to be initialized
 
363
 */
 
364
extern void init_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr);
 
365
 
 
366
/*
 
367
 * free_slurm_conf - free all storage associated with a slurm_ctl_conf_t.
 
368
 * IN/OUT ctl_conf_ptr - pointer to data structure to be freed
 
369
 * IN purge_node_hash - purge system-wide node hash table if set,
 
370
 *                      set to zero if clearing private copy of config data
 
371
 */
 
372
extern void free_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr,
 
373
                             bool purge_node_hash);
 
374
 
 
375
/*
 
376
 * gethostname_short - equivalent to gethostname(), but return only the first
 
377
 *      component of the fully qualified name (e.g. "linux123.foo.bar"
 
378
 *      becomes "linux123")
 
379
 * NOTE: NodeName in the config may be different from real hostname.
 
380
 *       Use get_conf_node_name() to get the former.
 
381
 */
 
382
extern int gethostname_short (char *name, size_t len);
 
383
 
 
384
/*
 
385
 * Replace first "%h" in path string with NodeHostname.
 
386
 * Replace first "%n" in path string with NodeName.
 
387
 *
 
388
 * NOTE: Caller should be holding slurm_conf_lock() when calling this function.
 
389
 *
 
390
 * Returns an xmalloc()ed string which the caller must free with xfree().
 
391
 */
 
392
extern char *slurm_conf_expand_slurmd_path(const char *path,
 
393
                                           const char *node_name);
 
394
 
 
395
/*
 
396
 * debug_flags2str - convert a DebugFlags uint32_t to the equivalent string
 
397
 * Returns an xmalloc()ed string which the caller must free with xfree().
 
398
 */
 
399
extern char *debug_flags2str(uint32_t debug_flags);
 
400
 
 
401
/*
 
402
 * debug_str2flags - Convert a DebugFlags string to the equivalent uint32_t
 
403
 * Returns NO_VAL if invalid
 
404
 */
 
405
extern uint32_t debug_str2flags(char *debug_flags);
 
406
 
 
407
extern void destroy_config_key_pair(void *object);
 
408
extern void pack_config_key_pair(void *in, uint16_t rpc_version, Buf buffer);
 
409
extern int unpack_config_key_pair(void **object, uint16_t rpc_version,
 
410
                                  Buf buffer);
 
411
extern int sort_key_pairs(config_key_pair_t *key_a, config_key_pair_t *key_b);
 
412
 
 
413
 
 
414
#endif /* !_READ_CONFIG_H */