from parsl.addresses import address_by_hostnamequery
from parsl.launchers import SrunLauncher
from parsl.providers import SlurmProvider
from funcx_endpoint.endpoint.utils.config import Config
from funcx_endpoint.executors import HighThroughputExecutor
user_opts = {
'delta': {
'worker_init': 'bash; conda activate funcx',
'scheduler_options': '#SBATCH --account=bbmi-delta-cpu',
}
}
config = Config(
executors=[
HighThroughputExecutor(
max_workers_per_node=2,
worker_debug=False,
address=address_by_hostnamequery(),
provider=SlurmProvider(
partition='cpu',
launcher=SrunLauncher(),
# string to prepend to #SBATCH blocks in the submit
# script to the scheduler eg: '#SBATCH --constraint=knl,quad,cache'
scheduler_options=user_opts['delta']['scheduler_options'],
# Command to be run before starting a worker, such as:
# 'module load Anaconda; source activate parsl_env'.
worker_init=user_opts['delta']['worker_init'],
# Scale between 0-1 blocks with 2 nodes per block
nodes_per_block=2,
init_blocks=0,
min_blocks=0,
max_blocks=1,
# Hold blocks for 30 minutes
walltime='00:30:00'
),
)
],
) |