Skip to content

Commit

Permalink
Move code into function in batch job generation script (#3491)
Browse files Browse the repository at this point in the history
  • Loading branch information
bouweandela authored Dec 20, 2023
1 parent 84706a0 commit ce887aa
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions esmvaltool/utils/batch-jobs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"""
import os
import subprocess
import textwrap
from pathlib import Path

import esmvaltool
Expand Down Expand Up @@ -230,28 +231,27 @@
'recipe_pcrglobwb',
]

DEFAULT_DASK_FILE = f"""
cluster:
type: dask_jobqueue.SLURMCluster
queue: compute
account: {account}
cores: 128
memory: 256GiB
processes: 32
interface: ib0
local_directory: /scratch/{os.getlogin()[0]}/{os.getlogin()}/dask-tmp
n_workers: 32
walltime: '8:00:00'
"""


def generate_submit():
"""Generate and submit scripts."""
print("It is recommended that you run the following recipes with the "
"configuration in dask.yml in ~/.esmvaltool/dask.yml:")
default_dask_config_file = textwrap.dedent(f"""
cluster:
type: dask_jobqueue.SLURMCluster
queue: compute
account: {account}
cores: 128
memory: 256GiB
processes: 32
interface: ib0
local_directory: /scratch/{os.getlogin()[0]}/{os.getlogin()}/dask-tmp
n_workers: 32
walltime: '8:00:00'
""")
for recipe in DISTRIBUTED_RECIPES:
print(f"- {recipe}.yml")
Path('dask.yml').write_text(DEFAULT_DASK_FILE, encoding='utf-8')
Path('dask.yml').write_text(default_dask_config_file, encoding='utf-8')

home = os.path.expanduser('~')
# Fill the list with the names of the recipes to be excluded
Expand Down

0 comments on commit ce887aa

Please sign in to comment.