Skip to content

Commit

Permalink
Simplify everserver setup
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Sep 16, 2024
1 parent dfd0068 commit 8573661
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/everest/detached/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from everest.simulator import JOB_FAILURE, JOB_SUCCESS, Status
from everest.strings import (
EVEREST,
EVEREST_SERVER,
EVEREST_SERVER_CONFIG,
OPT_PROGRESS_ENDPOINT,
OPT_PROGRESS_ID,
SIM_PROGRESS_ENDPOINT,
Expand Down Expand Up @@ -361,7 +361,7 @@ def start_monitor(config: EverestConfig, callback, polling_interval=5):


_EVERSERVER_JOB_PATH = pkg_resources.resource_filename(
"everest.detached", os.path.join("jobs", EVEREST_SERVER)
"everest.detached", os.path.join("jobs", EVEREST_SERVER_CONFIG)
)

_QUEUE_SYSTEMS: Mapping[Literal["LSF", "SLURM"], dict] = {
Expand Down Expand Up @@ -478,19 +478,19 @@ def generate_everserver_ert_config(config: EverestConfig, debug_mode: bool = Fal
everserver_config.update(
{
"RUNPATH": simulation_path,
"JOBNAME": EVEREST_SERVER,
"JOBNAME": EVEREST_SERVER_CONFIG,
"NUM_REALIZATIONS": 1,
"MAX_SUBMIT": 1,
"ENSPATH": os.path.join(detached_node_dir, EVEREST_SERVER),
"ENSPATH": os.path.join(detached_node_dir, EVEREST_SERVER_CONFIG),
"RUNPATH_FILE": os.path.join(detached_node_dir, ".res_runpath_list"),
}
)
install_job = everserver_config.get("INSTALL_JOB", [])
install_job.append((EVEREST_SERVER, _EVERSERVER_JOB_PATH))
install_job.append((EVEREST_SERVER_CONFIG, _EVERSERVER_JOB_PATH))
everserver_config["INSTALL_JOB"] = install_job

simulation_job = everserver_config.get("SIMULATION_JOB", [])
simulation_job.append([EVEREST_SERVER] + arg_list)
simulation_job.append([EVEREST_SERVER_CONFIG] + arg_list)
everserver_config["SIMULATION_JOB"] = simulation_job

if queue_system in _QUEUE_SYSTEMS:
Expand Down
10 changes: 2 additions & 8 deletions src/everest/detached/jobs/everserver.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env python
import argparse
import json
import logging
import os
import socket
import ssl
import sys
import threading
import traceback
from base64 import b64encode
Expand Down Expand Up @@ -218,11 +216,11 @@ def _configure_loggers(config: EverestConfig):
)


def main(args):
def main():
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("--config-file", type=str)
arg_parser.add_argument("--debug", action="store_true")
options, _ = arg_parser.parse_known_args(args=args)
options = arg_parser.parse_args()
config = EverestConfig.load_file(options.config_file)
if options.debug:
config.logging_level = "debug"
Expand Down Expand Up @@ -411,7 +409,3 @@ def _generate_authentication():
n_bytes = 128
random_bytes = bytes(os.urandom(n_bytes))
return b64encode(random_bytes).decode("utf-8")


if __name__ == "__main__":
main(sys.argv[1:])
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
EXECUTABLE everserver.py
EXECUTABLE everserver

STDOUT ../../logs/everest_server.stdout
STDERR ../../logs/everest_server.stderr
2 changes: 1 addition & 1 deletion src/everest/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
DEFAULT_OUTPUT_DIR = "everest_output"
DEFAULT_LOGGING_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s"

EVEREST_SERVER = "everserver"
EVEREST_SERVER_CONFIG = "everserver_config"
EVEREST = "everest"

HOSTFILE_NAME = "hostfile"
Expand Down

0 comments on commit 8573661

Please sign in to comment.