-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release/v1.2.0
- Loading branch information
Showing
31 changed files
with
741 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
name: Build Docker Container | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
workflow_call: | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: 'true' | ||
ssh-key: ${{ secrets.git_ssh_key }} | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag osml-model-runner:$(date +%s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 11 additions & 6 deletions
17
.github/workflows/documentation.yaml → .github/workflows/documentation-publish.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
name: Docs | ||
on: [push, pull_request, workflow_dispatch] | ||
name: Generate and Publish Documentation for OSML Model Runner | ||
|
||
on: | ||
workflow_call: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
docs: | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v3 | ||
- name: Install dependencies | ||
run: | | ||
pip install sphinx | ||
python -m pip install sphinx-autoapi | ||
python -m pip install sphinx_rtd_theme | ||
python -m pip install tox tox-gh-actions | ||
- name: Sphinx build | ||
run: | | ||
sphinx-build doc _build | ||
tox -e docs | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3.9.3 | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
with: | ||
publish_branch: gh-pages | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: _build/ | ||
publish_dir: .tox/docs/tmp/html/ | ||
force_orphan: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Notify Guidance Overhead Imagery Repo | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
notify: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Short Sha | ||
uses: benjlevesque/short-sha@v2.2 | ||
- name: Invoke Guidance OSML Submodule Workflow | ||
uses: benc-uk/workflow-dispatch@v1.2.2 | ||
with: | ||
repo: aws-solutions-library-samples/guidance-for-overhead-imagery-inference-on-aws | ||
workflow: osml_update_submodules.yml | ||
token: ${{ secrets.GUIDANCE_OSML_SUBMODULES_ACTION_10_24 }} | ||
inputs: '{ "DISPATCH_REPO_NAME" : "${{ github.event.repository.name }}", "DISPATCH_REPO_SHA": "${{ env.SHA }}" }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: "OSML Model Runner Build Workflow" | ||
|
||
on: | ||
pull_request: | ||
branches: ["main", "dev"] | ||
|
||
jobs: | ||
Build_Validate_Tox: | ||
uses: ./.github/workflows/python-tox.yml | ||
secrets: inherit | ||
Build_Docker_Container: | ||
uses: ./.github/workflows/docker-build.yml | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "OSML Model Runner Build and Publish Workflow" | ||
|
||
on: | ||
push: | ||
branches: ["main", "dev"] | ||
|
||
jobs: | ||
Build_Validate_Tox: | ||
uses: ./.github/workflows/python-tox.yml | ||
secrets: inherit | ||
Build_Docker_Container: | ||
uses: ./.github/workflows/docker-build.yml | ||
secrets: inherit | ||
Publish_Python: | ||
needs: [Build_Validate_Tox, Build_Docker_Container] | ||
uses: ./.github/workflows/python-publish.yml | ||
secrets: inherit | ||
Publish_Docker_Dockerhub: | ||
needs: [Build_Validate_Tox, Build_Docker_Container] | ||
uses: ./.github/workflows/docker-publish-dockerhub.yml | ||
secrets: inherit | ||
Publish_Docker_Github: | ||
needs: [Build_Validate_Tox, Build_Docker_Container] | ||
uses: ./.github/workflows/docker-publish-github.yml | ||
secrets: inherit | ||
Publish_Documentation: | ||
needs: [Publish_Python, Publish_Docker_Github, Publish_Docker_Dockerhub] | ||
uses: ./.github/workflows/documentation-publish.yml | ||
secrets: inherit | ||
Notify_Guidance_Repo: | ||
needs: [Publish_Docker_Github, Publish_Docker_Dockerhub] | ||
uses: ./.github/workflows/notify-guidance-repo.yml | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2023 Amazon.com, Inc. or its affiliates. | ||
# | ||
|
||
# This is a utility to run a local model runner container with an ENV imported from ECS. | ||
# $1 = PATTERN = the pattern contained in the ECS task definition you want to import from | ||
# $2 = CONTAINER_NAME = the name of the docker image you want to run | ||
# $3 = AWS_REGION = region the ecs task definition is contained in | ||
|
||
echo " ____ _ __ __"; | ||
echo " / __ \__ ______ ____ (_)___ ____ _ / / ____ _________ _/ /"; | ||
echo " / /_/ / / / / __ \/ __ \/ / __ \/ __ / / / / __ \/ ___/ __ / /"; | ||
echo " / _, _/ /_/ / / / / / / / / / / / /_/ / / /___/ /_/ / /__/ /_/ / / "; | ||
echo "/_/ |_|\__,_/_/ /_/_/ /_/_/_/ /_/\__, / /_____/\____/\___/\__,_/_/"; | ||
echo " __ _______ ______ /____/__ _"; | ||
echo " / |/ / __ \ / ____/___ ____ / /_____ _(_)___ ___ _____"; | ||
echo " / /|_/ / /_/ / / / / __ \/ __ \/ __/ __ / / __ \/ _ \/ ___/"; | ||
echo " / / / / _, _/ / /___/ /_/ / / / / /_/ /_/ / / / / / __/ /"; | ||
echo "/_/ /_/_/ |_| \____/\____/_/ /_/\__/\__,_/_/_/ /_/\___/_/ "; | ||
|
||
|
||
# Inputs | ||
PATTERN="${1:-"MRDataplane"}" | ||
IMAGE_NAME=PATTERN="${2:-"osml-model-runner:local"}" | ||
AWS_REGION="${3:-"us-west-2"}" | ||
|
||
# Get the latest task definition ARN based on a string pattern | ||
LATEST_TASK_DEFINITION_ARN=$(aws ecs list-task-definitions --region $AWS_REGION --sort DESC | jq -r ".taskDefinitionArns[] | select(. | contains(\"$PATTERN\"))" | head -n 1) | ||
|
||
if [ -z "$LATEST_TASK_DEFINITION_ARN" ]; then | ||
echo "No task definition found with pattern: $PATTERN" | ||
exit 1 | ||
fi | ||
|
||
echo "Latest task definition ARN with pattern $PATTERN is: $LATEST_TASK_DEFINITION_ARN" | ||
|
||
# Extract environment variables from ECS task definition using AWS CLI and jq | ||
ENV_VARS=$(aws ecs describe-task-definition --region $AWS_REGION --task-definition "$LATEST_TASK_DEFINITION_ARN" | jq -r '.taskDefinition.containerDefinitions[0].environment[] | "-e " + .name + "=\"" + .value + "\"" ' | tr '\n' ' ') | ||
|
||
# If aws cli or jq command fails | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to fetch environment variables from ECS task definition." | ||
exit 1 | ||
fi | ||
|
||
echo "Running with env variables: $ENV_VARS" | ||
|
||
# Give the container permissions on aws credentials | ||
echo "Warning: Giving 777 permissions on ~/.aws/credentials - revert to desired permissions if needed" | ||
chmod 777 ~/.aws/credentials | ||
|
||
# Note: The `-d` flag runs the container in detached mode. | ||
# Add it if you want to run the container in the background. | ||
# Run Docker container with environment variables and mount AWS credentials | ||
DOCKER_CMD="docker run \ | ||
-p 8080:8080 \ | ||
-v ~/.aws/credentials:/home/modelrunner/.aws/credentials:rw \ | ||
$ENV_VARS \ | ||
$IMAGE_NAME" | ||
|
||
# Run Docker container with environment variables | ||
eval "$DOCKER_CMD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.