Skip to content

Commit 2d6282a

Browse files
committed
ft-orchestration use shutil.move instead of copy
1 parent 87b6d4f commit 2d6282a

8 files changed

Lines changed: 15 additions & 13 deletions

File tree

tools/ft-orchestration/src/collector/ipfixcol2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"""
1010

1111
import logging
12+
import os
1213
import shutil
1314
import tempfile
1415
import xml.etree.ElementTree as ET
@@ -307,7 +308,8 @@ def download_logs(self, directory: str):
307308
self._rsync.pull_path(log_file, directory)
308309
except RsyncException as err:
309310
logging.getLogger().warning("%s", err)
310-
shutil.copy(self._log_file, directory)
311+
shutil.move(os.path.join(self._log_dir, "flows.csv"), directory)
312+
shutil.move(self._log_file, directory)
311313

312314
def cleanup(self):
313315
"""Delete working directory."""

tools/ft-orchestration/src/generator/ft_replay.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def start_profile(
610610
cache_rsync = Rsync(self._executor, data_dir=path.dirname(self._report))
611611
try:
612612
report = cache_rsync.pull_path(self._report, self._work_dir)
613-
shutil.copy(report, report_path)
613+
shutil.move(report, report_path)
614614
self._report_pull_failed = False
615615
except AssertionError:
616616
self._report_path = report_path
@@ -653,10 +653,10 @@ def download_logs(self, directory: str) -> None:
653653
Path(directory).mkdir(parents=True, exist_ok=True)
654654
for file in log_files:
655655
if Path(file).exists():
656-
shutil.copy(file, directory)
656+
shutil.move(file, directory)
657657

658658
if self._verbose:
659-
shutil.copy(self._config_file, directory)
659+
shutil.move(self._config_file, directory)
660660

661661
def stats(self) -> GeneratorStats:
662662
"""Get stats of last generator run.
@@ -684,7 +684,7 @@ def stats(self) -> GeneratorStats:
684684
if self._report_pull_failed:
685685
cache_rsync = Rsync(self._executor, data_dir=path.dirname(self._report))
686686
report = cache_rsync.pull_path(self._report, self._work_dir)
687-
shutil.copy(report, self._report_path)
687+
shutil.move(report, self._report_path)
688688

689689
return GeneratorStats(pkts, bts, start_time, end_time)
690690

tools/ft-orchestration/src/generator/tcpreplay.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def start_profile(
251251

252252
self.start(pcap, speed, loop_count)
253253

254-
shutil.copy(report, report_path)
254+
shutil.move(report, report_path)
255255

256256
def stats(self) -> GeneratorStats:
257257
"""Get stats based on process from ``start`` method.
@@ -321,7 +321,7 @@ def download_logs(self, directory: str):
321321
"""
322322

323323
Path(directory).mkdir(parents=True, exist_ok=True)
324-
shutil.copy(self._log_file, directory)
324+
shutil.move(self._log_file, directory)
325325

326326
@staticmethod
327327
def _get_speed_arg(speed: ReplaySpeed) -> str:

tools/ft-orchestration/src/probe/cento.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def download_logs(self, directory: str):
375375
Path to a local directory where logs should be stored.
376376
"""
377377
try:
378-
shutil.copy(self._log_file, directory)
378+
shutil.move(self._log_file, directory)
379379
self.host_statistics.get_csv(directory)
380380
except PermissionError as err:
381381
logging.getLogger().warning("Cannot download ipfixprobe log, %s", err)

tools/ft-orchestration/src/probe/ipfixprobe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def download_logs(self, directory: str):
524524
Path to a local directory where logs should be stored.
525525
"""
526526
try:
527-
shutil.copy(self._log_file, directory)
527+
shutil.move(self._log_file, directory)
528528
self.host_statistics.get_csv(directory)
529529
except PermissionError as err:
530530
logging.getLogger().warning("Cannot download ipfixprobe log, %s", err)

tools/ft-orchestration/src/probe/nprobe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def download_logs(self, directory: str):
408408
"""
409409
try:
410410
for log_file in self._log_files:
411-
shutil.copy(log_file, directory)
411+
shutil.move(log_file, directory)
412412
self.host_statistics.get_csv(directory)
413413
except PermissionError as err:
414414
logging.getLogger().warning("Cannot download ipfixprobe log, %s", err)

tools/ft-orchestration/src/probe/yaf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ def download_logs(self, directory: str):
441441
Path to a local directory where logs should be stored.
442442
"""
443443
try:
444-
shutil.copy(self._log_file, directory)
445-
shutil.copy(self._config_file, directory)
444+
shutil.move(self._log_file, directory)
445+
shutil.move(self._config_file, directory)
446446
self.host_statistics.get_csv(directory)
447447
except PermissionError as err:
448448
logging.getLogger().warning("Cannot download ipfixprobe log, %s", err)

tools/ft-orchestration/tests/simulation/test_simulation_threshold.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def run_single_test(loops: int, speed: MbpsSpeed) -> tuple[bool, StatisticalRepo
337337
# cleanup devices
338338
finalizer_download_logs()
339339
if request.config.getoption("archive_test_data") == "always":
340-
shutil.copytree(tmp_dir, os.path.join(current_log_dir, "data"))
340+
shutil.move(tmp_dir, os.path.join(current_log_dir, "data"))
341341
cleanup()
342342
objects_to_cleanup = []
343343
gc.collect()

0 commit comments

Comments
 (0)