Skip to content

Improve timeout handling in CI #282

@vyasr

Description

@vyasr

Currently we use the bash timeout command extensively in our scripts to avoid jobs from eating up too much time. This choice is useful, but since timeout provides diagnostics in the form of an exit code, unless we handle that exit code there is no useful information presented in CI regarding why the commands failed. Since we typically run with set -e the command simply fails outright with no information.

I propose that we replace all timeout commands with a new rapids_timeout command that provides a useful diagnostic here. The implementation would be fairly simple I think:

rapids_timeout() {
  local old_opts="$-"
  set +e

  timeout $@
  timeout_exit=$?
  if [[ $? == 124 ]]; do
    echo "The command timed out"
  done

  # Restore options
  case $old_opts in
    *e*) set -e ;;
    *)   set +e ;;
  esac
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions