payu-org / payu

A workflow management tool for numerical models on the NCI computing systems
Apache License 2.0
19 stars 26 forks source link

Crash if restart exists in archive #285

Closed aidanheerdegen closed 1 year ago

aidanheerdegen commented 3 years ago

If a file or directory named restart exists in the archive directory payu crashes with this error:

$ touch archive/restart
$ ls archive/
output000  output001  pbs_logs  restart  restart000  restart001
$ payu sweep
laboratory path:  /scratch/v45/aph502/access-om2
binary path:  /scratch/v45/aph502/access-om2/bin
input path:  /scratch/v45/aph502/access-om2/input
work path:  /scratch/v45/aph502/access-om2/work
archive path:  /scratch/v45/aph502/access-om2/archive
Traceback (most recent call last):
  File "/g/data3/hh5/public/apps/miniconda3/envs/analysis3-20.10/bin/payu", line 10, in <module>
    sys.exit(parse())
  File "/home/502/aph502/code/python/payu/payu/cli.py", line 42, in parse
    run_cmd(**args)
  File "/home/502/aph502/code/python/payu/payu/subcommands/sweep_cmd.py", line 16, in runcmd
    expt = Experiment(lab)
  File "/home/502/aph502/code/python/payu/payu/experiment.py", line 88, in __init__
    self.set_counters()
  File "/home/502/aph502/code/python/payu/payu/experiment.py", line 191, in set_counters
    self.counter = 1 + max([int(d.lstrip('restart'))
  File "/home/502/aph502/code/python/payu/payu/experiment.py", line 191, in <listcomp>
    self.counter = 1 + max([int(d.lstrip('restart'))
ValueError: invalid literal for int() with base 10: ''

even if correctly named restart files exist in archive, e.g. restart000