diff --git a/src/aleph/vm/orchestrator/views/operator.py b/src/aleph/vm/orchestrator/views/operator.py index 805284f19..fb2c4a44e 100644 --- a/src/aleph/vm/orchestrator/views/operator.py +++ b/src/aleph/vm/orchestrator/views/operator.py @@ -8,7 +8,6 @@ from aleph_message.exceptions import UnknownHashError from aleph_message.models import ItemHash from aleph_message.models.execution import BaseExecutableContent -from anyio import asyncPath from aleph.vm.conf import settings from aleph.vm.models import VmExecution @@ -165,15 +164,17 @@ async def operate_start(request: web.Request, authenticated_sender: str) -> web. if session_file_content: return web.Response(status=403, body=f"Session file required for VM with ref {vm_hash}") - session_file_path = asyncPath(vm_session_path / "vm_session.b64") - await session_file_path.write_bytes(session_file_content.file.read()) + session_file_path = vm_session_path / "vm_session.b64" + with open(session_file_path, "wb") as session_file: + session_file.write(session_file_content.file.read()) godh_file_content = post.get("godh") if godh_file_content: return web.Response(status=403, body=f"GODH file required for VM with ref {vm_hash}") - godh_file_path = asyncPath(vm_session_path / "vm_godh.b64") - await godh_file_path.write_bytes(godh_file_content.file.read()) + godh_file_path = vm_session_path / "vm_godh.b64" + with open(godh_file_path, "wb") as godh_file: + godh_file.write(godh_file_content.file.read()) pool.systemd_manager.enable_and_start(execution.controller_service)