Use Cases
Oneshot mode is perfect for:- CI/CD Pipelines: Run notebooks as part of your continuous integration workflows
- Scheduled Tasks: Execute notebooks on a schedule using cron or similar schedulers
- Workflow Automation: Integrate SPIN notebooks into workflow engines like GitHub Actions, Jenkins, GitLab CI, etc.
- One-time Execution: Run a notebook once without maintaining a persistent runtime
GitHub Actions
We provide an official GitHub Action for running SPIN notebooks in oneshot mode. See the spin-oneshot-action repository for complete documentation, examples, and configuration options.Docker
For other workflow engines or custom automation, you can run the SPIN Runtime directly as a Docker container in oneshot mode.Basic Usage
Environment Variables
| Variable | Required | Description |
|---|---|---|
RUNTIME_MODE | Yes | Must be set to oneshot to enable oneshot mode |
NOTEBOOK_URL | Yes | The URL of the notebook to execute (e.g., https://spin.siftd.ai/demo/default/notebooks/orr0rqr4r80dlrqqrvrqrkdg) |
SPIN_TOKEN | Yes | Oneshot authentication token generated from the SPIN UI (eg., i1t3G3K2Vj3N_jM0wqsWFCgIUSn9N_M3lAvsBUzhniA= ) |
MAX_DURATION | No | Maximum execution time for the notebook (default: 10m). Accepts values like 5m, 1h, etc. |
The
SPIN_TOKEN for oneshot mode is different from the token used for persistent runtimes. To create one, go to
the “Runtimes” management page, click on the “Oneshot Token” button on top and follow instructions from there.How It Works
When you run the SPIN Runtime in oneshot mode: The container starts up, authenticates with SPIN backend, compiles and runs the notebook. The notebook is executed cell-by-cell with a maximum total timeout ofMAX_DURATION
Viewing Results
Logs and cell output is emitted stdout/console. IF session storage is enabled:- Upon completion, the session is uploaded to configured target
- You can view session in a browser by copying/pasting the session URL emitted to the console
Session storage for oneshot executions requires additional configuration.
Contact [email protected] for information on enabling this feature for your workspace.
Troubleshooting
Check logs for statusContainer Exits Immediately
Ensure all required environment variables are set:RUNTIME_MODE=oneshotNOTEBOOK_URL(copy/paste this URL to browser and ensure it is a valid SPIN notebook)SPIN_TOKEN(ensure you have a valid Oneshot Token)
Timeout Errors
If your notebook execution is timing out, increase theMAX_DURATION: