blob: 7c38a6b8b3c34f0b24e300602e06fcc47c3ba3c1 [file] [log] [blame]
/*****************************************************************************\
* opt.h - definitions for srun option processing
* $Id$
*****************************************************************************
* Copyright (C) 2002-2006 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Mark Grondona <grondona1@llnl.gov>,
* Christopher J. Morrone <morrone2@llnl.gov>, et. al.
* UCRL-CODE-226842.
*
* This file is part of SLURM, a resource management program.
* For details, see <http://www.llnl.gov/linux/slurm/>.
*
* SLURM is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along
* with SLURM; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
\*****************************************************************************/
#ifndef _HAVE_OPT_H
#define _HAVE_OPT_H
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include "src/common/macros.h" /* true and false */
#include "src/common/env.h"
#define MAX_USERNAME 9
typedef struct sbatch_options {
char *progname; /* argv[0] of this program or */
/* batch script argv and argc, if provided on the command line */
int script_argc;
char **script_argv;
char user[MAX_USERNAME];/* local username */
uid_t uid; /* local uid */
gid_t gid; /* local gid */
uid_t euid; /* effective user --uid=user */
gid_t egid; /* effective group --gid=group */
char *cwd; /* current working directory */
int nprocs; /* --nprocs=n, -n n */
bool nprocs_set; /* true if nprocs explicitly set */
int cpus_per_task; /* --cpus-per-task=n, -c n */
bool cpus_set; /* true if cpus_per_task explicitly set */
int min_nodes; /* --nodes=n, -N n */
int max_nodes; /* --nodes=x-n, -N x-n */
bool nodes_set; /* true if nodes explicitly set */
int time_limit; /* --time, -t (int minutes) */
char *time_limit_str; /* --time, -t (string) */
char *partition; /* --partition=n, -p n */
char *job_name; /* --job-name=, -J name */
unsigned int jobid; /* --jobid=jobid */
bool jobid_set; /* true of jobid explicitly set */
char *mpi_type; /* --mpi=type */
unsigned int dependency;/* --dependency, -P jobid */
int nice; /* --nice */
char *account; /* --account, -U acct_name */
char *comment; /* --comment */
char *propagate; /* --propagate[=RLIMIT_CORE,...]*/
int immediate; /* -i, --immediate */
bool hold; /* --hold, -H */
bool no_kill; /* --no-kill, -k */
bool no_requeue; /* --no-requeue */
bool overcommit; /* --overcommit -O */
uint16_t shared; /* --share, -s */
char *distribution; /* --distribution=, -m dist */
char *network; /* --network= */
int quiet;
int verbose;
char *wrap;
/* constraint options */
int mincpus; /* --mincpus=n */
int minsockets; /* --minsockets=n */
int mincores; /* --mincores=n */
int minthreads; /* --minthreads=n */
int realmem; /* --mem=n */
long tmpdisk; /* --tmp=n */
int tasks_per_node; /* --tasks-per-node=n */
char *constraints; /* --constraints=, -C constraint*/
bool contiguous; /* --contiguous */
char *nodelist; /* --nodelist=node1,node2,... */
char *exc_nodes; /* --exclude=node1,node2,... -x */
/* BLUEGENE SPECIFIC */
uint16_t geometry[SYSTEM_DIMENSIONS]; /* --geometry, -g */
bool reboot; /* --reboot */
bool no_rotate; /* --no_rotate, -R */
uint16_t conn_type; /* --conn-type */
char *blrtsimage; /* --blrts-image BlrtsImage for block */
char *linuximage; /* --linux-image LinuxImage for block */
char *mloaderimage; /* --mloader-image mloaderImage for block */
char *ramdiskimage; /* --ramdisk-image RamDiskImage for block */
/*********************/
time_t begin; /* --begin */
uint16_t mail_type; /* --mail-type */
char *mail_user; /* --mail-user */
char *ifname; /* input file name */
char *ofname; /* output file name */
char *efname; /* error file name */
int get_user_env_time; /* --get-user-env[=timeout] */
int get_user_env_mode; /* --get-user-env=[S|L] */
} opt_t;
extern opt_t opt;
/*
* process_options_first_pass()
*
* In this first pass we only look at the command line options, and we
* will only handle a few options (help, usage, quiet, verbose, version),
* and look for the script name and arguments (if provided).
*
* We will parse the environment variable options, batch script options,
* and all of the rest of the command line options in
* process_options_second_pass().
*
* Return a pointer to the batch script file name if provided on the command
* line, otherwise return NULL (in which case the script will need to be read
* from standard input).
*/
char *process_options_first_pass(int argc, char **argv);
/* process options:
* 1. update options with option set in the script
* 2. update options with env vars
* 3. update options with commandline args
* 4. perform some verification that options are reasonable
*/
int process_options_second_pass(int argc, char *argv[],
const void *script_body, int script_size);
#endif /* _HAVE_OPT_H */