Skip to content

Commit ceaf6b1

Browse files
committed
Merge remote-tracking branch 'origin/main' into ssh_windows_support
# Conflicts: # .github/workflows/test.yml
2 parents 16d3144 + 822b723 commit ceaf6b1

File tree

16 files changed

+1587
-1659
lines changed

16 files changed

+1587
-1659
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
- python: "3.9"
4848
runs_on: macos-14
4949
- python: "3.11"
50+
- python: "3.12"
51+
pre: pre
5052

5153
steps:
5254
- uses: actions/checkout@v4
@@ -87,7 +89,7 @@ jobs:
8789
export DOCKER_BUILDKIT=1
8890
export COMPOSE_DOCKER_CLI_BUILD=1
8991
cd ci/slurm
90-
docker-compose up -d --build
92+
docker compose up -d --build
9193
9294
- name: Install Python (conda) ${{ matrix.python }}
9395
if: ${{ matrix.cluster_type == 'mpi' }}
@@ -113,16 +115,17 @@ jobs:
113115
114116
- name: Install Python dependencies
115117
run: |
116-
pip install --pre --upgrade ipyparallel[test]
118+
pip install --upgrade ipyparallel[test]
119+
120+
- name: Install pre-release dependencies
121+
if: ${{ matrix.pre }}
122+
run: |
123+
pip install --pre --upgrade ipyparallel[test] 'https://github.com/ipython/ipykernel/archive/main.tar.gz#egg=ipykernel'
117124
118125
- name: Install extra Python packages
119126
if: ${{ ! startsWith(matrix.python, '3.11') }}
120127
run: |
121128
pip install distributed joblib
122-
# pip install --only-binary :all: matplotlib || echo "no matplotlib"#
123-
# the || syntax doesn't work under windows powershell, but since the command (currently) works for all
124-
# python version (>3.8), the "||" branch can be simply removed. Otherwise we would need a splitted
125-
# step for Windows and Linux (as for the docker-compose command)
126129
pip install --only-binary :all: matplotlib
127130
128131
- name: Show environment
@@ -156,8 +159,8 @@ jobs:
156159
run: |
157160
set -x
158161
docker ps -a
159-
docker logs slurmctld
160162
docker exec -i slurmctld squeue --states=all
161163
docker exec -i slurmctld sinfo
164+
docker logs slurmctld
162165
docker logs c1
163166
docker logs c2

docs/source/tutorial/process.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,8 @@ in some scratch directory. This can be set with:
789789
c.IPEngine.work_dir = u'/path/to/scratch/'
790790
```
791791

792+
[^cite_mpi]: Message Passing Interface (MPI) <https://www.mpi-forum.org>
793+
792794
[^cite_mongodb]: MongoDB database <https://www.mongodb.com/>
793795

794796
[^cite_pbs]: Portable Batch System <https://www.mcs.anl.gov/research/projects/openpbs/>

ipyparallel/apps/baseapp.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import re
88
import sys
99

10-
import traitlets
1110
from IPython.core.application import BaseIPythonApplication
1211
from IPython.core.application import base_aliases as base_ip_aliases
1312
from IPython.core.application import base_flags as base_ip_flags
@@ -21,15 +20,6 @@
2120

2221
from .._version import __version__
2322

24-
# FIXME: CUnicode is needed for cli parsing
25-
# with traitlets 4
26-
# bump when we require traitlets 5, which requires Python 3.7
27-
if int(traitlets.__version__.split(".", 1)[0]) < 5:
28-
from traitlets import CUnicode
29-
else:
30-
# don't need CUnicode with traitlets 4
31-
CUnicode = Unicode
32-
3323
# -----------------------------------------------------------------------------
3424
# Module errors
3525
# -----------------------------------------------------------------------------
@@ -107,7 +97,7 @@ def _work_dir_changed(self, change):
10797
'', config=True, help="The ZMQ URL of the iplogger to aggregate logging."
10898
)
10999

110-
cluster_id = CUnicode(
100+
cluster_id = Unicode(
111101
'',
112102
config=True,
113103
help="""String id to add to runtime files, to prevent name collisions when

ipyparallel/cluster/launcher.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,10 @@ async def join(self, timeout=None):
564564
"""Wait for the process to exit"""
565565
if self._wait_thread is not None:
566566
self._wait_thread.join(timeout=timeout)
567+
if self._wait_thread.is_alive():
568+
raise TimeoutError(
569+
f"Process {self.process.pid} did not exit in {timeout} seconds."
570+
)
567571

568572
def _stream_file(self, path):
569573
"""Stream one file"""
@@ -1873,6 +1877,17 @@ def __init__(self, work_dir='.', config=None, **kwargs):
18731877
# trigger program_changed to populate default context arguments
18741878
self._program_changed()
18751879

1880+
def _run_command(self, command, **kwargs):
1881+
joined_command = shlex_join(command)
1882+
self.log.debug("Running command: %s", joined_command)
1883+
output = check_output(
1884+
command,
1885+
stdin=None,
1886+
**kwargs,
1887+
).decode("utf8", "replace")
1888+
self.log.debug("Command %s output: %s", command[0], output)
1889+
return output
1890+
18761891
def parse_job_id(self, output):
18771892
"""Take the output of the submit command and return the job id."""
18781893
m = self.job_id_regexp.search(output)
@@ -1947,42 +1962,24 @@ def start(self, n=1):
19471962

19481963
env = os.environ.copy()
19491964
env.update(self.get_env())
1950-
output = check_output(self.args, env=env)
1951-
output = output.decode("utf8", 'replace')
1952-
self.log.debug(f"Submitted {shlex_join(self.args)}. Output: {output}")
1965+
output = self._run_command(self.args, env=env)
19531966

19541967
job_id = self.parse_job_id(output)
19551968
self.notify_start(job_id)
19561969
return job_id
19571970

19581971
def stop(self):
1959-
try:
1960-
output = check_output(
1961-
self.delete_command + [self.job_id],
1962-
stdin=None,
1963-
).decode("utf8", 'replace')
1964-
except Exception:
1965-
self.log.exception(
1966-
"Problem stopping cluster with command: %s"
1967-
% (self.delete_command + [self.job_id])
1968-
)
1969-
output = ""
1972+
command = self.delete_command + [self.job_id]
1973+
output = self._run_command(command)
19701974

19711975
self.notify_stop(
19721976
dict(job_id=self.job_id, output=output)
19731977
) # Pass the output of the kill cmd
19741978
return output
19751979

19761980
def signal(self, sig):
1977-
cmd = self.signal_command + [str(sig), self.job_id]
1978-
try:
1979-
output = check_output(
1980-
cmd,
1981-
stdin=None,
1982-
).decode("utf8", 'replace')
1983-
except Exception:
1984-
self.log.exception("Problem sending signal with: {shlex_join(cmd)}")
1985-
output = ""
1981+
command = self.signal_command + [str(sig), self.job_id]
1982+
self._run_command(command)
19861983

19871984
# same local-file implementation as LocalProcess
19881985
# should this be on the base class?

0 commit comments

Comments
 (0)