mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-30 19:03:03 +02:00
updating to use environment variables
This commit is contained in:
parent
1632dceaa2
commit
75e3c6a3c4
1 changed files with 7 additions and 2 deletions
|
@ -117,9 +117,11 @@ def update_results_file(task_id, success_count, total_count, time_taken, experim
|
|||
def launch_server_experiment(task_path, task_id, num_exp, server, num_agents=2, model="gpt-4o"):
|
||||
server_path, server_port = server
|
||||
edit_server_properties_file(server_path, server_port)
|
||||
mindserver_port = server_port - 55916 + 8080
|
||||
|
||||
# rename the agents for logging purposes
|
||||
# TODO: fix the file naming procedure
|
||||
# copy the memory.json into a new folder for each run based on the date and time
|
||||
|
||||
|
||||
session_name = str(server_port - 55916)
|
||||
|
@ -131,12 +133,15 @@ def launch_server_experiment(task_path, task_id, num_exp, server, num_agents=2,
|
|||
models = [model] * 3
|
||||
make_profiles(agent_names, models)
|
||||
|
||||
edit_settings("settings.js", {"port": server_port,
|
||||
"profiles": [f"./{agent}.json" for agent in agent_names]})
|
||||
edit_settings("settings.js", {"profiles": [f"./{agent}.json" for agent in agent_names]})
|
||||
launch_world(server_path, session_name="server_" + session_name, agent_names=agent_names)
|
||||
|
||||
subprocess.run(['tmux', 'new-session', '-d', '-s', session_name], check=True)
|
||||
|
||||
# set environment variables
|
||||
subprocess.run(["tmux", "send-keys", "-t", session_name, f"export MINECRAFT_PORT={server_port}", "C-m"])
|
||||
subprocess.run(["tmux", "send-keys", "-t", session_name, f"export MINDSERVER_PORT={mindserver_port}", "C-m"])
|
||||
|
||||
cmd = f"node main.js --task_path {task_path} --task_id {task_id}"
|
||||
for _ in range(num_exp):
|
||||
# Send the command and a newline (C-m) to execute it
|
||||
|
|
Loading…
Add table
Reference in a new issue