Skip to content

Commit

Permalink
Skip ocean and sea-ice partitions if they exist
Browse files Browse the repository at this point in the history
This saves a lot of time when rerunning these steps.
  • Loading branch information
xylar committed Aug 14, 2023
1 parent d09e120 commit 5ea9d57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def run(self):
if ncores > ncells:
raise ValueError('Can\t have more tasks than cells in a '
'partition file.')
out_filename = f'mpas-o.graph.info.{creation_date}.part.{ncores}'
if os.path.exists(out_filename):
continue
if ncores == 1:
args = ['touch', f'mpas-o.graph.info.{creation_date}.part.1']
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,16 @@ def run(self):
if ncores > ncells:
raise ValueError('Can\t have more tasks than cells in a '
'partition file.')
if ncores > 1:
if ncores <= 0:
raise ValueError(f'Can\t make a partition for {ncores} tasks.')
out_filename = \
f'mpas-seaice.graph.info.{creation_date}.part.{ncores}'
if os.path.exists(out_filename):
continue

if ncores == 1:
args = ['touch', f'mpas-o.graph.info.{creation_date}.part.1']
else:
args.append(f'{ncores}')

check_call(args, logger)
Expand Down

0 comments on commit 5ea9d57

Please sign in to comment.