Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
lofar_stager_api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASTRON SDC
lofar_stager_api
Commits
59aca06b
Commit
59aca06b
authored
4 years ago
by
Thomas Juerges
Browse files
Options
Downloads
Patches
Plain Diff
Remove credentials in exceptions thrown by LtaProxy calls
parent
e14e0a10
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
stager_access.py
+45
-11
45 additions, 11 deletions
stager_access.py
with
45 additions
and
11 deletions
stager_access.py
+
45
−
11
View file @
59aca06b
...
...
@@ -22,7 +22,7 @@
# !! This is to ensure that when we change the remote interface, your scripts don't break and you will only have to
# !! upgrade this module.
__version__
=
"
1.
5
"
__version__
=
"
1.
6
"
import
datetime
import
configparser
...
...
@@ -86,44 +86,75 @@ else:
# ---
def
remove_credentials_from_exception
(
exception
):
s
=
str
(
exception
).
replace
(
user
+
"
:
"
+
passw
+
"
@
"
,
""
)
return
s
def
stage
(
surls
,
send_notifications
=
True
):
"""
Stage list of SURLs, optionally enable/disable email notifications
"""
if
isinstance
(
surls
,
str
):
surls
=
[
surls
]
stageid
=
proxy
.
LtaStager
.
add_getid
(
surls
,
send_notifications
)
try
:
stageid
=
proxy
.
LtaStager
.
add_getid
(
surls
,
send_notifications
)
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
return
stageid
def
get_status
(
stageid
):
"""
Get status of request with given ID
"""
return
proxy
.
LtaStager
.
getstatus
(
stageid
)
try
:
return
proxy
.
LtaStager
.
getstatus
(
stageid
)
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
def
abort
(
stageid
):
"""
Abort running request / release data of a finished request with given ID
"""
return
proxy
.
LtaStager
.
abort
(
stageid
)
try
:
return
proxy
.
LtaStager
.
abort
(
stageid
)
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
def
get_surls_requested
(
stageid
):
"""
Get a list of all files that are requested via a running request with given ID
"""
return
proxy
.
LtaStager
.
getrequestedurls
(
stageid
)
try
:
return
proxy
.
LtaStager
.
getrequestedurls
(
stageid
)
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
def
get_surls_pending
(
stageid
):
"""
Get a list of all files that are not yet online for a running request with given ID
"""
return
proxy
.
LtaStager
.
getoutstandingurls
(
stageid
)
try
:
return
proxy
.
LtaStager
.
getoutstandingurls
(
stageid
)
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
def
get_surls_failed
(
stageid
):
"""
Get a list of all files that have failed in a running request with given ID
"""
return
proxy
.
LtaStager
.
getfailedurls
(
stageid
)
try
:
return
proxy
.
LtaStager
.
getfailedurls
(
stageid
)
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
def
get_surls_online
(
stageid
):
"""
Get a list of all files that are already online for a running request with given ID
"""
return
proxy
.
LtaStager
.
getstagedurls
(
stageid
)
try
:
return
proxy
.
LtaStager
.
getstagedurls
(
stageid
)
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
def
get_srm_token
(
stageid
):
"""
Get the SRM request token for direct interaction with the SRM site via Grid/SRM tools
"""
return
proxy
.
LtaStager
.
gettoken
(
stageid
)
try
:
return
proxy
.
LtaStager
.
gettoken
(
stageid
)
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
def
reschedule
(
stageid
):
"""
Reschedule a request with a given ID, e.g. after it was put on hold due to maintenance
"""
return
proxy
.
LtaStager
.
reschedule
(
stageid
)
try
:
return
proxy
.
LtaStager
.
reschedule
(
stageid
)
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
def
get_progress
(
status
=
None
,
exclude
=
False
):
"""
Get a detailed list of all running requests and their current progress.
...
...
@@ -133,7 +164,10 @@ def get_progress(status=None, exclude=False):
:param exclude: If set to True then the requests with status
'
status
'
are
excluded.
"""
all_requests
=
proxy
.
LtaStager
.
getprogress
()
try
:
all_requests
=
proxy
.
LtaStager
.
getprogress
()
except
xmlrpclib
.
Error
as
e
:
raise
Exception
(
remove_credentials_from_exception
(
e
))
if
status
is
not
None
and
isinstance
(
status
,
string_types
):
if
python_version
==
3
:
all_items
=
all_requests
.
items
()
...
...
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