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
704f5cef
Commit
704f5cef
authored
2 years ago
by
Swen Vermeul
Browse files
Options
Downloads
Patches
Plain Diff
feat: add cli to download datasets
parent
0b87a793
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!40
SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pybis/src/python/pybis/cli.py
+0
-59
0 additions, 59 deletions
pybis/src/python/pybis/cli.py
with
0 additions
and
59 deletions
pybis/src/python/pybis/cli.py
+
0
−
59
View file @
704f5cef
import
os
<<<<<<<
HEAD
import
syslog
from
datetime
import
datetime
...
...
@@ -10,13 +9,6 @@ from tabulate import tabulate
from
.
import
pybis
syslog
.
openlog
(
"
pyBIS
"
)
=======
import
click
from
tabulate
import
tabulate
from
.
import
pybis
from
datetime
import
datetime
from
dateutil.relativedelta
import
relativedelta
>>>>>>>
033729
a6ad
(
add
cli
)
def
openbis_conn_options
(
func
):
...
...
@@ -25,17 +17,10 @@ def openbis_conn_options(func):
click
.
option
(
"
-u
"
,
"
--username
"
,
help
=
"
Username OPENBIS_USERNAME
"
),
click
.
option
(
"
-p
"
,
"
--password
"
,
help
=
"
Password OPENBIS_PASSWORD
"
),
click
.
option
(
<<<<<<<
HEAD
"
--ignore-certificate
"
,
is_flag
=
True
,
default
=
True
,
help
=
"
Ignore SSL certificate of openBIS host
"
,
=======
"
--verify-certificate
"
,
is_flag
=
True
,
default
=
True
,
help
=
"
Verify SSL certificate of openBIS host
"
,
>>>>>>>
033729
a6ad
(
add
cli
)
),
]
# we use reversed(options) to keep the options order in --help
...
...
@@ -48,17 +33,10 @@ def login_options(func):
options
=
[
click
.
argument
(
"
hostname
"
),
click
.
option
(
<<<<<<<
HEAD
"
--ignore-certificate
"
,
is_flag
=
True
,
default
=
True
,
help
=
"
Ignore SSL certificate of openBIS host
"
,
=======
"
--verify-certificate
"
,
is_flag
=
True
,
default
=
True
,
help
=
"
Verify SSL certificate of openBIS host
"
,
>>>>>>>
033729
a6ad
(
add
cli
)
),
]
# we use reversed(options) to keep the options order in --help
...
...
@@ -71,11 +49,7 @@ def get_openbis(
hostname
=
None
,
username
=
None
,
password
=
None
,
<<<<<<<
HEAD
ignore_certificate
=
False
,
=======
verify_certificate
=
True
,
>>>>>>>
033729
a6ad
(
add
cli
)
session_token_needed
=
False
,
):
"""
Order of priorities:
...
...
@@ -94,22 +68,14 @@ def get_openbis(
if
not
hostname
:
hostname
=
config
.
get
(
"
hostname
"
)
if
not
hostname
:
<<<<<<<
HEAD
hostname
=
click
.
prompt
(
"
openBIS hostname
"
)
=======
hostname
=
click
.
prompt
(
"
openBIS hostname:
"
)
>>>>>>>
033729
a6ad
(
add
cli
)
token
=
pybis
.
get_token_for_hostname
(
hostname
,
session_token_needed
=
session_token_needed
)
openbis
=
pybis
.
Openbis
(
url
=
hostname
,
<<<<<<<
HEAD
verify_certificates
=
not
ignore_certificate
,
=======
verify_certificates
=
verify_certificate
,
>>>>>>>
033729
a6ad
(
add
cli
)
)
if
token
:
try
:
...
...
@@ -139,17 +105,13 @@ def get_openbis(
@click.group
()
<<<<<<<
HEAD
@click.version_option
()
=======
>>>>>>>
033729
a6ad
(
add
cli
)
def
cli
():
"""
pybis - command line access to openBIS
"""
@cli.group
()
@click.pass_obj
<<<<<<<
HEAD
def
space
(
ctx
):
"""
manage spaces
"""
pass
...
...
@@ -303,8 +265,6 @@ def download_dataset_in_collection(identifier, **kwargs):
@cli.group
()
@click.pass_obj
=======
>>>>>>>
033729
a6ad
(
add
cli
)
def
sample
(
ctx
):
"""
manage samples
"""
pass
...
...
@@ -314,7 +274,6 @@ def sample(ctx):
@openbis_conn_options
@click.argument
(
"
identifier
"
,
required
=
True
)
def
get_sample
(
identifier
,
**
kwargs
):
<<<<<<<
HEAD
"""
get sample by its identifier or permId
"""
openbis
=
get_openbis
(
**
kwargs
)
try
:
...
...
@@ -382,9 +341,6 @@ def download_datasets_in_sample(identifier, **kwargs):
syslog
.
LOG_INFO
,
f
"
{
openbis
.
hostname
}
|
{
openbis
.
username
}
|
{
dataset
.
permId
}
"
,
)
=======
"""
get a sample by its identifier or permId
"""
>>>>>>>
033729
a6ad
(
add
cli
)
@cli.group
()
...
...
@@ -398,7 +354,6 @@ def dataset(ctx):
@openbis_conn_options
@click.argument
(
"
permid
"
,
required
=
True
)
def
get_dataset
(
permid
,
**
kwargs
):
<<<<<<<
HEAD
"""
get dataset meta-information by its permId
"""
openbis
=
get_openbis
(
**
kwargs
)
try
:
...
...
@@ -450,20 +405,6 @@ def download_dataset(permid, destination, fileno, **kwargs):
syslog
.
LOG_INFO
,
f
"
{
openbis
.
hostname
}
|
{
openbis
.
username
}
|
{
dataset
.
permId
}
"
,
)
=======
"""
get a dataset by its permId
"""
print
(
permid
)
print
(
kwargs
)
openbis
=
get_openbis
(
**
kwargs
)
print
(
openbis
)
@dataset.command
(
"
download
"
)
@click.argument
(
"
permid
"
,
required
=
True
)
def
download_dataset
(
permid
,
**
kwargs
):
"""
download a dataset by permId
"""
click
.
echo
(
permid
)
>>>>>>>
033729
a6ad
(
add
cli
)
@cli.command
(
"
local
"
,
context_settings
=
dict
(
ignore_unknown_options
=
True
))
...
...
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