Skip to content
Snippets Groups Projects
Commit 435924fa authored by Yves Noirjean's avatar Yves Noirjean
Browse files

obis: renamed object_id to sample_id - in the future we will also support experiments

parent eb485041
No related branches found
No related tags found
No related merge requests found
{"data_set_type": "DS_TYPE", "object_id": "/SAMPLE/ID", "openbis_url": "http://localhost:8888"} {"data_set_type": "DS_TYPE", "sample_id": "/SAMPLE/ID", "openbis_url": "http://localhost:8888"}
\ No newline at end of file \ No newline at end of file
{"data_set_id": "20170814175159563859-9212", "data_set_type": "DS_TYPE", "object_id": "/SAMPLE/ID", "openbis_url": "http://localhost:8888"} {"data_set_id": "20170814175159563859-9212", "data_set_type": "DS_TYPE", "sample_id": "/SAMPLE/ID", "openbis_url": "http://localhost:8888"}
\ No newline at end of file \ No newline at end of file
...@@ -88,7 +88,7 @@ class ConfigEnv(object): ...@@ -88,7 +88,7 @@ class ConfigEnv(object):
self.add_param(ConfigParam(name='verify_certificates', private=True, is_json=True)) self.add_param(ConfigParam(name='verify_certificates', private=True, is_json=True))
self.add_param(ConfigParam(name='external_dms_id', private=True)) self.add_param(ConfigParam(name='external_dms_id', private=True))
self.add_param(ConfigParam(name='repository_id', private=True)) self.add_param(ConfigParam(name='repository_id', private=True))
self.add_param(ConfigParam(name='object_id', private=False)) self.add_param(ConfigParam(name='sample_id', private=False))
self.add_param(ConfigParam(name='data_set_id', private=False)) self.add_param(ConfigParam(name='data_set_id', private=False))
self.add_param(ConfigParam(name='data_set_type', private=False)) self.add_param(ConfigParam(name='data_set_type', private=False))
self.add_param(ConfigParam(name='data_set_properties', private=False, is_json=True)) self.add_param(ConfigParam(name='data_set_properties', private=False, is_json=True))
......
...@@ -414,8 +414,8 @@ class OpenbisSync(object): ...@@ -414,8 +414,8 @@ class OpenbisSync(object):
def data_set_properties(self): def data_set_properties(self):
return self.config_dict.get('data_set_properties') return self.config_dict.get('data_set_properties')
def object_id(self): def sample_id(self):
return self.config_dict.get('object_id') return self.config_dict.get('sample_id')
def check_configuration(self): def check_configuration(self):
missing_config_settings = [] missing_config_settings = []
...@@ -425,8 +425,8 @@ class OpenbisSync(object): ...@@ -425,8 +425,8 @@ class OpenbisSync(object):
missing_config_settings.append('user') missing_config_settings.append('user')
if self.data_set_type() is None: if self.data_set_type() is None:
missing_config_settings.append('data_set_type') missing_config_settings.append('data_set_type')
if self.object_id() is None: if self.sample_id() is None:
missing_config_settings.append('object_id') missing_config_settings.append('sample_id')
if len(missing_config_settings) > 0: if len(missing_config_settings) > 0:
return CommandResult(returncode=-1, return CommandResult(returncode=-1,
output="Missing configuration settings for {}.".format(missing_config_settings)) output="Missing configuration settings for {}.".format(missing_config_settings))
...@@ -497,11 +497,11 @@ class OpenbisSync(object): ...@@ -497,11 +497,11 @@ class OpenbisSync(object):
if result.failure(): if result.failure():
return result return result
commit_id = result.output commit_id = result.output
object_id = self.object_id() sample_id = self.sample_id()
contents = GitRepoFileInfo(self.git_wrapper).contents() contents = GitRepoFileInfo(self.git_wrapper).contents()
try: try:
data_set = self.openbis.new_git_data_set(data_set_type, top_level_path, commit_id, repository_id, external_dms.code, data_set = self.openbis.new_git_data_set(data_set_type, top_level_path, commit_id, repository_id, external_dms.code,
object_id, data_set_code=data_set_code, parents=parent_data_set_id, sample_id, data_set_code=data_set_code, parents=parent_data_set_id,
properties=properties, contents=contents) properties=properties, contents=contents)
return CommandResult(returncode=0, output=""), data_set return CommandResult(returncode=0, output=""), data_set
except ValueError as e: except ValueError as e:
......
...@@ -213,7 +213,7 @@ def set_registration_configuration(dm, properties=None): ...@@ -213,7 +213,7 @@ def set_registration_configuration(dm, properties=None):
resolver.set_value_for_parameter('openbis_url', "http://localhost:8888", 'local') resolver.set_value_for_parameter('openbis_url', "http://localhost:8888", 'local')
resolver.set_value_for_parameter('user', "auser", 'local') resolver.set_value_for_parameter('user', "auser", 'local')
resolver.set_value_for_parameter('data_set_type', "DS_TYPE", 'local') resolver.set_value_for_parameter('data_set_type', "DS_TYPE", 'local')
resolver.set_value_for_parameter('object_id', "/SAMPLE/ID", 'local') resolver.set_value_for_parameter('sample_id', "/SAMPLE/ID", 'local')
if properties is not None: if properties is not None:
resolver.set_value_for_parameter('data_set_properties', properties, 'local') resolver.set_value_for_parameter('data_set_properties', properties, 'local')
......
...@@ -131,36 +131,36 @@ def set_property(data_mgmt, prop, value, is_global): ...@@ -131,36 +131,36 @@ def set_property(data_mgmt, prop, value, is_global):
return CommandResult(returncode=0, output="") return CommandResult(returncode=0, output="")
def init_data_impl(ctx, object_id, folder, name): def init_data_impl(ctx, sample_id, folder, name):
"""Shared implementation for the init_data command.""" """Shared implementation for the init_data command."""
click_echo("init_data {}".format(folder)) click_echo("init_data {}".format(folder))
data_mgmt = shared_data_mgmt(ctx.obj) data_mgmt = shared_data_mgmt(ctx.obj)
name = name if name != "" else None name = name if name != "" else None
result = data_mgmt.init_data(folder, name, create=True) result = data_mgmt.init_data(folder, name, create=True)
if not object_id or result.failure(): if not sample_id or result.failure():
return check_result("init_data", result) return check_result("init_data", result)
with dm.cd(folder): with dm.cd(folder):
return check_result("init_data", set_property(data_mgmt, 'object_id', object_id, False)) return check_result("init_data", set_property(data_mgmt, 'sample_id', sample_id, False))
@cli.command() @cli.command()
@click.pass_context @click.pass_context
@click.option('-o', '--object_id', help='Set the id of the owning object.') @click.option('-o', '--sample_id', help='Set the id of the owning object.')
@click.argument('folder', type=click.Path(exists=False, file_okay=False)) @click.argument('folder', type=click.Path(exists=False, file_okay=False))
@click.argument('name', default="") @click.argument('name', default="")
def init(ctx, object_id, folder, name): def init(ctx, sample_id, folder, name):
"""Initialize the folder as a data folder (alias for init_data).""" """Initialize the folder as a data folder (alias for init_data)."""
return init_data_impl(ctx, object_id, folder, name) return init_data_impl(ctx, sample_id, folder, name)
@cli.command() @cli.command()
@click.pass_context @click.pass_context
@click.option('-o', '--object_id', help='Set the id of the owning object.') @click.option('-o', '--sample_id', help='Set the id of the owning object.')
@click.argument('folder', type=click.Path(exists=False, file_okay=False)) @click.argument('folder', type=click.Path(exists=False, file_okay=False))
@click.argument('name', default="") @click.argument('name', default="")
def init_data(ctx, object_id, folder, name): def init_data(ctx, sample_id, folder, name):
"""Initialize the folder as a data folder.""" """Initialize the folder as a data folder."""
return init_data_impl(ctx, object_id, folder, name) return init_data_impl(ctx, sample_id, folder, name)
@cli.command() @cli.command()
......
...@@ -64,9 +64,9 @@ Now create a file and put some content into it. E.g., ...@@ -64,9 +64,9 @@ Now create a file and put some content into it. E.g.,
vi info.txt vi info.txt
When finished, we need to set the object_id this data set should be associated with. Then we can commit it. When finished, we need to set the sample_id this data set should be associated with. Then we can commit it.
obis config object_id /DEMO/BIGDATA obis config sample_id /DEMO/BIGDATA
obis commit -m"Initial data commit." obis commit -m"Initial data commit."
Log into the sprint server https://sprint-openbis.ethz.ch:8446 and go to the sample /DEMO/BIGDATA. You should see the newly registered data set there. You can take a look at it and see file metadata for its contents. Log into the sprint server https://sprint-openbis.ethz.ch:8446 and go to the sample /DEMO/BIGDATA. You should see the newly registered data set there. You can take a look at it and see file metadata for its contents.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment