@@ -66,9 +66,12 @@ def main():
66
66
print ('run usage: %s' % run_usage (prog ))
67
67
sys .exit (not args )
68
68
params = {}
69
+ skip_arg_processing = False
69
70
while args :
70
71
opt = args .pop (0 )
71
- if opt .startswith ('--' ):
72
+ if opt == '-' :
73
+ skip_arg_processing = True
74
+ elif opt .startswith ('--' ) and not skip_arg_processing :
72
75
param = opt [2 :]
73
76
if param in ['script' , 'python' , 'conda' , 'ignoreFiles' , 'apiKey' , 'container' , 'machineType' , 'name' ,
74
77
'project' , 'projectId' , 'command' , 'workspace' , 'dataset' , 'registryUsername' , 'registryPassword' ,
@@ -91,18 +94,19 @@ def main():
91
94
print ('error: invalid option: %s' % opt )
92
95
print ('usage: %s' % run_usage (prog ))
93
96
sys .exit (1 )
94
- elif opt == '-m' :
95
- params ['module' ] = True
97
+ elif opt == '-m' and not skip_arg_processing :
98
+ params ['run_module' ] = True
99
+ skip_arg_processing = True
100
+ elif opt == '-c' and not skip_arg_processing :
101
+ params ['run_command' ] = True
102
+ skip_arg_processing = True
96
103
elif 'script' not in params :
97
104
params ['script' ] = opt
98
105
else :
99
106
if 'script_args' not in params :
100
107
params ['script_args' ] = [opt ]
101
108
else :
102
109
params ['script_args' ].append (opt )
103
- if 'script' not in params :
104
- print ('usage: %s' % run_usage (prog ))
105
- sys .exit (1 )
106
110
res = run (params )
107
111
if 'error' in res :
108
112
print_json_pretty (res )
@@ -127,16 +131,17 @@ def apikey_usage(prog):
127
131
128
132
129
133
def run_usage (prog ):
130
- return format ('%s run [-m] <python_script.py>\n '
134
+ return format ('%s run [options] [[-m] <script> [args] | -c "python code" | --command "shell cmd"]\n '
135
+ ' options:\n '
131
136
' [--python 2|3]\n '
132
137
' [--init [<init.sh>]]\n '
133
138
' [--pipenv]\n '
134
139
' [--req [<requirements.txt>]]\n '
135
140
' [--workspace .|<workspace_path>]\n '
136
- ' [--ignoreFiles "<file-or-dir>,<file-or-dir>, ..."]\n '
137
- ' [other jobs create options... ]\n '
141
+ ' [--ignoreFiles "<file-or-dir>,..."]\n '
142
+ ' [jobs create options]\n '
138
143
' [--dryrun]\n '
139
- ' [script args ]' % prog )
144
+ ' [- ]' % prog )
140
145
141
146
142
147
def usage (prog ):
0 commit comments