Mercurial > repos > pieterlukasse > nist_wrapper
diff nist_wrapper.py @ 16:c21e96bb68c8
added clean-up after execution
author | pieter.lukasse@wur.nl |
---|---|
date | Fri, 23 Jan 2015 14:57:55 +0100 |
parents | 92cf554fca03 |
children | 82368bd06e1d |
line wrap: on
line diff
--- a/nist_wrapper.py Fri Jan 23 14:27:04 2015 +0100 +++ b/nist_wrapper.py Fri Jan 23 14:57:55 2015 +0100 @@ -85,6 +85,12 @@ return new_nist_home +def _clean_up_NIST(new_nist_home): + ''' + remove folder + ''' + utils.remove_dir(new_nist_home) + def _run_NIST(new_nist_home, output_file, is_wine, log_file, job_size): ''' - run : (wine) new_nist_home/MSSEARCH/nistms$.exe /INSTRUMENT /PAR=2 @@ -98,13 +104,6 @@ # to avoid conflicts in the orphan process killing (see end of this method), we will # only run NIST again after previous nistms.exe process has been killed: # TODO : solution is currently only for wine (in the windows context the solution is not there yet, but parallel calls are not expected as in windows we only run tests one by one for now) -# if is_wine: -# while True: -# # check if process exists. If not, break loop and continue -# pid = utils.get_process_pid("nistms.exe") -# if pid == -1: -# break -# time.sleep(2) # remove old file, if it is there: @@ -154,7 +153,7 @@ if is_wine: # pid = utils.get_process_pid("nistms.exe") # os.kill(pid, 9) - os.killpg(pro.pid, 9) + os.killpg(pro.pid, 9) else: # windows case: proc_name = "nistms.exe" @@ -318,6 +317,9 @@ job_size = len(spectra_dict) _run_NIST(new_nist_home, nist_output_file, is_wine, output_log_file, job_size) + # clean-up NIST environment: + _clean_up_NIST(new_nist_home) + # write output tabular: hits_dict = utils.get_nist_out_as_dict(nist_output_file) utils.save_dict_as_tsv(hits_dict, final_output_file)