Skip to content

Commit

Permalink
Transfers: add source replica expression on intermediate hops. Closes r…
Browse files Browse the repository at this point in the history
…ucio#5170

This shouldn't be necessary, but it's worth adding an additional
protection in case the intermediate hop is submitted alone by error.
  • Loading branch information
rcarpa committed Jan 21, 2022
1 parent 62c18e8 commit 3dd2dfb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/rucio/core/request.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2013-2021 CERN
# Copyright 2013-2022 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@
# - Mario Lassnig <mario.lassnig@cern.ch>, 2013-2021
# - Vincent Garonne <vincent.garonne@cern.ch>, 2013-2017
# - Cedric Serfon <cedric.serfon@cern.ch>, 2014-2020
# - Martin Barisits <martin.barisits@cern.ch>, 2014-2021
# - Martin Barisits <martin.barisits@cern.ch>, 2014-2022
# - Wen Guan <wen.guan@cern.ch>, 2014-2016
# - Joaquín Bogado <jbogado@linti.unlp.edu.ar>, 2015-2019
# - Thomas Beermann <thomas.beermann@cern.ch>, 2016-2021
Expand All @@ -28,12 +28,11 @@
# - Andrew Lister <andrew.lister@stfc.ac.uk>, 2019
# - Brandon White <bjwhite@fnal.gov>, 2019
# - Benedikt Ziemons <benedikt.ziemons@cern.ch>, 2020-2021
# - Radu Carpa <radu.carpa@cern.ch>, 2021
# - Radu Carpa <radu.carpa@cern.ch>, 2021-2022
# - Matt Snyder <msnyder@bnl.gov>, 2021
# - Sahan Dilshan <32576163+sahandilshan@users.noreply.github.com>, 2021
# - Nick Smith <nick.smith@cern.ch>, 2021
# - David Población Criado <david.poblacion.criado@cern.ch>, 2021
# - Nick Smith <nick.smith@cern.ch>, 2021

import datetime
import json
Expand Down Expand Up @@ -641,6 +640,7 @@ def get_request_by_did(scope, name, rse_id, request_type=None, session=None):

tmp['source_rse'] = get_rse_name(rse_id=tmp['source_rse_id'], session=session) if tmp['source_rse_id'] is not None else None
tmp['dest_rse'] = get_rse_name(rse_id=tmp['dest_rse_id'], session=session) if tmp['dest_rse_id'] is not None else None
tmp['attributes'] = json.loads(str(tmp['attributes']))

return tmp
except IntegrityError as error:
Expand Down
1 change: 1 addition & 0 deletions lib/rucio/core/transfer.py
Expand Up @@ -1580,6 +1580,7 @@ def create_missing_replicas_and_requests(

rws.attributes['next_hop_request_id'] = transfer_path[i + 1].rws.request_id
rws.attributes['initial_request_id'] = initial_request_id
rws.attributes['source_replica_expression'] = hop.src.rse.name
new_req = queue_requests(requests=[{'dest_rse_id': rws.dest_rse.id,
'scope': rws.scope,
'name': rws.name,
Expand Down
7 changes: 4 additions & 3 deletions lib/rucio/tests/test_conveyor.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2021 CERN
# Copyright 2015-2022 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,8 @@
# Authors:
# - Wen Guan <wen.guan@cern.ch>, 2015-2016
# - Vincent Garonne <vincent.garonne@cern.ch>, 2016
# - Martin Barisits <martin.barisits@cern.ch>, 2019-2021
# - Radu Carpa <radu.carpa@cern.ch>, 2021
# - Martin Barisits <martin.barisits@cern.ch>, 2019-2022
# - Radu Carpa <radu.carpa@cern.ch>, 2021-2022
# - Mayank Sharma <imptodefeat@gmail.com>, 2021
# - David Población Criado <david.poblacion.criado@cern.ch>, 2021
# - Joel Dierkes <joel.dierkes@cern.ch>, 2021
Expand Down Expand Up @@ -270,6 +270,7 @@ def test_fts_non_recoverable_failures_handled_on_multihop(vo, did_factory, root_
assert request['state'] == RequestState.FAILED
request = request_core.get_request_by_did(rse_id=jump_rse_id, **did)
assert request['state'] == RequestState.FAILED
assert request['attributes']['source_rse_expression'] == src_rse

# Each hop is a separate transfer, which will be handled by the poller and marked as failed
assert metrics_mock.get_sample_value('rucio_daemons_conveyor_poller_update_request_state_total', labels={'updated': 'True'}) >= 2
Expand Down

0 comments on commit 3dd2dfb

Please sign in to comment.