Skip to main content
Process management allows you to monitor and control background execution processes. You can list running processes, check their status, and terminate them when needed.

Overview

Process management is essential for:
  • Monitoring background execution progress
  • Checking process status and output
  • Terminating long-running or stuck processes
  • Managing multiple concurrent executions
Process management works with processes started via run_code_background(). For system processes, see system process listing in the Observability section.

Listing Processes

List all background execution processes:

Process Status

Check detailed status of processes:

Process States

Processes can be in different states:
  • queued - Waiting to start
  • running - Currently executing
  • completed - Finished successfully
  • failed - Execution failed
  • killed - Terminated by user

Killing Processes

Terminate running processes:

Monitoring Multiple Processes

Monitor multiple processes simultaneously:

Complete Example

Here’s a complete process management workflow:

Best Practices

1

1. Name Your Processes

Always name processes when starting them for easier identification in process lists.
2

2. Monitor Regularly

Check process status periodically to track progress and detect failures early.
3

3. Clean Up Completed Processes

Remove or archive completed processes to keep your process list manageable.
4

4. Handle Failures

Check for failed status and access stderr for error details when processes fail.
5

5. Kill Stuck Processes

Use kill_process() to terminate processes that are stuck or taking too long.

Next Steps