Github actions job timeout

I have a GitHub workflow with long-running job (10 hours). Even though I have configured the timeout-minutes in the job it gets canceled within 6 hours. Is there a limitation?

name: Spawn cluster

on:
  workflow_dispatch:
  schedule:
    - cron:  '0 */12 * * *'
jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 600
    steps:
    - name: CHECKOUT
      uses: actions/checkout@v2
    - name: AZURE LOGIN
      uses: azure/login@v1
      with:
        creds: ${{secrets.AZURE_CREDENTIALS}}

Upvotes: 19

Views: 25193

Answers (2)

Krzysztof Madej
Krzysztof Madej

Reputation: 40603

Yeah, there are some limits

  • Job execution time - Each job in a workflow can run for up to 6 hours of execution time. If a job reaches this limit, the job is terminated and fails to complete.

  • Workflow run time - Each workflow run is limited to 72 hours. If a workflow run reaches this limit, the workflow run is cancelled.

  • API requests - You can execute up to 1000 API requests in an hour across all actions within a repository. If exceeded, additional API calls will fail, which might cause jobs to fail.

  • Concurrent jobs - The number of concurrent jobs you can run in your account depends on your GitHub plan, as indicated in the following table. If exceeded, any additional jobs are queued.

So probably if you need to run a 10-hour job you need to have a self-hosted agent. Or try to split this into smaller chunks.

Upvotes: 25

Gabriel Braico Dornas
Gabriel Braico Dornas

Reputation: 665

As pointed out in this post, one suggestion is to try to split your job, if possible, into smaller chunks. For example, in your workflow.yml file, you simply define two jobs like this (leveraging the needs: configuration in the second job).

Below is a random example of this kind of needed Job:

name: CI build and notify

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    
    - name: Deploy Docker image to Google Cloud Run
      run: ...

  notify:
    needs: build
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Notify Slack and send eMail
        run: ...

Upvotes: 1

Related Questions