Fetch Failed Executions
Query your failed executions programmatically to build automated retry workflows, monitoring dashboards, or failure analysis tools.
This example shows how to filter executions by status and extract failure details, perfect for building resilient ML pipelines that automatically recover from transient errors.
Prerequisites
A Valohai project with some executions (successful or failed)
Python 3.8+ and the
requestslibrary installed
Generate a Valohai API Token
Create an API token to authenticate your requests:
Click "Hi, <username>!" in the top-right corner
Go to My Profile → Authentication
Click Manage Tokens and scroll to the bottom
Click Generate New Token
Copy the token immediately — it's shown only once
Store your token as an environment variable:
# Linux/Mac
export VH_API_TOKEN=your_token_value
# Windows
set VH_API_TOKEN=your_token_valueGet Your Project ID
Find your project ID in Project Settings → General
Fetch Failed Executions
Create fetch_failed_executions.py:
Run the script:
Understanding the Response
The API returns a paginated list of executions. Each failed execution includes:
Key fields:
status: Always"error"when filtered bystatus=errorerror_text: Human-readable failure reasonstep: Which step failedduration: How long it ran before failing (in seconds)urls.display: Direct link to the execution in Valohai
Status Filters
Query executions by different statuses:
Next Steps
Now that you can fetch failed executions, you can:
Parse
error_textto categorize failure typesSend alerts when critical executions fail
Generate daily failure reports
Troubleshooting
Empty results:
Verify your project ID is correct
Check that you have executions with
status=errorTry removing the status filter to see all executions
Authentication errors:
Confirm
VH_API_TOKENenvironment variable is setVerify your token is valid in My Profile → Authentication
Self-hosted Valohai: Replace https://app.valohai.com with your installation URL
Last updated
Was this helpful?
