pepkit / divvy

Standardized computing resource configuration
http://divvy.databio.org
BSD 2-Clause "Simplified" License
4 stars 2 forks source link

How to handle on-the-fly command line variables #50

Closed nsheff closed 3 years ago

nsheff commented 4 years ago

Right now any unknown args are just taken by divvy to populate template variables.

Should we instead use the --compute idea from looper so that you have to say:

--compute key=value,key2=val2 ?

Pros: explicit what's happening Cons: more verbose

nsheff commented 4 years ago

@stolarczyk what do you think? Just wondering if it makes sense to keep consistent with looper... or if for divvy we value the simplicity more

stolarczyk commented 4 years ago

I like the explicit approach more, but that's just slight preference

nsheff commented 4 years ago

follow-up question: why is it:

--compute k1=v1,k2=v2

instead of --compute k1=v1 k2=v2.

With the latter we could use the nargs="+" type and let argparser do the parsing; with the former we're having to parse it separately, within looper, right? is there a reason to do it that way?

stolarczyk commented 4 years ago

that's right, this is how it's done now. I just followed the way it was implemented. The new way would spare splitting by comma part, that's nice. Not sure if there is any reason to do it this way. I'll try to make it use argparser parsing. We could also set the metavar in the parser instead of putting it to the help:

parser.add_argument("--compute",
                        metavar="KEY=VALUE",
                        nargs='+', ...
nsheff commented 4 years ago

this is working for me now; try with:

divvy submit -p local -c code=ls
divvy write -p local -c code=ls