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
763e54d3
Commit
763e54d3
authored
8 years ago
by
Chandrasekhar Ramakrishnan
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-3554: Templates for methods in the interface. Implementation still needs to be filled out.
parent
40a737d0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/python/pybis/pybis.py
+49
-2
49 additions, 2 deletions
src/python/pybis/pybis.py
with
49 additions
and
2 deletions
src/python/pybis/pybis.py
+
49
−
2
View file @
763e54d3
...
...
@@ -16,7 +16,7 @@ import os
class
OpenbisCredentials
:
"""
Credentials for communicating with openBIS.
"""
def
__init__
(
self
,
token
=
None
,
uname_and_pass
=
None
):
def
__init__
(
self
,
token
=
None
,
uname_and_pass
=
None
):
"""
A connection can be authenticated either by a token or a username and password combination
:param token: An authentication token for openBIS, can be None.
:param uname_and_pass: A tuple with username and password, in that order.
...
...
@@ -90,8 +90,55 @@ class Openbis:
def
login
(
self
):
"""
Log into openBIS.
Expects credentials with username and password and updates the token on the credentials object.
Clients may want to store the credentials object in a credentials store after successful login.
Throw a ValueError with the error message if login failed.
"""
if
not
self
.
credentials
.
has_username_and_password
:
raise
ValueError
(
'
Cannot log into openBIS without a username and password
'
)
# TODO Implement the logic of this method.
# TODO Implement the logic of this method.
def
is_token_valid
(
self
):
"""
Check if the connection to openBIS is valid.
This method is useful to check if a token is still valid or if it has timed out, requiring the
user to login again.
:return: Return True if the token is valid, False if it is not valid.
"""
if
not
self
.
credentials
.
has_token
():
return
False
# TODO Implement the logic of this method.
def
get_samples
(
self
,
sample_identifiers
):
"""
Retrieve metadata for the sample.
Get metadata for the sample and any directly connected parents of the sample to allow access
to the same information visible in the ELN UI. The metadata will be on the file system.
:param sample_identifiers: A list of sample identifiers to retrieve.
"""
pass
# TODO Implement the logic of this method
def
get_samples_with_data
(
self
,
sample_identifiers
):
"""
Retrieve metadata for the sample, like get_sample_metadata, but retrieve any data sets as well,
like get_data_set.
:param sample_identifiers: A list of sample identifiers to retrieve.
"""
pass
# TODO Implement the logic of this method
def
get_data_sets
(
self
,
data_set_identifiers
):
"""
Retrieve data set metadata and content.
The metadata will be on the file system. The file will also include the location of the data.
"""
pass
# TODO Implement the logic of this method
def
create_data_set_from_notebook
(
self
,
path_to_notebook
,
owner_identifier
,
paths_to_files
,
parent_identifiers
):
"""
Register a new data set with openBIS.
:param path_to_notebook: The path to the Jupyter notebook that created this data set
:param owner_identifier: The identifier of the sample that owns this data set.
:param paths_to_files: A list of paths to files that should be in the data set.
:param parent_identifiers: A list of parents for the data set.
:return:
"""
pass
# TODO Implement the logic of this method
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