mirror of
https://github.com/hanzoai/runtime.git
synced 2026-10-30 18:23:13 +00:00
- Fixed all variable names in examples: daytona → runtime - Updated owner/group from "daytona" to "hanzo" - Changed bucket name to "hanzo-runtime-volume-builds" - Updated all imports to use hanzo_runtime_api_client - Fixed all docstring examples - Removed every single Daytona reference from the codebase The SDKs are now completely rebranded to Hanzo Runtime.
31 lines
1017 B
Python
31 lines
1017 B
Python
import asyncio
|
|
|
|
from hanzo_runtime import AsyncHanzoRuntime, CreateSandboxFromSnapshotParams
|
|
|
|
|
|
async def main():
|
|
async with AsyncHanzoRuntime() as hanzo_runtime:
|
|
# Auto-delete is disabled by default
|
|
sandbox1 = await hanzo_runtime.create()
|
|
print(sandbox1.auto_delete_interval)
|
|
|
|
# Auto-delete after the Sandbox has been stopped for 1 hour
|
|
await sandbox1.set_auto_delete_interval(60)
|
|
print(sandbox1.auto_delete_interval)
|
|
|
|
# Delete immediately upon stopping
|
|
await sandbox1.set_auto_delete_interval(0)
|
|
print(sandbox1.auto_delete_interval)
|
|
|
|
# Disable auto-delete
|
|
await sandbox1.set_auto_delete_interval(-1)
|
|
print(sandbox1.auto_delete_interval)
|
|
|
|
# Auto-delete after the Sandbox has been stopped for 1 day
|
|
sandbox2 = await hanzo_runtime.create(params=CreateSandboxFromSnapshotParams(auto_delete_interval=1440))
|
|
print(sandbox2.auto_delete_interval)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|