-
Notifications
You must be signed in to change notification settings - Fork 1
Service: Python Job Runner
Python Job Runner is an ephemeral job execution service that clones a Python repository, installs dependencies, and runs a specified script — then shuts down automatically. It is the runtime engine behind the My Jobs feature, but can also be provisioned directly as a standalone service instance.
Deploy a Python Job Runner instance at app.osaas.io/dashboard/service/eyevinn-python-job-runner.
For scheduled, recurring jobs, use My Jobs instead of managing Python Job Runner instances directly — My Jobs handles provisioning and cleanup automatically.
- An OSC account (sign up at app.osaas.io)
- A Python script in a Git repository (public or private)
- (Optional) A Parameter Store instance for passing configuration as environment variables
| Field | Required | Description |
|---|---|---|
name |
Yes | Alphanumeric instance name |
SourceUrl |
Yes | URL of the Git repository containing your Python script |
GitHubToken |
No | Personal access token for private repositories |
OscAccessToken |
No | OSC API token if the job needs to call OSC services |
ConfigService |
No | Name of a Parameter Store instance — its values are injected as environment variables at job startup |
ConfigApiKey |
No | API key for an encrypted parameter store |
If your job needs configuration values or secrets, create a Parameter Store first:
- Go to My Apps → Parameter Store and click Create parameter store
- Note the store name and API key shown on creation
Store credentials as service secrets so they can be referenced with {{secrets.name}}:
osc create-secret myparamkey <your-api-key>Via CLI:
osc create eyevinn-python-job-runner myjobrunner \
-o SourceUrl="https://github.com/myorg/myrepo" \
-o ConfigService="my-param-store" \
-o ConfigApiKey="{{secrets.myparamkey}}"Via API:
curl -s -X POST \
-H "x-pat-jwt: Bearer $PAT" \
-H "Content-Type: application/json" \
-d '{
"name": "myjobrunner",
"SourceUrl": "https://github.com/myorg/myrepo",
"ConfigService": "my-param-store",
"ConfigApiKey": "{{secrets.myparamkey}}"
}' \
https://eyevinn-python-job-runner.svc.prod.osaas.io/eyevinn-python-job-runnerinstanceThe runner will:
- Clone the repository from
SourceUrl - Install dependencies (
pip install -r requirements.txtif present) - Execute the script or command specified in
workerCmd(for My Jobs triggers) or the repository's default entrypoint - Shut down and clean up on completion
A job script at jobs/sync.py that reads configuration from environment variables:
import os
db_url = os.environ["DATABASE_URL"]
api_key = os.environ["EXTERNAL_API_KEY"]
# ... job logic
print("Job complete")When the runner starts, values from your bound Parameter Store are available as environment variables.
For recurring scheduled execution, use My Jobs rather than managing runner instances directly:
# Create a job that runs every weekday at 9am
curl -s -X POST \
-H "x-pat-jwt: Bearer $PAT" \
-H "Content-Type: application/json" \
-d '{
"name": "dailysync",
"cronSchedule": "0 9 * * 1-5",
"sourceUrl": "https://github.com/myorg/myrepo",
"workerCmd": "python jobs/sync.py",
"configService": "my-param-store"
}' \
https://deploy.svc.prod.osaas.io/myjobsMy Jobs creates a fresh Python Job Runner for each execution and tears it down automatically.
- My Jobs feature guide
- Parameter Store
- GitHub repository
- Service page