Skip to content

Commit

Permalink
MRG: Merge pull request #1 from octue/upgrade-octue-sdk-version
Browse files Browse the repository at this point in the history
Set up Octue OpenFAST service
  • Loading branch information
cortadocodes authored Dec 6, 2023
2 parents 883d041 + 218bd55 commit 929c607
Show file tree
Hide file tree
Showing 19 changed files with 495 additions and 123 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: cd

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
deploy:
if: "!contains(github.event.head_commit.message, 'skipci')"
uses: octue/.github/.github/workflows/reusable-deploy-cloud-run-service.yml@main
permissions:
id-token: write
contents: read
with:
gcp_project_name: octue-openfast
gcp_project_number: 86611255144
gcp_region: europe-west3
gcp_resource_affix: octue
gcp_service_name: openfast-service
local_dockerfile: ./Dockerfile
cloud_run_flags: '--ingress=all --allow-unauthenticated --service-account=openfast-service@octue-openfast.iam.gserviceaccount.com --max-instances=10 --memory=2048Mi'
15 changes: 4 additions & 11 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,8 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
# Set fetch-depth to 0 to fetch all tags (necessary for git-mkver to determine the correct semantic version).
fetch-depth: 0
- uses: actions/setup-python@v2
- name: Install git-mkver
run: |
curl -L https://github.com/idc101/git-mkver/releases/download/v1.2.1/git-mkver-linux-amd64-1.2.1.tar.gz \
| tar xvz \
&& sudo mv git-mkver /usr/local/bin
- name: Install semantic version checker
run: pip install git+https://github.com/octue/conventional-commits
- name: Check version
run: check-semantic-version setup.py
- uses: octue/[email protected]
with:
path: setup.py
breaking_change_indicated_by: minor
39 changes: 15 additions & 24 deletions .github/workflows/update-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
# This workflow updates the pull request description with an auto-generated section containing the categorised commit
# message headers of the commits since the last pull request merged into main. The auto generated section is enveloped
# between two comments: "<!--- START AUTOGENERATED NOTES --->" and "<!--- END AUTOGENERATED NOTES --->". Anything
# outside these in the description is left untouched. Auto-generated updates can be skipped for a commit if
# message headers of the pull request's commits. The auto generated section is enveloped between two comments:
# "<!--- START AUTOGENERATED NOTES --->" and "<!--- END AUTOGENERATED NOTES --->". Anything outside these in the
# description is left untouched. Auto-generated updates can be skipped for a commit if
# "<!--- SKIP AUTOGENERATED NOTES --->" is added to the pull request description.

name: update-pull-request

# Only trigger for pull requests into main branch.
on:
pull_request:
branches:
- main
on: pull_request

jobs:
description:
if: "!contains(github.event.pull_request.body, '<!--- SKIP AUTOGENERATED NOTES --->')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Set fetch-depth to 0 to fetch all commit history (necessary for compiling pull request description).
fetch-depth: 0
- name: Install release note compiler
run: pip install git+https://github.com/octue/conventional-commits
- name: Compile new pull request description
run: |
echo 'PULL_REQUEST_NOTES<<EOF' >> $GITHUB_ENV
echo "$(compile-release-notes PULL_REQUEST_START --pull-request-url=${{ github.event.pull_request.url }} --api-token=${{ secrets.GITHUB_TOKEN }})" >> $GITHUB_ENV
echo EOF >> $GITHUB_ENV
- name: Update pull request body
uses: riskledger/update-pr-description@v2
with:
body: ${{ env.PULL_REQUEST_NOTES }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: octue/[email protected]
id: pr-description
with:
pull_request_url: ${{ github.event.pull_request.url }}
api_token: ${{ secrets.GITHUB_TOKEN }}

- name: Update pull request body
uses: riskledger/update-pr-description@v2
with:
body: ${{ steps.pr-description.outputs.pull_request_description }}
token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@ ENV/
*.sum
.DS_Store
.octue

gcp-credentials.json
.terraform*
13 changes: 2 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,10 @@ repos:
- id: check-branch-name
args:
- '^main$'
- '^development$'
- '^devops/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^doc/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^feature/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^enhancement/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^fix/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^hotfix/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^review/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^refactor/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- '^test/([a-z][a-z0-9]*)(-[a-z0-9]+)*$'
- "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$"

- repo: https://github.com/octue/conventional-commits
rev: 0.5.3
rev: 0.9.0
hooks:
- id: check-commit-message-is-conventional
stages: [commit-msg]
6 changes: 3 additions & 3 deletions app_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"children": [
{
"key": "turbsim",
"id": "aerosense/turbsim-service",
"id": "octue/turbsim-service:0.2.0",
"backend": {
"name": "GCPPubSubBackend",
"project_name": "aerosense-twined"
"project_name": "octue-openfast"
}
}
],
"output_location": "gs://openfast-data/output"
"output_location": "gs://octue-openfast-data/openfast/output"
}
41 changes: 0 additions & 41 deletions mkver.conf

This file was deleted.

11 changes: 2 additions & 9 deletions octue.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
services:
- name: openfast-service
organisation: aerosense
namespace: octue
app_configuration_path: app_configuration.json
project_name: aerosense-twined
region: europe-west1
repository_owner: aerosense-ai
repository_name: openfast-service
branch_pattern: ^main$
dockerfile_path: Dockerfile
maximum_instances: 10
memory: 1024Mi
crash_diagnostics_cloud_path: gs://octue-openfast-service/diagnostics
4 changes: 2 additions & 2 deletions openfast/routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import coolname
from octue.cloud import storage
from octue.resources import Dataset, Manifest
from octue.utils.processes import run_subprocess_and_log_stdout_and_stderr
from octue.utils.processes import run_logged_subprocess


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -49,7 +49,7 @@ def run_openfast(analysis):
os.chdir(os.path.abspath(os.path.dirname(main_openfast_input_file.local_path)))

logger.info("Beginning openfast analysis.")
run_subprocess_and_log_stdout_and_stderr(command=["openfast", main_openfast_input_file.name], logger=logger)
run_logged_subprocess(command=["openfast", main_openfast_input_file.name], logger=logger)

output_filename = os.path.splitext(main_openfast_input_file.name)[0]
old_output_file_path = os.path.splitext(main_openfast_input_file.local_path)[0] + ".out"
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

setup(
name="openfast-service",
version="0.2.0",
author="cortadocodes <cortado.codes@protonmail.com>",
version="0.3.0",
author="Marcus Lugg <marcus@octue.com>",
py_modules=["app"],
install_requires=[
"coolname>=1.1,<2",
"octue==0.26.0",
"octue==0.50.1",
],
)
2 changes: 2 additions & 0 deletions terraform/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gcp-credentials.json
.terraform*
6 changes: 6 additions & 0 deletions terraform/artifact_registry.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "google_artifact_registry_repository" "artifact_registry_repository" {
location = var.region
repository_id = "${var.service_namespace}"
description = "Docker image repository"
format = "DOCKER"
}
Loading

0 comments on commit 929c607

Please sign in to comment.