Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V13 backports #9862

Merged
merged 48 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
30266c6
Make checking parent alive more portable
eivindjahren Jan 20, 2025
b437827
Add check-all to justfile
eivindjahren Jan 20, 2025
5518481
Add unit tests to pre-commit
oyvindeide Jan 20, 2025
bf7d182
Remove redundant apt download in run-ert-test-data
larsevj Jan 20, 2025
a1a2d59
Add integration test label to potentially conflicting tests
xjules Jan 21, 2025
91f0484
Trust the queue system when a job is finished in tests
berland Jan 20, 2025
fe97d1b
Mark ES_MDA as recommended algorithm in GUI
berland Jan 16, 2025
b4ac65e
Fix rerun button not disabled for ES-MDA
jonathan-eq Jan 21, 2025
70c89e6
zmq: replace server_started Event with Future to handle exceptions
xjules Jan 15, 2025
411bfc5
Add everest to rapid tests
eivindjahren Jan 22, 2025
0dfb678
Adapt Slurm setup to Ubuntu 24.04
berland Jan 21, 2025
e70740d
Skip slow tests in mac ci
eivindjahren Jan 22, 2025
53f78e3
Fix mac select string
eivindjahren Jan 22, 2025
bef4261
Add tests for flow vs OMP_NUM_THREADS
berland Jan 21, 2025
f4eb706
Fix unable to have path object in argslist for localdriver
jonathan-eq Jan 21, 2025
8dfe8ab
Divide instead of multiply with observation errors in misfit preproce…
larsevj Jan 22, 2025
c065695
Add event serialization testing
DanSava Dec 17, 2024
9824ff6
Reduce test matrix for flow and slurm tests
eivindjahren Jan 23, 2025
ceade12
Increase timeout of killed_ert_does_not_leave_storage_server_process
eivindjahren Jan 23, 2025
f0019af
Skip testing lsf/openpbs in slurm specific test
berland Jan 23, 2025
e2b6898
Do not split integration_test in everest
eivindjahren Jan 23, 2025
aad9552
Have parameter config keep parameters types for design matrix
jonathan-eq Jan 22, 2025
0937c6e
Fix bug where only literal error had position info
frode-aarstad Jan 21, 2025
9fde13f
zmq: implement task for heeartbeats on clients to detect reconnection
xjules Jan 17, 2025
eb8e652
Make the run dialogue snappier by tuning batching interval
berland Jan 21, 2025
f7fcf5a
Remove tests for OMP_NUM_THREADS
berland Jan 23, 2025
516578b
Fix mac failing on main
eivindjahren Jan 23, 2025
4c136de
Install correct dependency and adjust slurm config
berland Jan 23, 2025
7e179f6
Combine running of unit and performance tests
eivindjahren Jan 23, 2025
92ce748
Fix deprecated use of get_event_loop
eivindjahren Jan 23, 2025
993b3d8
Remove unused async_utils.py
eivindjahren Jan 23, 2025
234fc9f
Ensure SETENV is also substituted when writing json
berland Jan 23, 2025
3abeea9
Fix get_priors test
eivindjahren Jan 24, 2025
4c337a0
Raise ConfigValidationError on short parameter file lines
eivindjahren Jan 24, 2025
1d199a0
Make design_matrix parameter_configuration a single GenKw element
xjules Jan 22, 2025
785eb69
zmq: Speed up tests using MockZMQServer
eivindjahren Jan 24, 2025
920efa8
zmq: Add integration_test marker to slow tests
eivindjahren Jan 24, 2025
54e6444
zmq: Speed up test_invalid_server
eivindjahren Jan 24, 2025
b7795d9
Speed up test_default_installed_jobs
eivindjahren Jan 24, 2025
7914ce3
Speed up lsf driver tests
eivindjahren Jan 24, 2025
421971c
Fix everest tests failing when using editable installs
larsevj Jan 24, 2025
9e44c8a
zmq: add test that monitor can't connect to a secured server
xjules Dec 30, 2024
625b256
Use tmp_path for test_everest_to_ert_controls
larsevj Jan 24, 2025
4a2e5e3
Ensure cpu_seconds is always reported increasingly
berland Jan 24, 2025
dce4e05
zmq: make sure client disconnects before moczmqserver closes
xjules Jan 24, 2025
b01c868
Add no_dealers Event to mockzmqserver
xjules Jan 24, 2025
ed7ce1a
Change port range of dark storage
JHolba Jan 28, 2025
ad04429
zmq: await server started first then create all evaluator tasks
xjules Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _Short description of the approach_
- [ ] Added appropriate release note label
- [ ] Commit history is consistent and clean, in line with the [contribution guidelines](https://github.com/equinor/ert/blob/main/CONTRIBUTING.md).
- [ ] Make sure unit tests pass locally after every commit (`git rebase -i main
--exec 'pytest tests/ert/unit_tests -n auto --hypothesis-profile=fast -m "not integration_test"'`)
--exec 'pytest tests/ert/unit_tests tests/everest -n auto --hypothesis-profile=fast -m "not integration_test"'`)

## When applicable
- [ ] **When there are user facing changes**: Updated documentation
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-type: [ 'performance-tests', 'unit-tests', 'gui-tests', 'cli-tests' ]
test-type: [ 'performance-and-unit-tests', 'gui-tests', 'cli-tests' ]
python-version: [ '3.11', '3.12' ]
os: [ ubuntu-latest ]
uses: ./.github/workflows/test_ert.yml
Expand All @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-type: [ 'test', 'integration-test', 'everest-models-test', 'doc']
test-type: [ 'test', 'everest-models-test', 'doc']
python-version: [ '3.11', '3.12' ]
os: [ ubuntu-latest ]
exclude:
Expand All @@ -66,7 +66,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.11', '3.12' ]
python-version: [ '3.11' ]
uses: ./.github/workflows/test_ert_with_slurm.yml
with:
os: ${{ matrix.os }}
Expand All @@ -78,7 +78,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.11', '3.12' ]
python-version: [ '3.11' ]
uses: ./.github/workflows/test_ert_with_flow.yml
with:
os: ${{ matrix.os }}
Expand All @@ -90,7 +90,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-type: [ 'test', 'integration-test', 'everest-models-test' ]
test-type: [ 'test', 'everest-models-test' ]
os: [ 'macos-latest' ]
python-version: [ '3.12' ]

Expand All @@ -106,7 +106,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-type: [ 'performance-tests', 'unit-tests', 'gui-tests', 'cli-tests' ]
test-type: [ 'performance-and-unit-tests', 'gui-tests', 'cli-tests' ]
python-version: [ '3.12' ]
os: [ 'macos-latest']

Expand All @@ -115,6 +115,7 @@ jobs:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
test-type: ${{ matrix.test-type }}
select-string: '"not skip_mac_ci"'
secrets: inherit

docs-ert:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/run_ert_test_data_setups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Ubuntu dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install xvfb libxcb-image0 libxcb-icccm4 libxcb-keysyms1 libxcb-randr0 libxcb-render0 libxcb-render-util0 libxcb-shape0 libxcb-shm0 libxcb-xfixes0 libxcb-xinerama0 libfontconfig1 libxcb-xkb1 libxkbcommon-x11-0 libdbus-1-3

- name: Install uv
uses: astral-sh/setup-uv@v5

Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/test_ert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
type: string
test-type:
type: string
select-string:
type: string
default: "''"

env:
ERT_SHOW_BACKTRACE: 1
Expand Down Expand Up @@ -40,7 +43,7 @@ jobs:
- name: GUI Test
if: inputs.test-type == 'gui-tests'
run: |
pytest --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -v --mpl --benchmark-disable tests/ert/ui_tests/gui --durations=25
pytest -m ${{ inputs.select-string }} --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -v --mpl --benchmark-disable tests/ert/ui_tests/gui --durations=25

- name: Upload artifact images
uses: actions/upload-artifact@v4
Expand All @@ -53,19 +56,14 @@ jobs:
- name: CLI Test
if: inputs.test-type == 'cli-tests'
run: |
pytest --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -v --benchmark-disable --dist loadgroup tests/ert/ui_tests/cli --durations=25
pytest -m ${{ inputs.select-string }} --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -v --benchmark-disable --dist loadgroup tests/ert/ui_tests/cli --durations=25

- name: Unit Test
if: inputs.test-type == 'unit-tests'
if: inputs.test-type == 'performance-and-unit-tests'
run: |
pytest --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -n logical --show-capture=stderr -v --benchmark-disable --mpl --dist loadgroup tests/ert/unit_tests --durations=25
pytest -m ${{ inputs.select-string }} --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -n logical --show-capture=stderr -v --benchmark-disable --mpl --dist loadgroup tests/ert/unit_tests tests/ert/performance_tests --durations=25
pytest --doctest-modules --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov2.xml src/ --ignore src/ert/dark_storage

- name: Performance Test
if: inputs.test-type == 'performance-tests'
run: |
pytest --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -n logical --show-capture=stderr -v --benchmark-disable --dist loadgroup tests/ert/performance_tests --durations=25

- name: Upload coverage to Codecov
id: codecov1
uses: codecov/codecov-action@v5
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/test_ert_with_slurm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
test-ert-on-slurm:
name: Run ert tests
timeout-minutes: 20
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand All @@ -34,13 +34,20 @@ jobs:
run: |
set -e

sudo apt install slurmd slurmctld -y
sudo apt install libpmix-dev slurmd slurmctld -y

sudo mkdir /var/spool/slurm
sudo chown slurm /var/spool/slurm

cat <<EOF > slurm.conf
ClusterName=localcluster
SlurmUser=slurm
SlurmctldHost=localhost
SelectType=select/cons_res # Select nodes based on consumable resources
SchedulerType=sched/builtin # Avoid default backfill scheduler which adds delays
SelectType=select/cons_tres # Select nodes based on consumable resources
SelectTypeParameters=CR_Core # Cores are the consumable resource
StateSaveLocation=/var/spool/slurm
PriorityType=priority/basic # Tests depend on FIFO scheduling
ProctrackType=proctrack/linuxproc # Use /proc to track processes
PartitionName=LocalQ Nodes=ALL Default=YES MaxTime=INFINITE State=UP
PartitionName=AlternativeQ Nodes=ALL Default=YES MaxTime=INFINITE State=UP
Expand All @@ -54,9 +61,13 @@ jobs:
sudo mv slurm.conf /etc/slurm/
sudo systemctl start slurmd # The compute node slurm daemon
sudo systemctl start slurmctld # The slurm controller daemon
sleep 1
systemctl status slurmd
systemctl status slurmctld

# Show partition and node information configured:
sinfo
scontrol show nodes

- name: Verify slurm cluster works
# Timeout is set low to catch a misconfigured cluster where srun will hang.
Expand All @@ -69,7 +80,10 @@ jobs:
run: |
set -e
export _ERT_TESTS_ALTERNATIVE_QUEUE=AlternativeQ
pytest tests/ert/unit_tests/scheduler --slurm
pytest tests/ert/unit_tests/scheduler/test_{generic,slurm}_driver.py -sv --slurm \
-n 8 --durations=10 -k "not (LsfDriver or LocalDriver or OpenPBSDriver)"
scontrol show job

pytest tests/ert/ui_tests/cli/test_missing_runpath.py --slurm

- name: Test poly-example on slurm
Expand Down
14 changes: 2 additions & 12 deletions .github/workflows/test_everest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,12 @@ jobs:
- name: Run Tests Linux
if: ${{ inputs.test-type == 'test' && runner.os != 'macOS'}}
run: |
pytest tests/everest -n 4 --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -m "not integration_test" --dist loadgroup -sv
pytest tests/everest -n 4 --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy --dist loadgroup -sv

- name: Run Tests macOS
if: ${{ inputs.test-type == 'test' && runner.os == 'macOS'}}
run: |
python -m pytest tests/everest -n 4 --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -m "not integration_test and not fails_on_macos_github_workflow" --dist loadgroup -sv

- name: Run Integration Tests Linux
if: ${{inputs.test-type == 'integration-test' && runner.os != 'macOS'}}
run: |
pytest tests/everest -n 4 --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -m "integration_test" --dist loadgroup -sv

- name: Run Integration Tests macOS
if: ${{inputs.test-type == 'integration-test' && runner.os == 'macOS'}}
run: |
python -m pytest tests/everest -n 4 --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -m "integration_test and not fails_on_macos_github_workflow" --dist loadgroup
python -m pytest tests/everest -n 4 --cov=ert --cov=everest --cov=_ert --cov-report=xml:cov1.xml --junit-xml=junit.xml -o junit_family=legacy -m "not skip_mac_ci" --dist loadgroup -sv

- name: Build Documentation
if: inputs.test-type == 'doc'
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
default_install_hook_types: [pre-commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand All @@ -16,3 +17,14 @@ repos:
- id: ruff
args: [ --fix ]
- id: ruff-format

- repo: local
hooks:
- id: pytest
name: pytest
entry: pytest
args: [-n, auto, tests/ert/unit_tests, tests/everest, --hypothesis-profile=fast, -m, not integration_test]
language: system
types: [python]
stages: [pre-push]
pass_filenames: false
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ There are many kinds of tests in the `tests` directory, while iterating on your
code you can run a fast subset of the tests with

```sh
pytest -n auto --hypothesis-profile=fast tests/ert/unit_tests -m "not integration_test"
pytest -n auto --hypothesis-profile=fast tests/ert/unit_tests tests/everest -m "not integration_test"
```

[Git LFS](https://git-lfs.com/) must be installed to get all the files. This is
Expand Down Expand Up @@ -124,6 +124,14 @@ $ pip install pre-commit
$ pre-commit install
```

There is also a pre-push hook configured in `pre-commit` to run a collection of
relatively fast tests, to install this hook:

```sh
$ pre-commit install --hook-type pre-push
```


### Trouble with setup

As a simple test of your `ert` installation, you may try to run one of the
Expand Down
12 changes: 11 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ snake_oil:

# execute rapid unittests
rapid-tests:
nice pytest -n auto tests/ert/unit_tests --hypothesis-profile=fast -m "not integration_test"
nice pytest -n auto tests/ert/unit_tests tests/everest --hypothesis-profile=fast -m "not integration_test"

check-all:
mypy src/ert src/everest
pre-commit run --all-files
pytest tests/everest -n 4 -m everest_models_test --dist loadgroup
pytest tests/everest -n 4 -m integration_test --dist loadgroup
pytest tests/ert/ui_tests/ --mpl --dist loadgroup
pytest tests/ert/unit_tests/ -n 4 --dist loadgroup
pytest --doctest-modules src/ --ignore src/ert/dark_storage
pytest tests/ert/performance_tests --benchmark-disable --dist loadgroup
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ markers = [
"slow",
"everest_models_test",
"integration_test",
"fails_on_macos_github_workflow", # Tests marked fail due to gui-related issues
"skip_mac_ci",
]
log_cli = "false"
asyncio_mode = "auto"
Expand Down
54 changes: 0 additions & 54 deletions src/_ert/async_utils.py

This file was deleted.

18 changes: 16 additions & 2 deletions src/_ert/forward_model_runner/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ClientConnectionError(Exception):
CONNECT_MSG = b"CONNECT"
DISCONNECT_MSG = b"DISCONNECT"
ACK_MSG = b"ACK"
HEARTBEAT_MSG = b"BEAT"
HEARTBEAT_TIMEOUT = 5.0


class Client:
Expand Down Expand Up @@ -83,7 +85,7 @@ async def connect(self) -> None:
await self._term_receiver_task()
self._receiver_task = asyncio.create_task(self._receiver())
try:
await self.send(CONNECT_MSG, retries=1)
await self.send(CONNECT_MSG)
except ClientConnectionError:
await self._term_receiver_task()
self.term()
Expand All @@ -93,11 +95,23 @@ async def process_message(self, msg: str) -> None:
raise NotImplementedError("Only monitor can receive messages!")

async def _receiver(self) -> None:
last_heartbeat_time: float | None = None
while True:
try:
_, raw_msg = await self.socket.recv_multipart()
if raw_msg == ACK_MSG:
self._ack_event.set()
elif raw_msg == HEARTBEAT_MSG:
if (
last_heartbeat_time
and (asyncio.get_running_loop().time() - last_heartbeat_time)
> 2 * HEARTBEAT_TIMEOUT
):
await self.socket.send_multipart([b"", CONNECT_MSG])
logger.warning(
f"{self.dealer_id} heartbeat failed - reconnecting."
)
last_heartbeat_time = asyncio.get_running_loop().time()
else:
await self.process_message(raw_msg.decode("utf-8"))
except zmq.ZMQError as exc:
Expand Down Expand Up @@ -144,5 +158,5 @@ async def send(self, message: str | bytes, retries: int | None = None) -> None:
self.socket.connect(self.url)
backoff = min(backoff * 2, 10) # Exponential backoff
raise ClientConnectionError(
f"{self.dealer_id} Failed to send {message!r} after retries!"
f"{self.dealer_id} Failed to send {message!r} to {self.url} after retries!"
)
Loading
Loading