Skip to content

if arg is required then cannot run from param file #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
doutriaux1 opened this issue Apr 12, 2018 · 0 comments
Open

if arg is required then cannot run from param file #32

doutriaux1 opened this issue Apr 12, 2018 · 0 comments
Assignees

Comments

@doutriaux1
Copy link
Contributor

script

from __future__ import print_function
import cdp

parser = cdp.cdp_parser.CDPParser()

parser.add_argument("-a","--Aarg",default=7,help="A value",required=True)
parser.add_argument("-b","--Barg",default=8,help="A value")
parser.add_argument("-c","--Carg",default=9,help="A value")
parser.add_argument("-d","--Darg",default=6,help="A value")


P = parser.get_parameters()[0]

print("A:",P.Aarg)
print("B:",P.Barg)
print("C:",P.Carg)
print("D:",P.Darg)

myparam.py

Aarg=10
Barg=11
Carg=12
Darg=13

runnnig with -p myparam:

doutriaux1@crunchy:[~]:[20530]> python test_cdp_param.py -p myparam.py 
usage: test_cdp_param.py [-h] [-p PARAMETERS]
                         [--diags OTHER_PARAMETERS [OTHER_PARAMETERS ...]]
                         [-n NUM_WORKERS] [--scheduler_addr SCHEDULER_ADDR]
                         [-g GRANULATE [GRANULATE ...]] -a AARG [-b BARG]
                         [-c CARG] [-d DARG]
test_cdp_param.py: error: the following arguments are required: -a/--Aarg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants