Skip to content

Commit

Permalink
Github Issue #332 remove use of process id to create subdir in tmp di…
Browse files Browse the repository at this point in the history
…rectory and create a fresh tmp directory after removing it so there is a tmp directory ready for a re-run or the next wrapper. Removed 'TODO' comment and created a new Github issue: #336.
  • Loading branch information
bikegeek committed Dec 10, 2019
1 parent 460101c commit 93a18cf
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions ush/series_by_lead_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1233,23 +1233,7 @@ def create_animated_gifs(self, do_fhr_by_range):
level, '_', cur_stat, '.gif']
animate_cmd = ''.join(gif_parts)
self.logger.debug("animate cmd: {}".format(animate_cmd))
# TODO:
# Fix animate_cmd so it does not require run_inshell
# to work.
# It is working as is, ideally we do not require
# run_inshell
# The issue has to do with multiple files in the directory
# when using the wild card. If only one file exists
# then the command will run ok without run_inshell.
# You can repeat the issue
# by removing run_inshell keyword in the call below and
# running examples/series_by_lead_all_fhrs.conf use case.
# no animated gifs are created.
# convert: unable to open image
# .... No such file or directory
# @ error/blob.c/OpenBlob/2712.
# convert: unable to open file
# convert: no images defined


(ret, animate_cmd) = self.cmdrunner.run_cmd\
(animate_cmd, env=None, ismetcmd=False,
Expand Down Expand Up @@ -1313,9 +1297,8 @@ def apply_series_filters(self, tile_dir, init_times, series_output_dir,
cur_function = sys._getframe().f_code.co_name

# Create temporary directory where intermediate files are saved.
cur_pid = str(os.getpid())
tmp_dir = os.path.join(temporary_dir, cur_pid)
self.logger.debug("creating tmp dir: " + tmp_dir)
tmp_dir = temporary_dir
self.logger.debug("creating tmp dir for filter files: " + tmp_dir)
util.mkdir_p(tmp_dir)

for cur_init in init_times:
Expand Down Expand Up @@ -1383,8 +1366,10 @@ def apply_series_filters(self, tile_dir, init_times, series_output_dir,
# series analysis.
util.prune_empty(series_output_dir, self.logger)

# Clean up the tmp dir
# Clean up the tmp dir and create an empty one
# in anticipation of another run.
util.rmtree(tmp_dir)
util.mkdir_p(tmp_dir)

if __name__ == "__main__":
util.run_stand_alone("series_by_lead_wrapper", "SeriesByLead")

0 comments on commit 93a18cf

Please sign in to comment.