Great! Thanks Moe. 

Sent from my iPhone

On May 27, 2011, at 1:19 PM, "Jette, Moe" <[email protected]> wrote:

> Thanks Aaron. This will be in SLURM version 2.2.6.
> ________________________________________
> From: [email protected] [[email protected]] On 
> Behalf Of Aaron Knister [[email protected]]
> Sent: Friday, May 27, 2011 7:42 AM
> To: slurm-dev
> Subject: [slurm-dev] SQUEUE_FORMAT env variable
> 
> We're getting ready to implement multifactor priorities and resource limits 
> with QOS. We felt it would be helpful to our users to display the qos for 
> each job in the output of squeue. The easiest way to do this seemed to be to 
> set the SQUEUE_FORMAT environment variable. I noticed that after one sets the 
> SQUEUE_FORMAT variable, the -l and -s options no-longer work which is 
> undesirable for us. This seems to be because SQUEUE_FORMAT has the same 
> effect as providing the -o option on the command line which overrides -l and 
> -s.
> 
> I've written a patch that moves the SQUEUE_FORMAT env var parsing logic after 
> the opt parsing logic in squeue/opts.c and uses an internal flag which if set 
> by the -l, -o or -s options will prevent the format string from being defined 
> as the value of $SQUEUE_FORMAT, thus allowing -l or -s (as well as -o as 
> expected) to override SQUEUE_FORMAT.
> 
> I'm interested in any feedback about the patches (good, bad, other 
> approaches).
> 
> Here's a link to the patch for the 2.1 series:
> http://userpages.umbc.edu/~aaronk/slurm/patches/squeue_format_env_override_slurm21.patch
> and the 2.2 series:
> http://userpages.umbc.edu/~aaronk/slurm/patches/squeue_format_env_override_slurm22.patch
> 
> I've included the patch for 2.2 below, but included the links above in case 
> gmail converts the taps to spaces.
> 
> Thanks!
> 
> -Aaron
> 
> --- opts.c.orig 2011-05-26 22:33:51.000000000 -0400
> +++ opts.c      2011-05-26 22:39:30.000000000 -0400
> @@ -93,6 +93,7 @@
> parse_command_line( int argc, char* argv[] )
> {
>        char *env_val = NULL;
> +       bool override_format_env = false;
>        int opt_char;
>        int option_index;
>        static struct option long_options[] = {
> @@ -125,8 +126,6 @@
> 
>        if (getenv("SQUEUE_ALL"))
>                params.all_flag = true;
> -       if ( ( env_val = getenv("SQUEUE_FORMAT") ) )
> -               params.format = xstrdup(env_val);
>        if ( ( env_val = getenv("SQUEUE_SORT") ) )
>                params.sort = xstrdup(env_val);
>        if ( ( env_val = getenv("SLURM_CLUSTERS") ) ) {
> @@ -176,6 +175,7 @@
>                        break;
>                case (int) 'l':
>                        params.long_list = true;
> +                       override_format_env = true;
>                        break;
>                case (int) 'M':
>                        if (params.clusters)
> @@ -202,6 +202,7 @@
>                case (int) 'o':
>                        xfree(params.format);
>                        params.format = xstrdup(optarg);
> +                       override_format_env = true;
>                        break;
>                case (int) 'p':
>                        xfree(params.partitions);
> @@ -223,6 +224,7 @@
>                                        _build_step_list(params.steps);
>                        }
>                        params.step_flag = true;
> +                       override_format_env = true;
>                        break;
>                case (int) 'S':
>                        xfree(params.sort);
> @@ -261,6 +263,10 @@
>                }
>        }
> 
> +       if ( override_format_env == false )
> +               if ( ( env_val = getenv("SQUEUE_FORMAT") ) )
> +                       params.format = xstrdup(env_val);
> +
>        params.cluster_flags = slurmdb_setup_cluster_flags();
>        if (optind < argc) {
>                if (params.job_flag) {
> 
> 
> 

Reply via email to