Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
datascience
balsamDEPRECATED
Commits
79ee2cb5
Commit
79ee2cb5
authored
Oct 13, 2017
by
Thomas Uram
Browse files
Add -y argument to skip prompt; Fix balsam_job_id/job_id duality
parent
57f2b925
Changes
1
Hide whitespace changes
Inline
Side-by-side
balsam/management/commands/balsam_add_job.py
View file @
79ee2cb5
...
...
@@ -25,6 +25,7 @@ class Command(BaseCommand):
parser
.
add_argument
(
'-i'
,
'--input-url'
,
dest
=
'input_url'
,
type
=
str
,
help
=
'Input URL from which input files are copied.'
,
required
=
False
,
default
=
''
)
parser
.
add_argument
(
'-o'
,
'--output-url'
,
dest
=
'output_url'
,
type
=
str
,
help
=
'Output URL to which output files are copied.'
,
required
=
False
,
default
=
''
)
parser
.
add_argument
(
'-y'
,
dest
=
'yes'
,
help
=
'Skip prompt confirming job details.'
,
required
=
False
,
action
=
'store_true'
)
def
handle
(
self
,
*
args
,
**
options
):
logger
.
info
(
' Adding BalsamJob to DB:'
)
...
...
@@ -41,15 +42,18 @@ class Command(BaseCommand):
logger
.
info
(
' config file = '
+
options
[
'config_file'
])
logger
.
info
(
' input url = '
+
options
[
'input_url'
])
logger
.
info
(
' output url = '
+
options
[
'output_url'
])
answer
=
str
(
raw_input
(
' Enter "yes" to continue:'
))
if
options
[
'yes'
]:
answer
=
'yes'
else
:
answer
=
str
(
raw_input
(
' Enter "yes" to continue:'
))
if
answer
==
'yes'
:
app
=
models
.
ApplicationDefinition
.
objects
.
get
(
name
=
options
[
'application'
])
if
app
is
None
:
logger
.
error
(
' Application "'
+
options
[
'application'
]
+
'" does not exist in database, failed to add job to DB.'
)
return
job
=
models
.
BalsamJob
()
job
.
balsam_
job_id
=
models
.
BalsamJob
.
generate_job_id
()
job
.
working_directory
=
models
.
BalsamJob
.
create_working_path
(
job
.
balsam_
job_id
)
job
.
job_id
=
models
.
BalsamJob
.
generate_job_id
()
job
.
working_directory
=
models
.
BalsamJob
.
create_working_path
(
job
.
job_id
)
job
.
site
=
settings
.
BALSAM_SITE
job
.
job_name
=
options
[
'name'
]
job
.
job_description
=
options
[
'description'
]
...
...
@@ -67,7 +71,7 @@ class Command(BaseCommand):
job
.
save
()
logger
.
info
(
'BalsamJob Added to DB'
)
logger
.
info
(
' pk = '
+
str
(
app
.
pk
))
logger
.
info
(
' balsam id = '
+
str
(
job
.
balsam_
job_id
))
logger
.
info
(
' balsam id = '
+
str
(
job
.
job_id
))
logger
.
info
(
' working directory = '
+
job
.
working_directory
)
else
:
logger
.
info
(
'Application not added to DB'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment