Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
7ee78564
Commit
7ee78564
authored
7 years ago
by
Yves Noirjean
Browse files
Options
Downloads
Patches
Plain Diff
obis: added option to set experiment id when obis init
parent
d28606d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/python/OBis/obis/scripts/cli.py
+15
-11
15 additions, 11 deletions
src/python/OBis/obis/scripts/cli.py
with
15 additions
and
11 deletions
src/python/OBis/obis/scripts/cli.py
+
15
−
11
View file @
7ee78564
...
...
@@ -131,37 +131,41 @@ def set_property(data_mgmt, prop, value, is_global):
return
CommandResult
(
returncode
=
0
,
output
=
""
)
def
init_data_impl
(
ctx
,
sample_id
,
folder
,
name
):
def
init_data_impl
(
ctx
,
sample_id
,
experiment_id
,
folder
,
name
):
"""
Shared implementation for the init_data command.
"""
click_echo
(
"
init_data {}
"
.
format
(
folder
))
data_mgmt
=
shared_data_mgmt
(
ctx
.
obj
)
name
=
name
if
name
!=
""
else
None
result
=
data_mgmt
.
init_data
(
folder
,
name
,
create
=
True
)
if
not
sample_id
or
result
.
failure
():
if
(
not
sample_id
and
not
experiment_id
)
or
result
.
failure
():
return
check_result
(
"
init_data
"
,
result
)
with
dm
.
cd
(
folder
):
return
check_result
(
"
init_data
"
,
set_property
(
data_mgmt
,
'
sample_id
'
,
sample_id
,
False
))
if
sample_id
:
return
check_result
(
"
init_data
"
,
set_property
(
data_mgmt
,
'
sample_id
'
,
sample_id
,
False
))
if
experiment_id
:
return
check_result
(
"
init_data
"
,
set_property
(
data_mgmt
,
'
experiment_id
'
,
experiment_id
,
False
))
# TODO test and add param for experiment
@cli.command
()
@click.pass_context
@click.option
(
'
-o
'
,
'
--sample_id
'
,
help
=
'
Set the id of the owning object.
'
)
@click.option
(
'
-si
'
,
'
--sample_id
'
,
help
=
'
Set the id of the owning sample.
'
)
@click.option
(
'
-ei
'
,
'
--experiment_id
'
,
help
=
'
Set the id of the owning experiment.
'
)
@click.argument
(
'
folder
'
,
type
=
click
.
Path
(
exists
=
False
,
file_okay
=
False
))
@click.argument
(
'
name
'
,
default
=
""
)
def
init
(
ctx
,
sample_id
,
folder
,
name
):
def
init
(
ctx
,
sample_id
,
experiment_id
,
folder
,
name
):
"""
Initialize the folder as a data folder (alias for init_data).
"""
return
init_data_impl
(
ctx
,
sample_id
,
folder
,
name
)
return
init_data_impl
(
ctx
,
sample_id
,
experiment_id
,
folder
,
name
)
# TODO test and add param for experiment
@cli.command
()
@click.pass_context
@click.option
(
'
-o
'
,
'
--sample_id
'
,
help
=
'
Set the id of the owning object.
'
)
@click.option
(
'
-si
'
,
'
--sample_id
'
,
help
=
'
Set the id of the owning sample.
'
)
@click.option
(
'
-ei
'
,
'
--experiment_id
'
,
help
=
'
Set the id of the owning experiment.
'
)
@click.argument
(
'
folder
'
,
type
=
click
.
Path
(
exists
=
False
,
file_okay
=
False
))
@click.argument
(
'
name
'
,
default
=
""
)
def
init_data
(
ctx
,
sample_id
,
folder
,
name
):
def
init_data
(
ctx
,
sample_id
,
experiment_id
,
folder
,
name
):
"""
Initialize the folder as a data folder.
"""
return
init_data_impl
(
ctx
,
sample_id
,
folder
,
name
)
return
init_data_impl
(
ctx
,
sample_id
,
experiment_id
,
folder
,
name
)
@cli.command
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment