Skip to content

Conversation

@flikka
Copy link
Contributor

@flikka flikka commented Nov 12, 2025

Issue
Resolves #12236

Approach
Revert back the IP selection with private and public, but use public by default
This paves way for a configurable site-config variable.

Adds a test that can be run on LSF queue cluster, that will fail (timeout) if network used is not reachable

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'just rapid-tests')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Add backport label to latest release (format: 'backport release-branch-name')

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR re-introduces the ability to select between private and public IP addresses for network communication, defaulting to public IPs. The change reverts from a simpler socket-based IP detection to an approach that examines all network interfaces and classifies them as loopback, private, or public.

Key Changes

  • Refactored get_ip_address() to support optional prioritization of private vs. public IPs
  • Added comprehensive unit tests for IP address selection logic across various network configurations
  • Added integration test for ZMQ server communication over TCP using drivers (LocalDriver and LsfDriver)

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/ert/shared/net_utils.py Replaced socket-based IP detection with psutil-based interface enumeration; added prioritize_private parameter to get_ip_address()
tests/ert/unit_tests/shared/test_net_utils.py Added parameterized unit tests covering IP selection scenarios with mock network interfaces
tests/ert/unit_tests/scheduler/test_that_fm_dispatch_can_communicate_with_zmq_server.py New integration test verifying fm_dispatch communication with ZMQ server over TCP on LSF/local drivers
Comments suppressed due to low confidence (1)

src/ert/shared/net_utils.py:1

  • Typo in parameter name: 'psutils_if_addrs' should be 'psutil_if_addrs' (missing 'i'). The module is called 'psutil', not 'psutils'. This appears in the test parameter name mock_psutils_if_addrs on line 365 as well.
import ipaddress

@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.63%. Comparing base (37cea39) to head (248baa0).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12269      +/-   ##
==========================================
- Coverage   90.64%   90.63%   -0.01%     
==========================================
  Files         434      433       -1     
  Lines       29015    29028      +13     
==========================================
+ Hits        26300    26310      +10     
- Misses       2715     2718       +3     
Flag Coverage Δ
cli-tests 37.77% <12.50%> (-0.03%) ⬇️
gui-tests 69.15% <12.50%> (+0.03%) ⬆️
performance-and-unit-tests 74.02% <100.00%> (-0.03%) ⬇️
test 38.59% <12.50%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 12, 2025

CodSpeed Performance Report

Merging #12269 will not alter performance

Comparing flikka:test_zmq_network_ok (248baa0) with main (efe13e8)

Summary

✅ 22 untouched

- Add optional flag to prioritize private IPs, default false
- Update tests for correct ip address fetching

This reverts commit 75b190d.
Test will time out if ip is not reachable
@flikka flikka force-pushed the test_zmq_network_ok branch 18 times, most recently from 307e55f to bb34e64 Compare November 13, 2025 09:44
@flikka flikka force-pushed the test_zmq_network_ok branch 9 times, most recently from 7af284f to a7784ef Compare November 13, 2025 14:12
@flikka flikka changed the title WIP: Re-introduce public and private ip-getting, add LSF test Re-introduce public and private ip-getting, add LSF test Nov 13, 2025
@flikka flikka added the release-notes:improvement Automatically categorise as improvement in release notes label Nov 13, 2025
@flikka flikka force-pushed the test_zmq_network_ok branch from a7784ef to 248baa0 Compare November 14, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes:improvement Automatically categorise as improvement in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create integration test for communication between evaluator and fm_dispatch

2 participants