feat: Env/Goal pickling

This commit is contained in:
Leni Aniva 2024-12-11 16:36:55 -08:00
parent 359b5f8d47
commit fb8652d132
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
1 changed files with 30 additions and 0 deletions

View File

@ -294,6 +294,36 @@ class Server:
raise ServerError(result["desc"])
return result
def env_save(self, path: str):
result = self.run('env.save', {
"path": path,
})
if "error" in result:
raise ServerError(result["desc"])
def env_load(self, path: str):
result = self.run('env.load', {
"path": path,
})
if "error" in result:
raise ServerError(result["desc"])
def goal_save(self, goal_state: GoalState, path: str):
result = self.run('goal.save', {
"id": goal_state.state_id,
"path": path,
})
if "error" in result:
raise ServerError(result["desc"])
def goal_load(self, path: str) -> int:
# FIXME: Load the entire state
result = self.run('goal.load', {
"path": path,
})
if "error" in result:
raise ServerError(result["desc"])
state_id = result['id']
return state_id
def get_version():
import subprocess