Skip to content

Commit e25bd15

Browse files
committed
Change remote to metadata_only
1 parent 80bed1f commit e25bd15

2 files changed

Lines changed: 24 additions & 21 deletions

File tree

dataflow_transfer/run_classes/generic_runs.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def metadata_synced(self):
5858
def sync_metadata(self):
5959
"""Start background rsync transfer for metadata files."""
6060
metadata_rsync_command = self.generate_rsync_command(
61-
remote=False, with_exit_code_file=True
61+
metadata_only=True, with_exit_code_file=True
6262
)
6363

6464
if fs.rsync_is_running(src=self.run_dir, dst=self.metadata_destination):
@@ -76,9 +76,17 @@ def sync_metadata(self):
7676
logger.error(f"Failed to start metadata rsync for {self.run_id}: {e}")
7777
raise e
7878

79-
def generate_rsync_command(self, remote=False, with_exit_code_file=False):
79+
def generate_rsync_command(self, metadata_only=False, with_exit_code_file=False):
8080
"""Generate an rsync command string."""
81-
if remote:
81+
if metadata_only:
82+
source = self.run_dir + "/"
83+
destination = self.metadata_destination + "/"
84+
log_file_option = "--log-file=" + os.path.join(
85+
self.run_dir, "rsync_metadata_log.txt"
86+
)
87+
rsync_options = self.sequencer_config.get("metadata_rsync_options", [])
88+
exit_code_file = self.metadata_rsync_exitcode_file
89+
else:
8290
source = self.run_dir
8391
destination = (
8492
self.transfer_details.get("user")
@@ -92,22 +100,15 @@ def generate_rsync_command(self, remote=False, with_exit_code_file=False):
92100
)
93101
rsync_options = self.sequencer_config.get("remote_rsync_options", [])
94102
exit_code_file = self.final_rsync_exitcode_file
95-
else:
96-
source = self.run_dir + "/"
97-
destination = self.metadata_destination + "/"
98-
log_file_option = "--log-file=" + os.path.join(
99-
self.run_dir, "rsync_metadata_log.txt"
100-
)
101-
rsync_options = self.sequencer_config.get("metadata_rsync_options", [])
102-
exit_code_file = self.metadata_rsync_exitcode_file
103+
103104
run_one_bin = self.configuration.get("run_one_path", "run-one")
104105
command = [
105106
run_one_bin,
106107
"rsync",
107108
"-au",
108109
log_file_option,
109110
*(rsync_options),
110-
"--exclude='*'" if not remote else "",
111+
"--exclude='*'" if metadata_only else "",
111112
source,
112113
destination,
113114
]
@@ -119,7 +120,7 @@ def generate_rsync_command(self, remote=False, with_exit_code_file=False):
119120
def start_transfer(self, final=False):
120121
"""Start background rsync transfer to storage."""
121122
transfer_command = self.generate_rsync_command(
122-
remote=True, with_exit_code_file=final
123+
metadata_only=False, with_exit_code_file=final
123124
)
124125
if fs.rsync_is_running(src=self.run_dir, dst=self.remote_destination):
125126
logger.info(

dataflow_transfer/tests/test_run_classes.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,26 +190,28 @@ def test_sequencing_ongoing(run_fixture, request):
190190

191191

192192
@pytest.mark.parametrize(
193-
"run_fixture, remote, with_exit_code_file",
193+
"run_fixture, metadata_only, with_exit_code_file",
194194
[
195195
("novaseqxplus_testobj", False, True),
196-
("novaseqxplus_testobj", True, False),
196+
("novaseqxplus_testobj", False, False),
197197
("novaseqxplus_testobj", True, True),
198198
("nextseq_testobj", False, True),
199-
("nextseq_testobj", True, False),
199+
("nextseq_testobj", False, False),
200200
("nextseq_testobj", True, True),
201201
("miseqseq_testobj", False, True),
202-
("miseqseq_testobj", True, False),
202+
("miseqseq_testobj", False, False),
203203
("miseqseq_testobj", True, True),
204204
("miseqseqi100_testobj", False, True),
205-
("miseqseqi100_testobj", True, False),
205+
("miseqseqi100_testobj", False, False),
206206
("miseqseqi100_testobj", True, True),
207207
],
208208
)
209-
def test_generate_rsync_command(run_fixture, remote, with_exit_code_file, request):
209+
def test_generate_rsync_command(
210+
run_fixture, metadata_only, with_exit_code_file, request
211+
):
210212
run_obj = request.getfixturevalue(run_fixture)
211213
rsync_command = run_obj.generate_rsync_command(
212-
remote=remote, with_exit_code_file=with_exit_code_file
214+
metadata_only=metadata_only, with_exit_code_file=with_exit_code_file
213215
)
214216
assert "run-one rsync" in rsync_command
215217
assert "--log-file=" in rsync_command
@@ -337,7 +339,7 @@ def test_metadata_synced(run_fixture, sync_successful, request):
337339
def test_sync_metadata(run_fixture, request, monkeypatch):
338340
run_obj = request.getfixturevalue(run_fixture)
339341

340-
def mock_generate_rsync_command(remote, with_exit_code_file):
342+
def mock_generate_rsync_command(metadata_only, with_exit_code_file):
341343
return "rsync command"
342344

343345
def mock_rsync_is_running(src, dst):

0 commit comments

Comments
 (0)