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
0338444c
Commit
0338444c
authored
7 years ago
by
Yves Noirjean
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-5513: only connecting to openbis when synchronizing; undoing commit when connection fails
parent
2459c02f
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/dm/data_mgmt.py
+15
-16
15 additions, 16 deletions
src/python/OBis/obis/dm/data_mgmt.py
with
15 additions
and
16 deletions
src/python/OBis/obis/dm/data_mgmt.py
+
15
−
16
View file @
0338444c
...
...
@@ -42,17 +42,7 @@ def DataMgmt(echo_func=None, config_resolver=None, openbis_config={}, git_config
config_resolver
.
location_resolver
.
location_roots
[
'
data_set
'
]
=
result
.
output
complete_openbis_config
(
openbis_config
,
config_resolver
)
openbis
=
None
if
openbis_config
.
get
(
'
url
'
)
is
None
:
pass
else
:
try
:
openbis
=
pybis
.
Openbis
(
**
openbis_config
)
except
ValueError
:
echo_func
({
'
level
'
:
'
error
'
,
'
message
'
:
'
Could not connect to openBIS.
'
})
traceback
.
print_exc
()
return
GitDataMgmt
(
config_resolver
,
openbis
,
git_wrapper
)
return
GitDataMgmt
(
config_resolver
,
openbis_config
,
git_wrapper
)
def
complete_openbis_config
(
config
,
resolver
):
...
...
@@ -144,9 +134,9 @@ class AbstractDataMgmt(metaclass=abc.ABCMeta):
All operations throw an exepction if they fail.
"""
def
__init__
(
self
,
config_resolver
,
openbis
,
git_wrapper
):
def
__init__
(
self
,
config_resolver
,
openbis
_config
,
git_wrapper
):
self
.
config_resolver
=
config_resolver
self
.
openbis
=
openbis
self
.
openbis
_config
=
openbis
_config
self
.
git_wrapper
=
git_wrapper
def
error_raise
(
self
,
command
,
reason
):
...
...
@@ -243,8 +233,12 @@ class GitDataMgmt(AbstractDataMgmt):
return
self
.
git_wrapper
.
git_init
(
path
)
def
sync
(
self
):
cmd
=
OpenbisSync
(
self
)
return
cmd
.
run
()
try
:
cmd
=
OpenbisSync
(
self
)
return
cmd
.
run
()
except
Exception
:
traceback
.
print_exc
()
return
CommandResult
(
returncode
=-
1
,
output
=
"
Could not synchronize with openBIS.
"
)
def
commit
(
self
,
msg
,
auto_add
=
True
,
sync
=
True
):
if
auto_add
:
...
...
@@ -371,11 +365,16 @@ class OpenbisSync(object):
def
__init__
(
self
,
dm
):
self
.
data_mgmt
=
dm
self
.
openbis
=
dm
.
openbis
self
.
git_wrapper
=
dm
.
git_wrapper
self
.
config_resolver
=
dm
.
config_resolver
self
.
config_dict
=
dm
.
config_resolver
.
config_dict
()
self
.
openbis
=
None
if
dm
.
openbis_config
.
get
(
'
url
'
)
is
None
:
pass
else
:
self
.
openbis
=
pybis
.
Openbis
(
**
dm
.
openbis_config
)
def
user
(
self
):
return
self
.
config_dict
.
get
(
'
user
'
)
...
...
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