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.

Getting Started

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.

Prerequisites

Configuration Options

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

Step-by-Step Guide

1. (Optional) Create a Parameter Store

If your job needs configuration values or secrets, create a Parameter Store first:

  1. Go to My Apps → Parameter Store and click Create parameter store
  2. 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>

2. Create the Python Job Runner instance

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-runnerinstance

3. The runner executes your script

The runner will: 1. Clone the repository from SourceUrl 2. Install dependencies (pip install -r requirements.txt if present) 3. Execute the script or command specified in workerCmd (for My Jobs triggers) or the repository's default entrypoint 4. Shut down and clean up on completion

Usage Example

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/myjobs

My Jobs creates a fresh Python Job Runner for each execution and tears it down automatically.

Resources