from gravixlayer import GravixLayer
client = GravixLayer()
response = client.runtime.kill("your-runtime-id")
print(response.message)
Parameters
| Parameter | Type | Required | Description |
|---|
runtime_id | string | Yes | Runtime to terminate |
Response
| Field | Type | Description |
|---|
message | string | Confirmation message |
runtime_id | string | Terminated runtime ID |
Termination is immediate. Download any files you need before calling kill.
Use try/finally to guarantee cleanup:
from gravixlayer import GravixLayer
client = GravixLayer()
runtime = client.runtime.create(template="python-3.12-base-small")
try:
result = client.runtime.run_code(runtime.runtime_id, code="print('working')")
print(result.text)
finally:
client.runtime.kill(runtime.runtime_id)