Skip to content

[FEATURE] CI Test should always terminate after 1 hour #14680

Closed

Description

@lupyuen

Is your feature request related to a problem? Please describe.

CI Test will sometimes run for 6 hours (before getting killed by GitHub):

This is not so great because:

  1. It will increase our usage of GitHub Runners. Which may overrun the GitHub Actions Budget allocated by ASF.
  2. Suppose right after CI Test there's another build. If CI Test runs for all 6 hours, then the build after CI Test will never run.
  3. We are now running our own Ubuntu PCs as a NuttX Build Farm. The PCs will hang forever until we restart the Build Jobs.

Describe the solution you'd like

CI Test should complete within 1 hour. It should gracefully terminate itself (and report an error) if the runtime exceeds 1 hour.

Describe alternatives you've considered

Right now I'm manually killing all CI Jobs that run over 3 hours. And restarting the Ubuntu PCs in our NuttX Build Farm.

Verification

  • I have verified before submitting the report.

Activity

  1. added
    Type: Enhancement
    on Nov 7, 2024
  2. simbit18 commented on Nov 7, 2024

    @simbit18
    Contributor
  3. simbit18 commented on Nov 7, 2024

    @simbit18
    Contributor

    @lupyuen so we should put

    jobs:
      build:
        runs-on: ubuntu-latest
        timeout-minutes: 180 #  (3 hours) Decrease this timeout value as needed
    
  4. lupyuen commented on Nov 7, 2024

    @lupyuen
    MemberAuthor

    @simbit18 Hmmm suppose right after CI Test there's another build. If CI Test runs for all 3 hours, then the build after CI Test will never run. So actually I prefer if CI Test could terminate itself (after 1 hour) and let other builds run.

    Unless we always park CI Test at the end of the job?

  5. simbit18 commented on Nov 7, 2024

    @simbit18
    Contributor

    @simbit18 Hmmm suppose right after CI Test there's another build. If CI Test runs for all 3 hours, then the build after CI Test will never run. So actually I prefer if CI Test could terminate itself (after 1 hour) and let other builds run.
    right !!!

    Describe the solution you'd like
    CI Test should complete within 1 hour. It should gracefully terminate itself (and report an error) if the runtime exceeds 1 hour.
    

    This in my opinion is the right solution

    The GitHub Actions timeout is only for safety and not to fall back into the tunnel #14376

  6. lupyuen commented on Nov 15, 2024

    @lupyuen
    MemberAuthor
  7. lupyuen commented on Nov 16, 2024

    @lupyuen
    MemberAuthor

    Wonder if this will work for GitHub CI? I'm testing it for macOS Build Farm:
    https://github.com/lupyuen/nuttx-build-farm/blob/main/run-job-macos.sh#L131-L144

    ## If CI Test Hangs: Kill it after 1 hour
    ( sleep 3600 ; echo Killing pytest... ; pkill -f pytest )&
    
    ## Run the CI Job
    ./cibuild.sh -i -c -A -R testlist/$job.dat
  8. lupyuen commented on Nov 16, 2024

    @lupyuen
    MemberAuthor

    Yep this kills the CI Test after 2 hours! (Assuming our jobs are not supposed to exceed 2 hours)

    We changed build.yml:

    cd sources/nuttx/tools/ci
    if [ "X${{matrix.boards}}" = "Xcodechecker" ]; then
      ./cibuild.sh -c -A -N -R --codechecker testlist/${{matrix.boards}}.dat
    else
      ## Inserted this
      ( sleep 7200 ; echo Killing pytest... ; pkill -f pytest )&
      ./cibuild.sh -c -A -N -R -S testlist/${{matrix.boards}}.dat
    fi

    (Build Log says "Killing pytest... Terminated" and fails correctly later)

  9. added a commit that references this issue on Nov 19, 2024
  10. linked a pull request that will close this issueCI: Kill CI Test after 2 hours #14849on Nov 19, 2024
  11. added a commit that references this issue on Nov 19, 2024
  12. added a commit that references this issue on Nov 28, 2024
  13. added a commit that references this issue on Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions