Skip to main content
Job services are for scheduled or on-demand tasks that run to completion. They’re ideal for cron jobs, data processing, and one-time tasks. This is a complete reference for all fields that can be set for a job service in porter.yaml.

Field Reference

FieldTypeRequiredDescription
namestringYesService identifier (max 31 chars)
typestringYesMust be job
runstringYesCommand to execute
cpuCoresnumberYesCPU allocation
ramMegabytesintegerYesMemory allocation in MB
cronstringNoCron schedule expression
suspendCronbooleanNoTemporarily disable cron schedule
allowConcurrentbooleanNoAllow concurrent job runs
timeoutSecondsintegerNoMaximum job duration
connectionsarrayNoExternal cloud connections
terminationGracePeriodSecondsintegerNoGraceful shutdown timeout
gpuCoresNvidiaintegerNoNVIDIA GPU cores
nodeGroupstringNoNode group UUID

Basic Example

services:
  - name: cleanup
    type: job
    run: npm run cleanup
    cpuCores: 0.25
    ramMegabytes: 256
    cron: "0 0 * * *"

cron

Type: string - Optional A cron expression that defines when the job should run. Uses standard 5-field cron syntax.
cron: "0 0 * * *"
Common Schedules:
ExpressionDescription
0 0 * * *Daily at midnight
0 */6 * * *Every 6 hours
*/15 * * * *Every 15 minutes
0 9 * * 1-5Weekdays at 9 AM
0 0 1 * *First day of each month
If no cron expression is provided, the job must be triggered manually using porter app run --job.

suspendCron

Type: boolean - Optional Temporarily disable the cron schedule without removing it. The job won’t run on schedule but can still be triggered manually.
suspendCron: true
Use this to pause scheduled jobs during maintenance windows or while debugging.

allowConcurrent

Type: boolean - Optional Allow multiple instances of the job to run simultaneously. By default, a new job run won’t start if a previous run is still in progress.
allowConcurrent: true
Be careful enabling this for jobs that modify shared resources. Concurrent runs may cause race conditions or data inconsistency.

timeoutSeconds

Type: integer - Optional Maximum number of seconds the job is allowed to run before being terminated.
timeoutSeconds: 3600
If not specified, jobs may run indefinitely. It’s recommended to set a reasonable timeout for all jobs.

connections

Type: array - Optional Connect to external cloud services. See Reference for full documentation.
connections:
  - type: awsRole
    role: my-iam-role

terminationGracePeriodSeconds

Type: integer - Optional Seconds to wait for graceful shutdown before forcefully terminating the job.
terminationGracePeriodSeconds: 30
Use this to ensure jobs can clean up resources or checkpoint progress before termination.

gpuCoresNvidia

Type: integer - Optional Allocate NVIDIA GPU cores for ML training, inference, or GPU-accelerated processing.
gpuCoresNvidia: 1
nodeGroup: gpu-node-group-uuid
Requires a node group with GPU-enabled instances.

Triggering Jobs Manually

Jobs can be triggered manually using the Porter CLI:
# Trigger a job run
porter app run my-app --job my-job

# Trigger and wait for completion
porter app run my-app --job my-job --wait

# Override concurrent restriction
porter app run my-app --job my-job --allow-concurrent

Complete Example

services:
  - name: daily-report
    type: job
    run: python generate_report.py
    cpuCores: 1
    ramMegabytes: 2048

    # Schedule: Daily at 6 AM UTC
    cron: "0 6 * * *"

    # Allow up to 2 hours
    timeoutSeconds: 7200

    # Don't allow concurrent runs
    allowConcurrent: false

    # Cloud connections
    connections:
      - type: awsRole
        role: report-s3-access

    # Graceful shutdown
    terminationGracePeriodSeconds: 60

Common Use Cases

Database Cleanup

services:
  - name: db-cleanup
    type: job
    run: npm run cleanup-old-records
    cpuCores: 0.25
    ramMegabytes: 256
    cron: "0 3 * * *"  # 3 AM daily
    timeoutSeconds: 1800
    allowConcurrent: false

Data Export

services:
  - name: weekly-export
    type: job
    run: python export_data.py
    cpuCores: 0.5
    ramMegabytes: 1024
    cron: "0 0 * * 0"  # Sunday at midnight
    timeoutSeconds: 14400  # 4 hours
    connections:
      - type: awsRole
        role: s3-export-role

ML Training Job

services:
  - name: model-training
    type: job
    run: python train.py
    cpuCores: 8
    ramMegabytes: 32768
    gpuCoresNvidia: 4
    nodeGroup: gpu-node-group-uuid
    timeoutSeconds: 86400  # 24 hours
    terminationGracePeriodSeconds: 300

Health Check / Monitoring

services:
  - name: healthcheck
    type: job
    run: ./check_dependencies.sh
    cpuCores: 0.1
    ramMegabytes: 128
    cron: "*/5 * * * *"  # Every 5 minutes
    timeoutSeconds: 60
    allowConcurrent: false

Manual Migration Job

services:
  - name: data-migration
    type: job
    run: python migrate.py
    cpuCores: 2
    ramMegabytes: 4096
    # No cron - triggered manually only
    timeoutSeconds: 28800  # 8 hours
    allowConcurrent: false
    terminationGracePeriodSeconds: 120
Jobs without a cron expression must be triggered manually using porter app run --job.