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

Remove logging_level setter from Everest config #9806

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

DanSava
Copy link
Contributor

@DanSava DanSava commented Jan 20, 2025

Issue

Approach

  • Remove the workaround to allow property setters for EverestConfig

(Screenshot of new behavior in GUI if applicable)

  • 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 'pytest tests/ert/unit_tests -n auto -m "not integration_test"')

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: Create Backport PR to latest release

@DanSava DanSava added release-notes:maintenance Automatically categorise as maintenance change in release notes release-notes:logging PR which only changes logging. labels Jan 20, 2025
@DanSava DanSava self-assigned this Jan 20, 2025
Copy link

codspeed-hq bot commented Jan 20, 2025

CodSpeed Performance Report

Merging #9806 will not alter performance

Comparing DanSava:make-everest-config-imutable (bd04a01) with main (fd06848)

Summary

✅ 24 untouched benchmarks

Copy link
Collaborator

@oyvindeide oyvindeide left a comment

Choose a reason for hiding this comment

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

@DanSava DanSava force-pushed the make-everest-config-imutable branch from d3ef897 to 56d57d6 Compare January 20, 2025 13:19
@DanSava DanSava enabled auto-merge (rebase) January 20, 2025 13:20
@DanSava DanSava disabled auto-merge January 20, 2025 15:32
@DanSava
Copy link
Contributor Author

DanSava commented Jan 20, 2025

LGTM! Could we also set frozen? https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.frozen

I gave it a try but it seems we cannot right now. Some more work needs to be done before we can do it.

There are around 20 tests that are messing with an already instantiated config object that would need to be updated also the login in

@model_validator(mode="after")
def validate_queue_system(self) -> Self: # pylint: disable=E0213
if self.server is None:
self.server = ServerConfig(queue_system=copy(self.simulator.queue_system))
elif self.server.queue_system is None:
self.server.queue_system = copy(self.simulator.queue_system)
if (
str(self.simulator.queue_system.name).lower() == "local"
and str(self.server.queue_system.name).lower()
!= str(self.simulator.queue_system.name).lower()
):
raise ValueError(
f"The simulator is using local as queue system "
f"while the everest server is using {self.server.queue_system.name}. "
f"If the simulator is using local, so must the everest server."
)
self.server.queue_system.max_running = 1
return self

Will need to be updated as well.

Do you want to have that as part of this issue?

Remove workaround to allow property setters for EverestConfig
@DanSava DanSava force-pushed the make-everest-config-imutable branch from 56d57d6 to bd04a01 Compare January 21, 2025 06:27
@oyvindeide
Copy link
Collaborator

LGTM! Could we also set frozen? https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.frozen

I gave it a try but it seems we cannot right now. Some more work needs to be done before we can do it.

There are around 20 tests that are messing with an already instantiated config object that would need to be updated also the login in

@model_validator(mode="after")
def validate_queue_system(self) -> Self: # pylint: disable=E0213
if self.server is None:
self.server = ServerConfig(queue_system=copy(self.simulator.queue_system))
elif self.server.queue_system is None:
self.server.queue_system = copy(self.simulator.queue_system)
if (
str(self.simulator.queue_system.name).lower() == "local"
and str(self.server.queue_system.name).lower()
!= str(self.simulator.queue_system.name).lower()
):
raise ValueError(
f"The simulator is using local as queue system "
f"while the everest server is using {self.server.queue_system.name}. "
f"If the simulator is using local, so must the everest server."
)
self.server.queue_system.max_running = 1
return self

Will need to be updated as well.

Do you want to have that as part of this issue?

Will leave it up to you, if you dont fix it here, will you create another issue and put it into todo?

@DanSava DanSava changed the title Make EverestConfig immutable Remove logging_level setter from Everest config Jan 21, 2025
@DanSava DanSava merged commit 0b80ac1 into equinor:main Jan 21, 2025
33 checks passed
@DanSava DanSava deleted the make-everest-config-imutable branch January 21, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:logging PR which only changes logging. release-notes:maintenance Automatically categorise as maintenance change in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants