DocsDebug Sessions
v1.16+

Debug Sessions

Most sandbox issues fall into four groups: the run is not running, the plugin is not enabled, the user does not have access, or the container environment is missing required tools.

This page continues from the Sandbox Quick Start. The Python examples reuse its run_client and sandbox clients; the CLI examples reuse its quick-start project and RUN_UUID variable.

Check Run Status

Open the run page or inspect the run with Python or the CLI:

run_client.refresh_data(load_conditions=True)
print(run_client.status)
for condition in run_client.run_data.status_conditions or []:
    print(condition.type, condition.reason, condition.message)
polyaxon ops get -p quick-start -uid $RUN_UUID

If the run is pending, check the queue, resources, node selectors, and project limits.

Check Sandbox Health

health = sandbox.ping()
print(health.status, health.version)
polyaxon sandbox ping -p quick-start -uid $RUN_UUID

If the ping fails, confirm that plugins.sandbox is enabled and that the run is a supported service workload.

Inspect Logs

Use run logs for container startup issues:

logs = run_client.get_logs()
for log in logs.logs or []:
    print(log.value)
polyaxon ops logs -p quick-start -uid $RUN_UUID

Start a background sandbox command and keep its handle or execution ID:

sandbox.fs.upload_file(
    local_path="./sandbox/check.py",
    path="/workspace/check.py",
)
background = sandbox.process.exec_bg(
    command=["python", "/workspace/check.py"],
)
print(background.id)
polyaxon sandbox upload -p quick-start -uid $RUN_UUID \
  ./sandbox/check.py /workspace/check.py
EXEC_ID=$(polyaxon sandbox exec -p quick-start -uid $RUN_UUID --detach -- python /workspace/check.py)

Read that process's logs later:

for chunk in background.iter_stdout(timeout=60, interval=0.5):
    print(chunk, end="")
status = background.wait(timeout=60)
print(status.state, status.exit_code)
polyaxon sandbox logs -p quick-start -uid $RUN_UUID $EXEC_ID

Validate the Environment

Run simple commands before debugging application code:

for command in (["pwd"], ["printenv", "PATH"], ["python", "-V"]):
    result = sandbox.process.exec(command=command)
    print(result.stdout, end="")
    print(result.stderr, end="")
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- pwd
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- printenv PATH
polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- python -V

Common Fixes

  • Enable the required plugin: sandbox, ssh, or tmux.
  • Use a long-running service command such as sleep infinity for development sessions.
  • Route the run to a queue that supports services and the requested resources.
  • Move credentials into Polyaxon connections instead of the container image.
  • Stop stale sandbox-enabled service runs that are holding scarce resources.

See the Python run client, process, and filesystem references, or the sandbox CLI reference, for the full interfaces.