Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
frode-aarstad committed Dec 6, 2024
1 parent a335566 commit 7b4f84a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/everest/bin/everest_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ServerStatus,
everserver_status,
server_is_running,
start_experiment,
start_server,
wait_for_server,
)
Expand Down Expand Up @@ -130,6 +131,11 @@ async def run_everest(options):
print("Waiting for server ...")
wait_for_server(options.config.output_dir, timeout=600)
print("Everest server found!")

await start_experiment(server_context=ServerConfig.get_server_context(options.config.output_dir),
config=options.config,
debug=options.debug)

run_detached_monitor(
server_context=ServerConfig.get_server_context(options.config.output_dir),
optimization_output_dir=options.config.optimization_output_dir,
Expand Down
16 changes: 16 additions & 0 deletions src/everest/detached/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
OPT_PROGRESS_ID,
SIM_PROGRESS_ENDPOINT,
SIM_PROGRESS_ID,
START_ENDPOINT,
STOP_ENDPOINT,
)

Expand All @@ -51,6 +52,21 @@
# everest.log file instead


async def start_experiment(server_context: Tuple[str, str, Tuple[str, str]], config: EverestConfig, debug: bool = False) -> None:
try:
url, cert, auth = server_context
start_endpoint = "/".join([url, START_ENDPOINT])
response = requests.post(
start_endpoint,
verify=cert,
auth=auth,
proxies=PROXY, # type: ignore
)
response.raise_for_status()
except:
raise ValueError("Failed to start experiment") from None


async def start_server(config: EverestConfig, debug: bool = False) -> Driver:
"""
Start an Everest server running the optimization defined in the config
Expand Down
6 changes: 3 additions & 3 deletions src/everest/detached/jobs/everserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ def main():

update_everserver_status(status_path, ServerStatus.running)

response = requests.post(
url + "/" + START_ENDPOINT, verify=cert, auth=auth, proxies=PROXY
)
#response = requests.post(
# url + "/" + START_ENDPOINT, verify=cert, auth=auth, proxies=PROXY
#)

is_done = False
while not is_done:
Expand Down

0 comments on commit 7b4f84a

Please sign in to comment.