payu-org / payu

A workflow management tool for numerical models on the NCI computing systems
Apache License 2.0
18 stars 26 forks source link

payu init does not check for valid model #225

Open aidanheerdegen opened 4 years ago

aidanheerdegen commented 4 years ago

Maybe this isn't a bug, but

payu init --model blah

works

payu: warning: Configuration file config.yaml not found!
laboratory path:  /scratch/w35/aph502/blah
binary path:  /scratch/w35/aph502/blah/bin
input path:  /scratch/w35/aph502/blah/input
work path:  /scratch/w35/aph502/blah/work
archive path:  /scratch/w35/aph502/blah/archive

It would be simple to put in a check that the argument to --model is valid

from payu.models import index as model_index

if model not in model_index:
     sys.exit("Error in init: Unknown model type: {}".format(model))

would do the trick.

It isn't strictly against payu methodology to have a laboratory that isn't named for a model, but the argument to the option --model should be one I guess.

marshallward commented 4 years ago

I struggle to even find a real need for payu init, since most of those directories will be created at runtime. But otherwise sounds good.