From b64778993b0cb8569637775cb36ea35974dd081c Mon Sep 17 00:00:00 2001 From: Ross Whitfield Date: Wed, 26 Oct 2022 13:26:54 -0400 Subject: [PATCH 1/2] Add Python 3.11 to CI --- .../workflows/conda_env/environment_linux.yml | 2 +- .../conda_env/environment_static_analysis.yml | 2 +- .github/workflows/workflows.yml | 3 +++ tests/new/test_bad_components.py | 16 +++++++++++----- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/conda_env/environment_linux.yml b/.github/workflows/conda_env/environment_linux.yml index 7a5f3f03..c58c55b9 100644 --- a/.github/workflows/conda_env/environment_linux.yml +++ b/.github/workflows/conda_env/environment_linux.yml @@ -7,7 +7,7 @@ dependencies: - psutil - mpi4py - openmpi -- dask=2022.9.2 +- dask=2022.10.0 - dakota - coverage!=6.3 - flask=2.2.2 diff --git a/.github/workflows/conda_env/environment_static_analysis.yml b/.github/workflows/conda_env/environment_static_analysis.yml index 8eda6602..1bddb456 100644 --- a/.github/workflows/conda_env/environment_static_analysis.yml +++ b/.github/workflows/conda_env/environment_static_analysis.yml @@ -7,7 +7,7 @@ dependencies: - pylint=2.15.3 - bandit=1.7.4 - codespell=2.2.1 -- dask=2022.9.2 +- dask=2022.10.0 - pytest - flask=2.2.2 - configobj diff --git a/.github/workflows/workflows.yml b/.github/workflows/workflows.yml index 843f6c9a..06204c26 100644 --- a/.github/workflows/workflows.yml +++ b/.github/workflows/workflows.yml @@ -55,6 +55,9 @@ jobs: - os: ubuntu-latest python-version: "3.10" conda_env: 'linux' + - os: ubuntu-latest + python-version: "3.11" + conda_env: 'minimal' - os: macos-latest python-version: 3.9 conda_env: 'macos' diff --git a/tests/new/test_bad_components.py b/tests/new/test_bad_components.py index 1d6dd32e..f6dca2f1 100644 --- a/tests/new/test_bad_components.py +++ b/tests/new/test_bad_components.py @@ -219,9 +219,13 @@ def test_assign_protected_attribute(tmpdir): with open(str(tmpdir.join('sim.log')), 'r') as f: lines = f.readlines() - # python 3.10 includes the attribute name in the error message - assert "AttributeError: can't set attribute\n" in lines or "AttributeError: can't set attribute 'args'\n" in lines - assert "Exception: can't set attribute\n" in lines or "Exception: can't set attribute 'args'\n" in lines + # python 3.10 and 3.11 have different AttributeError messages + assert ("AttributeError: can't set attribute\n" in lines or + "AttributeError: can't set attribute 'args'\n" in lines or + "AttributeError: property 'args' of 'assign_protected_attribute' object has no setter\n" in lines) + assert ("Exception: can't set attribute\n" in lines or + "Exception: can't set attribute 'args'\n" in lines or + "Exception: property 'args' of 'assign_protected_attribute' object has no setter\n" in lines) # remove timestamp lines = [line[24:] for line in lines] @@ -238,9 +242,11 @@ def test_assign_protected_attribute(tmpdir): assert worker_call_end_event["code"] == "DRIVER__driver" assert worker_call_end_event["eventtype"] == "IPS_CALL_END" assert not worker_call_end_event['ok'] - # python 3.10 includes the attribute name in the error message + # python 3.10 and 3.11 have different error messages assert worker_call_end_event["comment"] in ("Error: \"can't set attribute\" Target = test@assign_protected_attribute@2:step(0)", - "Error: \"can't set attribute 'args'\" Target = test@assign_protected_attribute@2:step(0)") + "Error: \"can't set attribute 'args'\" Target = test@assign_protected_attribute@2:step(0)", + "Error: \"property 'args' of 'assign_protected_attribute' object has no setter\" " + "Target = test@assign_protected_attribute@2:step(0)") sim_end_event = events[10] assert sim_end_event["code"] == "Framework" From 2554615833945a9ff5f1fdb5b08c6868a925cf0e Mon Sep 17 00:00:00 2001 From: Ross Whitfield Date: Wed, 26 Oct 2022 14:42:00 -0400 Subject: [PATCH 2/2] nworkers --- ipsframework/services.py | 5 +++-- tests/new/test_dask.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ipsframework/services.py b/ipsframework/services.py index a2e70b9e..5e9e2bd1 100644 --- a/ipsframework/services.py +++ b/ipsframework/services.py @@ -2124,13 +2124,14 @@ def submit_dask_tasks(self, block=True, dask_nodes=1, dask_ppn=None, use_shifter dask_nodes = 1 nthreads = dask_ppn if dask_ppn else services.get_config_param("PROCS_PER_NODE") + nworkers = "--nworkers" if self.distributed.__version__ >= "2022.10" else "--nprocs" if use_shifter: self.dask_workers_tid = services.launch_task(dask_nodes, os.getcwd(), self.shifter, "dask-worker", "--scheduler-file", self.dask_file_name, - "--nprocs", 1, + nworkers, 1, "--nthreads", nthreads, "--no-dashboard", task_ppn=1) @@ -2139,7 +2140,7 @@ def submit_dask_tasks(self, block=True, dask_nodes=1, dask_ppn=None, use_shifter self.dask_worker, "--scheduler-file", self.dask_file_name, - "--nprocs", 1, + nworkers, 1, "--nthreads", nthreads, "--no-dashboard", task_ppn=1) diff --git a/tests/new/test_dask.py b/tests/new/test_dask.py index 08aa16f9..64107639 100644 --- a/tests/new/test_dask.py +++ b/tests/new/test_dask.py @@ -231,7 +231,7 @@ def test_dask_fake_shifter(tmpdir, monkeypatch): assert lines[0].startswith('Running dask-scheduler --no-dashboard --scheduler-file') assert lines[0].endswith('--port 0 in shifter\n') assert lines[1].startswith('Running dask-worker --scheduler-file') - assert lines[1].endswith('--nprocs 1 --nthreads 0 --no-dashboard in shifter\n') + assert lines[1].endswith('1 --nthreads 0 --no-dashboard in shifter\n') def test_dask_timeout(tmpdir):