Skip to content

Commit

Permalink
Fix clean_up_after_failure() method (Issue #165)
Browse files Browse the repository at this point in the history
Instead of inferring that run_dir contains the ADC and data points CSV files if it contains two files, explcitly check that it indeed contains those two files.
  • Loading branch information
csatt committed Dec 20, 2020
1 parent aa258df commit ccc4273
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions python/IV_Swinger2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5597,12 +5597,13 @@ def configure_logging(self, logger=None):

# -------------------------------------------------------------------------
def clean_up_after_failure(self, run_dir):
"""Method to remove the run directory after a failed run if it contains
fewer than two files (which would be the ADC CSV file and
the data points CSV file)
"""Method to remove the run directory after a failed run if it does not
contain both the ADC CSV file and the data points CSV file.
"""
files = glob.glob("{}/*".format(run_dir))
if len(files) < 2:
do_cleanup = (self.hdd_adc_pairs_csv_filename not in files or
self.hdd_csv_data_point_filename not in files)
if do_cleanup:
for f in files:
self.clean_up_file(f)
if run_dir == os.getcwd():
Expand Down
9 changes: 5 additions & 4 deletions python3/IV_Swinger2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5594,12 +5594,13 @@ def configure_logging(self, logger=None):

# -------------------------------------------------------------------------
def clean_up_after_failure(self, run_dir):
"""Method to remove the run directory after a failed run if it contains
fewer than two files (which would be the ADC CSV file and
the data points CSV file)
"""Method to remove the run directory after a failed run if it does not
contain both the ADC CSV file and the data points CSV file.
"""
files = glob.glob("{}/*".format(run_dir))
if len(files) < 2:
do_cleanup = (self.hdd_adc_pairs_csv_filename not in files or
self.hdd_csv_data_point_filename not in files)
if do_cleanup:
for f in files:
self.clean_up_file(f)
if run_dir == os.getcwd():
Expand Down

0 comments on commit ccc4273

Please sign in to comment.