Skip to content

Commit

Permalink
Monitoring & Logging: fix transfer_link sent by receiver. Closes ruci…
Browse files Browse the repository at this point in the history
…o#5640

Under normal operation, when we get a notification from FTS about a
transfer completion, we know about the transfer and retrieve it
from the database. It doesn't cost us anything to use the
request.external_host field from the db table, which has the correct
format.

We can ignore the occurances when it's not the case. It means that we
got a notification from FTS about a transfer submitted by rucio, but
about which rucio doesn't know anything.... we would have bigger
problems to investigate in such case than a wrong monitoring link.
  • Loading branch information
rcarpa committed Jul 1, 2022
1 parent e389bf1 commit 960b98b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/rucio/tests/test_conveyor.py
Expand Up @@ -469,6 +469,7 @@ def test_multisource_receiver(vo, did_factory, replica_client, root_account, met
assert msg_submitted['payload']['request-id'] == request['id']
msg_done = next(msg for msg in msgs if msg['event_type'] == 'transfer-done')
assert msg_done['payload']['request-id'] == request['id']
assert msg_done['payload']['transfer_link'].startswith('https://fts:8449/')
finally:
receiver_graceful_stop.set()
receiver_thread.join(timeout=5)
Expand Down
4 changes: 3 additions & 1 deletion lib/rucio/transfertool/fts3.py
Expand Up @@ -355,6 +355,7 @@ def __init__(self, external_host, request_id, request=None):
# Initialized in child class initialize():
self._reason = None
self._src_rse = None
self._fts_address = self.external_host
# Supported db fields bellow:
self.state = None
self.external_id = None
Expand Down Expand Up @@ -390,7 +391,7 @@ def get_monitor_msg_fields(self, session, logger=logging.log):
return fields

def _transfer_link(self):
return '%s/fts3/ftsmon/#/job/%s' % (self.external_host.replace('8446', '8449'), self._transfer_id)
return '%s/fts3/ftsmon/#/job/%s' % (self._fts_address.replace('8446', '8449'), self._transfer_id)

def _find_attribute_updates(self, request, new_state, reason, overwrite_corrupted_files):
attributes = None
Expand Down Expand Up @@ -511,6 +512,7 @@ def initialize(self, session, logger=logging.log):

self._reason = reason
self._src_rse = src_rse_name
self._fts_address = request['external_host'] or self._fts_address

self.state = new_state
self.external_id = transfer_id
Expand Down

0 comments on commit 960b98b

Please sign in to comment.