Skip to content

Commit 6dde5a4

Browse files
authored
Merge branch 'master' into benc-stdstreams-bugs
2 parents a4e0c61 + dc7911f commit 6dde5a4

File tree

4 files changed

+83
-4
lines changed

4 files changed

+83
-4
lines changed

.github/workflows/parsl+slurm.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test Slurm Scheduler
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-22.04
8+
permissions:
9+
packages: read
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
container: ["ghcr.io/tylern4/slurm-standalone:slurm-24-05-0-1"]
14+
timeout-minutes: 30
15+
16+
container:
17+
image: ${{ matrix.container }}
18+
options: "--platform=linux/amd64 --rm -h node01"
19+
20+
name: ${{ matrix.container }}
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Install Dependencies and Parsl
26+
run: |
27+
CC=/usr/lib64/openmpi/bin/mpicc pip3 install . -r test-requirements.txt
28+
29+
- name: Verify Parsl Installation
30+
run: |
31+
pytest parsl/tests/ -k "not cleannet and not unix_filesystem_permissions_required" --config parsl/tests/configs/local_threads.py --random-order --durations 10
32+
33+
- name: Test Parsl with Slurm Config
34+
run: |
35+
./parsl/tests/slurm-entrypoint.sh pytest parsl/tests/ -k "not cleannet and not unix_filesystem_permissions_required" --config parsl/tests/configs/slurm_local.py --random-order --durations 10

parsl/executors/taskvine/executor.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
high-throughput system for delegating Parsl tasks to thousands of remote machines
44
"""
55

6+
import getpass
67
import hashlib
78
import inspect
89
import itertools
@@ -18,6 +19,7 @@
1819
import threading
1920
import uuid
2021
from concurrent.futures import Future
22+
from datetime import datetime
2123
from typing import List, Literal, Optional, Union
2224

2325
# Import other libraries
@@ -215,9 +217,9 @@ def __create_data_and_logging_dirs(self):
215217

216218
# Create directories for data and results
217219
log_dir = os.path.join(run_dir, self.label)
218-
self._function_data_dir = os.path.join(run_dir, self.label, "function_data")
219220
os.makedirs(log_dir)
220-
os.makedirs(self._function_data_dir)
221+
tmp_prefix = f'{self.label}-{getpass.getuser()}-{datetime.now().strftime("%Y%m%d%H%M%S%f")}-'
222+
self._function_data_dir = tempfile.TemporaryDirectory(prefix=tmp_prefix)
221223

222224
# put TaskVine logs outside of a Parsl run as TaskVine caches between runs while
223225
# Parsl does not.
@@ -227,7 +229,7 @@ def __create_data_and_logging_dirs(self):
227229

228230
# factory logs go with manager logs regardless
229231
self.factory_config.scratch_dir = self.manager_config.vine_log_dir
230-
logger.debug(f"Function data directory: {self._function_data_dir}, log directory: {log_dir}")
232+
logger.debug(f"Function data directory: {self._function_data_dir.name}, log directory: {log_dir}")
231233
logger.debug(
232234
f"TaskVine manager log directory: {self.manager_config.vine_log_dir}, "
233235
f"factory log directory: {self.factory_config.scratch_dir}")
@@ -293,7 +295,7 @@ def _path_in_task(self, executor_task_id, *path_components):
293295
'map': Pickled file with a dict between local parsl names, and remote taskvine names.
294296
"""
295297
task_dir = "{:04d}".format(executor_task_id)
296-
return os.path.join(self._function_data_dir, task_dir, *path_components)
298+
return os.path.join(self._function_data_dir.name, task_dir, *path_components)
297299

298300
def submit(self, func, resource_specification, *args, **kwargs):
299301
"""Processes the Parsl app by its arguments and submits the function

parsl/tests/configs/slurm_local.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from parsl.channels import LocalChannel
2+
from parsl.config import Config
3+
from parsl.executors import HighThroughputExecutor
4+
from parsl.launchers import SrunLauncher
5+
from parsl.providers import SlurmProvider
6+
7+
8+
def fresh_config():
9+
return Config(
10+
executors=[
11+
HighThroughputExecutor(
12+
label="docker_slurm",
13+
encrypted=True,
14+
provider=SlurmProvider(
15+
cmd_timeout=60, # Add extra time for slow scheduler responses
16+
channel=LocalChannel(),
17+
nodes_per_block=1,
18+
init_blocks=1,
19+
min_blocks=1,
20+
max_blocks=1,
21+
walltime='00:10:00',
22+
launcher=SrunLauncher(),
23+
),
24+
)
25+
],
26+
)

parsl/tests/slurm-entrypoint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "---> Starting the MUNGE Authentication service (munged) ..."
5+
gosu munge /usr/sbin/munged
6+
7+
echo "---> Starting the slurmctld ..."
8+
exec gosu slurm /usr/sbin/slurmctld -i -Dvvv &
9+
10+
echo "---> Waiting for slurmctld to become active before starting slurmd..."
11+
12+
echo "---> Starting the Slurm Node Daemon (slurmd) ..."
13+
exec /usr/sbin/slurmd -Dvvv &
14+
15+
echo "---> Running user command '${@}'"
16+
exec "$@"

0 commit comments

Comments
 (0)