qbatch icon indicating copy to clipboard operation
qbatch copied to clipboard

Re-implement command-line parameters and environment variables as ConfigArgParse interface

Open gdevenyi opened this issue 8 years ago • 9 comments

Right now we allow defaults via the environment.

@andrewjankie makes a passing mention of config file defaults

gdevenyi avatar May 12 '16 02:05 gdevenyi

Hm.. Needlessly complex? What was the use case you had in mind?

Either way, we definitely still want configuration via environment variables so that we can use qbatch with environment-modules.

pipitone avatar May 12 '16 02:05 pipitone

Just kinda worried about the proliferation of environment variables.

I'm just thinking about how to handle all cases of defaults for the "I don't want to type this every day" type

gdevenyi avatar May 12 '16 02:05 gdevenyi

If we ever do consider it https://docs.python.org/2/library/configparser.html

gdevenyi avatar May 12 '16 02:05 gdevenyi

As an alternative to "environment-variables" support, we could do what pydpiper does, which is define a "default" config file via an ENV var. This would reduce the env var set to one.

gdevenyi avatar Jun 08 '16 21:06 gdevenyi

And so in the environment-modules file you could do something like:

set-env  QBATCH_CONFIG  /quarantine/qbatch/1.01/build/config

I'm okay with that. I also don't see a compelling case to change from using environment variables. What do you have in mind?

pipitone avatar Jun 09 '16 01:06 pipitone

I can see a case for allowing 'most' of our command line arguments to have settable defaults. This presents an explosion of environment variables. If future options come this could continue.

A config file would collapse all these info one, and allow for documentation of options inside the config file.

gdevenyi avatar Jun 09 '16 01:06 gdevenyi

Right, I see what you mean. I'm weirdly attached to the convenience of env variables but no matter... config file does the trick nicely.

pipitone avatar Jun 10 '16 12:06 pipitone

It'll be a fairly big piece of work to transform all our options to configparser so I'll stick a "sometime" on this.

gdevenyi avatar Jun 10 '16 13:06 gdevenyi

Looks like ConfigArgParse is ideal.

Mostly drop-in replacement for ArgParse, with config file and environment variable features in one set: https://github.com/bw2/ConfigArgParse

gdevenyi avatar Aug 13 '16 20:08 gdevenyi