Skip to content

Commit

Permalink
(Temp) print everything
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Oct 3, 2024
1 parent 018c14a commit 4ea15f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/everest/bin/everest_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import threading
from functools import partial

import debugpy

Check failure on line 10 in src/everest/bin/everest_script.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Skipping analyzing "debugpy": module is installed, but missing library stubs or py.typed marker

from ert.config import ErtConfig
from ert.storage import open_storage
from everest.config import EverestConfig
Expand Down Expand Up @@ -81,7 +83,9 @@ def _build_args_parser():


def _run_everest(options, ert_config, storage):
print("Entering site config env thingy")
with PluginSiteConfigEnv():
print("_run_everest(options, ert_config, storage):")
context = start_server(options.config, ert_config, storage)
print("Waiting for server ...")
wait_for_server(options.config, timeout=600, context=context)
Expand All @@ -91,8 +95,14 @@ def _run_everest(options, ert_config, storage):


def run_everest(options):
print(f"run_everest({options})")

debugpy.listen(("localhost", 5678)) # Port can be any free port
print("Waiting for debugger to attach...")
debugpy.wait_for_client() # Pause execution and wait for the debugger to connect
logger = logging.getLogger("everest_main")
server_state = everserver_status(options.config)
print(f"server_state = {everserver_status(options.config)}")

if server_is_running(options.config):
config_file = options.config.config_file
Expand All @@ -105,10 +115,10 @@ def run_everest(options):
)
elif server_state["status"] == ServerStatus.never_run or options.new_run:
config_dict = options.config.to_dict()
logger.info("Running everest with config info\n {}".format(config_dict))
print("Running everest with config info\n {}".format(config_dict))
for fm_job in options.config.forward_model or []:
job_name = fm_job.split()[0]
logger.info("Everest forward model contains job {}".format(job_name))
print("Everest forward model contains job {}".format(job_name))

with PluginSiteConfigEnv():
ert_config = ErtConfig.with_plugins().from_dict(
Expand All @@ -123,6 +133,7 @@ def run_everest(options):
_run_everest(options, ert_config, storage)

server_state = everserver_status(options.config)
print(f"server_state = {everserver_status(options.config)}")
server_state_info = server_state["message"]
if server_state["status"] == ServerStatus.failed:
logger.error("Everest run failed with: {}".format(server_state_info))
Expand Down
1 change: 1 addition & 0 deletions src/everest/detached/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def start_server(config: EverestConfig, ert_config: ErtConfig, storage):
file_path=os.path.join(log_dir, "simulations.log"),
log_level=logging.INFO,
)
print("Configured loggers")

global _server # noqa: PLW0603
global _context # noqa: PLW0603
Expand Down

0 comments on commit 4ea15f7

Please sign in to comment.