Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
596969ee
Commit
596969ee
authored
1 year ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-2829
: fixed host/path parsing
parent
9e54ea52
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/backend/services/copy_service/copy_service.py
+11
-9
11 additions, 9 deletions
SAS/TMSS/backend/services/copy_service/copy_service.py
with
11 additions
and
9 deletions
SAS/TMSS/backend/services/copy_service/copy_service.py
+
11
−
9
View file @
596969ee
...
...
@@ -39,14 +39,16 @@ class TMSSCopyServiceEventMessageHandler(TMSSEventMessageHandler):
def
start_handling
(
self
):
self
.
tmss_client
.
open
()
super
().
start_handling
()
def
stop_handling
(
self
):
super
().
stop_handling
()
self
.
tmss_client
.
close
()
def
before_receive_message
(
self
):
# use 1-sec event loop to poll queued subtasks (rate limited at
3
0sec)
# use 1-sec event loop to poll queued subtasks (rate limited at
6
0sec)
super
().
before_receive_message
()
if
datetime
.
utcnow
()
-
self
.
_last_df_check_timestamp
>
timedelta
(
seconds
=
3
0
):
if
datetime
.
utcnow
()
-
self
.
_last_df_check_timestamp
>
timedelta
(
seconds
=
6
0
):
self
.
_last_df_check_timestamp
=
datetime
.
utcnow
()
self
.
check_and_run_queued_copy_subtask_if_enough_disk_space
()
...
...
@@ -84,9 +86,9 @@ class TMSSCopyServiceEventMessageHandler(TMSSEventMessageHandler):
# determine destination host and root_dir
destination
=
subtask
[
'
specifications_doc
'
][
'
destination
'
]
dst_host
=
destination
[:
destination
.
find
(
'
:
'
)]
if
'
:
'
in
destination
else
''
dst_root_dir
=
'
/
'
+
destination
.
lstrip
(
dst_host
+
'
:
'
).
split
(
'
/
'
)[
1
]
#
strip
unneeded localhost to prevent unneeded ssh calls
dst_host
=
dst_host
.
lstrip
(
'
localhost:
'
).
lstrip
(
'
127.0.0.1:
'
)
dst_root_dir
=
'
/
'
+
destination
.
replace
(
dst_host
+
'
:
'
,
''
).
split
(
'
/
'
)[
1
]
#
remove
unneeded localhost to prevent unneeded ssh calls
dst_host
=
dst_host
.
replace
(
'
localhost:
'
,
''
).
replace
(
'
127.0.0.1:
'
,
''
)
df_cmd
=
[
'
df
'
,
dst_root_dir
]
if
dst_host
:
...
...
@@ -157,11 +159,11 @@ class TMSSCopyServiceEventMessageHandler(TMSSEventMessageHandler):
# split in host & parent_dir_path
dst_host
=
output_dp_path
[:
output_dp_path
.
find
(
'
:
'
)]
if
'
:
'
in
output_dp_path
else
''
dst_parent_dir_path
=
output_dp_path
.
lstrip
(
dst_host
+
'
:
'
).
r
strip
(
input_dataproduct
[
'
filename
'
])
dst_parent_dir_path
=
output_dp_path
.
replace
(
dst_host
+
'
:
'
,
''
).
r
eplace
(
input_dataproduct
[
'
filename
'
]
,
''
)
#
strip
unneeded localhost to prevent under-the-hood ssh wrapping in rsync, and to prevent unneed ssh calls
dst_host
=
dst_host
.
lstrip
(
'
localhost:
'
).
lstrip
(
'
127.0.0.1:
'
)
dst_parent_dir_path
=
dst_parent_dir_path
.
lstrip
(
'
localhost:
'
).
lstrip
(
'
127.0.0.1:
'
)
#
replace
unneeded localhost to prevent under-the-hood ssh wrapping in rsync, and to prevent unneed ssh calls
dst_host
=
dst_host
.
replace
(
'
localhost:
'
,
''
).
replace
(
'
127.0.0.1:
'
,
''
)
dst_parent_dir_path
=
dst_parent_dir_path
.
replace
(
'
localhost:
'
,
''
).
replace
(
'
127.0.0.1:
'
,
''
)
if
dst_parent_dir_path
not
in
_created_dir_cache
:
# create dst_parent_dir_path directories if needed, prepend them to the cmd
...
...
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