diff --git a/.github/actions/bump-version-tag/action.yml b/.github/actions/bump-version-tag/action.yml deleted file mode 100644 index e4744bf..0000000 --- a/.github/actions/bump-version-tag/action.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: Bump Version and Tag Reusable Workflow - -description: | - Get the would-be bumped version and version tag for a commit based on the - changes since last version. -inputs: - bump_type: - description: 'Version Bump Type' - type: choice - options: ['major', 'minor', 'patch', 'none'] - required: false - default: 'none' - dry_run: - description: 'Dry Run' - type: boolean - required: false - default: false - token: - description: 'Token for AllenInstitute GitHub' - required: true -outputs: - major: - description: 'The major version number' - value: ${{ steps.set-outputs.outputs.major }} - minor: - description: 'The minor version number' - value: ${{ steps.set-outputs.outputs.minor }} - patch: - description: 'The patch version number' - value: ${{ steps.set-outputs.outputs.patch }} - increment: - description: 'The increment. This is the number of commits since the last tag.' - value: ${{ steps.set-outputs.outputs.increment }} - version: - description: 'The version number (e.g. 1.2.3)' - value: ${{ steps.set-outputs.outputs.version }} - version_tag: - description: 'The version tag (e.g. v1.2.3)' - value: ${{ steps.set-outputs.outputs.version_tag }} - version_type: - description: 'The version type (e.g. major, minor, patch, none)' - value: ${{ steps.set-outputs.outputs.version_type }} - previous_version: - description: 'The previous version number (e.g. 1.2.2)' - value: ${{ steps.set-outputs.outputs.previous_version }} - -runs: - using: "composite" - steps: - - name: Bump patch version and tag - id: bump-version-tag - uses: anothrNick/github-tag-action@1.64.0 - env: - GITHUB_TOKEN: ${{ inputs.token }} - DEFAULT_BUMP: ${{ inputs.bump_type || 'none' }} - MAJOR_STRING_TOKEN: '(MAJOR)' - MINOR_STRING_TOKEN: '(MINOR)' - PATCH_STRING_TOKEN: '(PATCH)' - NONE_STRING_TOKEN: '(NONE)' - WITH_V: "true" - RELEASE_BRANCHES: main - DRY_RUN: true - - name: Set Outputs - id: set-outputs - run: | - new_tag=${{ steps.bump-version-tag.outputs.new_tag }} - new_version=$(echo $new_tag | sed 's/^v//') - major=$(echo $new_version | cut -d. -f1) - minor=$(echo $new_version | cut -d. -f2) - patch=$(echo $new_version | cut -d. -f3) - increment=0 - version_type=${{ steps.bump-version-tag.outputs.part }} - previous_version=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//') - - echo "major=$major" >> $GITHUB_OUTPUT - echo "minor=$minor" >> $GITHUB_OUTPUT - echo "patch=$patch" >> $GITHUB_OUTPUT - echo "increment=$increment" >> $GITHUB_OUTPUT - echo "version=$new_version" >> $GITHUB_OUTPUT - echo "version_tag=$new_tag" >> $GITHUB_OUTPUT - echo "version_type=$version_type" >> $GITHUB_OUTPUT - echo "previous_version=$previous_version" >> $GITHUB_OUTPUT - shell: bash - - # Currently not using this Version bumping tool, but considering it for the future. - # The main limitation is being able to override the default bump type even - # if there are no commits. - - name: Bump Version Alternate - uses: PaulHatch/semantic-version@v5.4.0 - id: bump-version-tag-alt - with: - major_pattern: "/\\((MAJOR|BREAKING)\\)/" - minor_pattern: "/\\((MINOR|FEATURE)\\)/" - bump_each_commit: true - bump_each_commit_patch_pattern: "/\\((PATCH|BUG)\\)/" - - name: Set Outputs Alt - id: set-outputs-alt - shell: bash - run: | - echo 'changed: ${{ steps.bump-version-tag-alt.outputs.changed }}' - echo 'major: ${{ steps.bump-version-tag-alt.outputs.major }}' - echo 'minor: ${{ steps.bump-version-tag-alt.outputs.minor }}' - echo 'patch: ${{ steps.bump-version-tag-alt.outputs.patch }}' - echo 'increment: ${{ steps.bump-version-tag-alt.outputs.increment }}' - echo 'version: ${{ steps.bump-version-tag-alt.outputs.version }}' - echo 'version_tag: ${{ steps.bump-version-tag-alt.outputs.version_tag }}' - echo 'version_type: ${{ steps.bump-version-tag-alt.outputs.version_type }}' - echo 'previous_version: ${{ steps.bump-version-tag-alt.outputs.previous_version }}' - - # echo "major=${{ steps.bump-version-tag-alt.outputs.major }}" >> $GITHUB_OUTPUT - # echo "minor=${{ steps.bump-version-tag-alt.outputs.minor }}" >> $GITHUB_OUTPUT - # echo "patch=${{ steps.bump-version-tag-alt.outputs.patch }}" >> $GITHUB_OUTPUT - # echo "increment=${{ steps.bump-version-tag-alt.outputs.increment }}" >> $GITHUB_OUTPUT - # echo "version=${{ steps.bump-version-tag-alt.outputs.version }}" >> $GITHUB_OUTPUT - # echo "version_tag=${{ steps.bump-version-tag-alt.outputs.version_tag }}" >> $GITHUB_OUTPUT - # echo "version_type=${{ steps.bump-version-tag-alt.outputs.version_type }}" >> $GITHUB_OUTPUT - # echo "previous_version=${{ steps.bump-version-tag-alt.outputs.previous_version }}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml deleted file mode 100644 index 1e59ffa..0000000 --- a/.github/workflows/bump_version.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: Bump Version and Tag - -on: - push: - branches: [ main ] - paths-ignore: - - '**/_version.py' - - workflow_dispatch: - inputs: - bump_type: - description: 'Version bump type to use. If target_version is set, this will be ignored.' - type: choice - options: ['major', 'minor', 'patch', 'none'] - required: false - default: 'none' - target_version: - description: | - Optional target version (e.g. 1.2.3) to bump to. If not set, bump type will be used. - (leave empty for default) - required: false - default: '' - dry_run: - description: 'Dry Run' - type: boolean - required: false - default: false - -jobs: - get-version-info: - name: Get New Version Tag - runs-on: ubuntu-latest - if: github.actor != 'github-actions[bot]' - outputs: - version: ${{ steps.set-target-version.outputs.version || steps.version-tag.outputs.version }} - version_tag: ${{ steps.set-target-version.outputs.version_tag || steps.version-tag.outputs.version_tag }} - version_type: ${{ steps.set-target-version.outputs.version_type || steps.version-tag.outputs.version_type }} - previous_version: ${{ steps.get-current-version.outputs.previous_version || steps.version-tag.outputs.previous_version }} - update_required: ${{ steps.set-update-required.outputs.update_required }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Get Bumped Version Tag - uses: ./.github/actions/bump-version-tag - id: version-tag - with: - bump_type: ${{ github.event.inputs.bump_type }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Print Version Info - # We only want to print if we are not a workflow call or if the target version is 'N/A' - if: github.event_name != 'workflow_dispatch' || !inputs.target_version - run: | - echo "Version: ${{ steps.version-tag.outputs.version }}" - echo "Version Tag: ${{ steps.version-tag.outputs.version_tag }}" - echo "Version Type: ${{ steps.version-tag.outputs.version_type }}" - echo "Previous Version: ${{ steps.version-tag.outputs.previous_version }}" - - name: Set Target Version - id: set-target-version - # We only want to set the target version if we are a workflow call and the target version is set - if: github.event_name == 'workflow_dispatch' && inputs.target_version - run: | - echo "Setting target version to ${{ inputs.target_version }}" - echo "version=${{ inputs.target_version }}" >> $GITHUB_OUTPUT - echo "version_tag=v${{ inputs.target_version }}" >> $GITHUB_OUTPUT - - name: Get Current Version - id: get-current-version - # We only want to get current version if we are a workflow call and the target version is set - if: github.event_name == 'workflow_dispatch' && inputs.target_version - uses: ./.github/actions/source-code-version-get - with: - version_file: _version.py - - name: Set Update Required - id: set-update-required - run: | - if [ "${{ steps.set-target-version.outputs.version || steps.version-tag.outputs.version }}" != "${{ steps.version-tag.outputs.previous_version }}" ]; then - echo "Update required" - echo "update_required=true" >> $GITHUB_OUTPUT - else - echo "No update required" - echo "update_required=false" >> $GITHUB_OUTPUT - fi - - update-version-and-tag: - name: Update Repo Tag and Version - runs-on: ubuntu-latest - needs: get-version-info - # We only want to run if: - # 1. We are not the GitHub bot - # 2. We are not a workflow call or we are not in dry run mode - # 3. The update is required (i.e. the version has changed) - if: | - github.actor != 'github-actions[bot]' && - (github.event_name != 'workflow_dispatch' || !inputs.dry_run) && - needs.get-version-info.outputs.update_required == 'true' - - steps: - - uses: actions/checkout@v4 - # This sets up the git user for the GitHub bot - - name: Configure Git User - run: | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - # This sets up ssh keys for the AllenInstitute GitHub - - name: Configure AllenInstitute Repo Authorization - uses: ./.github/actions/configure-org-repo-authorization - with: - token: ${{ secrets.AI_PACKAGES_TOKEN }} - ssh_private_key: ${{ secrets.AIBSGITHUB_PRIVATE_KEY }} - - name: Update Version - uses: ./.github/actions/source-code-version-update - with: - version: ${{ needs.get-version-info.outputs.version }} - version_tag: ${{ needs.get-version-info.outputs.version_tag }} - version_file: _version.py diff --git a/src/aibs_informatics_cdk_lib/constructs_/sfn/states/batch.py b/src/aibs_informatics_cdk_lib/constructs_/sfn/states/batch.py index 2208f12..f09fd8e 100644 --- a/src/aibs_informatics_cdk_lib/constructs_/sfn/states/batch.py +++ b/src/aibs_informatics_cdk_lib/constructs_/sfn/states/batch.py @@ -133,8 +133,10 @@ def register_job_definition( "Retry": [ { "ErrorEquals": ["Batch.BatchException"], - "IntervalSeconds": 1, - "MaxAttempts": 3, + # Interval at attempt n = IntervalSeconds x BackoffRate ^(n-1) + # Total time from first try: 3 + 6 + 12 + 24 = 45 seconds + "IntervalSeconds": 3, + "MaxAttempts": 5, "BackoffRate": 2.0, }, ], @@ -208,8 +210,10 @@ def submit_job( "Retry": [ { "ErrorEquals": ["Batch.BatchException"], - "IntervalSeconds": 1, - "MaxAttempts": 3, + # Interval at attempt n = IntervalSeconds x BackoffRate ^(n-1) + # Total time from first try: 3 + 6 + 12 + 24 = 45 seconds + "IntervalSeconds": 3, + "MaxAttempts": 5, "BackoffRate": 2.0, }, ], @@ -248,8 +252,10 @@ def deregister_job_definition( "Retry": [ { "ErrorEquals": ["Batch.BatchException"], - "IntervalSeconds": 1, - "MaxAttempts": 3, + # Interval at attempt n = IntervalSeconds x BackoffRate ^(n-1) + # Total time from first try: 3 + 6 + 12 + 24 = 45 seconds + "IntervalSeconds": 3, + "MaxAttempts": 5, "BackoffRate": 2.0, }, ],