File size: 795 Bytes
4cfe1b1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | """Frozen-program entry point; no development agent and no reset capability."""
import importlib.util
import sys
sys.path.insert(0,'/artifact')
sys.path.insert(0,'/')
from worker_api import API
def main():
spec=importlib.util.spec_from_file_location('controller','/artifact/controller.py')
module=importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
module.reset_episode()
api=API()
result=api.latest_observation()
while not (result['terminated'] or result['truncated'] or result['horizon_reached']):
obs=dict(result['observation'],step_id=result['step_id'])
action=module.act(obs)
if action is None:break
response=api.execute_actions([action])
result=response['steps'][-1]
if __name__=='__main__':main()
|