Skip to content

Commit

Permalink
only install flake8 for lint, added COPYING file, added logger to Ser…
Browse files Browse the repository at this point in the history
…vice, URLs in README changed, Core Engine URL changed
  • Loading branch information
andrptrc committed Dec 14, 2023
1 parent 739d5dc commit f7ab320
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
exclude = .git,__pycache__,venv,.venv
max-line-length = 120
2 changes: 1 addition & 1 deletion .github/actions/lint-python-app/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runs:
- name: Install app dependencies
shell: bash
working-directory: ${{ inputs.python-app-path }}
run: pip3 install -r requirements.txt -r requirements-all.txt
run: pip3 install flake8

- name: Lint Python code
shell: bash
Expand Down
36 changes: 9 additions & 27 deletions .github/workflows/image-resize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,6 @@ on:
branches:
- main
- prod
paths:
- .github/actions/build-and-push-docker-image-to-github/action.yml
- .github/actions/execute-command-on-kubernetes-cluster/action.yml
- .github/actions/lint-python-app/action.yml
- .github/actions/test-python-app/action.yml
- .github/workflows/image-resize.yml
- common-code/**/*
- services/image-resize/**/*

pull_request:
paths:
- .github/actions/build-and-push-docker-image-to-github/action.yml
- .github/actions/execute-command-on-kubernetes-cluster/action.yml
- .github/actions/lint-python-app/action.yml
- .github/actions/test-python-app/action.yml
- .github/workflows/image-resize.yml
- common-code/**/*
- services/image-resize/**/*

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -44,7 +26,7 @@ jobs:
- name: Lint Python app
uses: ./.github/actions/lint-python-app
with:
python-app-path: ./services/image-resize
python-app-path: .

test:
needs: review
Expand All @@ -56,7 +38,7 @@ jobs:
- name: Test Python app
uses: ./.github/actions/test-python-app
with:
python-app-path: ./services/image-resize
python-app-path: .
token: ${{ secrets.GITHUB_TOKEN }}

release:
Expand All @@ -75,7 +57,7 @@ jobs:
docker-registry-username: ${{ github.actor }}
docker-registry-password: ${{ secrets.GITHUB_TOKEN }}
docker-image-name: swiss-ai-center/image-resize
docker-image-context: ./services/image-resize
docker-image-context: .
outputs:
docker-image-tags: ${{ steps.build-and-push-docker-image-to-github.outputs.docker-image-tags }}

Expand All @@ -90,11 +72,11 @@ jobs:

- name: Prepare configuration files
shell: bash
working-directory: services/image-resize/kubernetes
working-directory: ./kubernetes
env:
ENVIRONMENT: production
LOG_LEVEL: info
ENGINE_URLS: "'[\"https://core-engine-swiss-ai-center.kube.isc.heia-fr.ch\"]'"
ENGINE_URLS: "'[\"https://backend-core-engine-swiss-ai-center.kube.isc.heia-fr.ch\"]'"
SERVICE_URL: https://image-resize-swiss-ai-center.kube.isc.heia-fr.ch
run: |
# Set image-resize version
Expand All @@ -114,7 +96,7 @@ jobs:
with:
kube-config: ${{ secrets.KUBE_CONFIG_DEV }}
kube-namespace: swiss-ai-center-dev
kubectl-context: ./services/image-resize/kubernetes
kubectl-context: ./kubernetes
kubectl-args: |
apply \
-f image-resize.config-map.yml \
Expand All @@ -133,11 +115,11 @@ jobs:

- name: Prepare configuration files
shell: bash
working-directory: services/image-resize/kubernetes
working-directory: ./kubernetes
env:
ENVIRONMENT: production
LOG_LEVEL: info
ENGINE_URLS: "'[\"https://core-engine-swiss-ai-center.kube.isc.heia-fr.ch\"]'"
ENGINE_URLS: "'[\"https://backend-core-engine-swiss-ai-center.kube.isc.heia-fr.ch\"]'"
SERVICE_URL: https://image-resize-swiss-ai-center.kube.isc.heia-fr.ch
run: |
# Set image-resize version
Expand All @@ -157,7 +139,7 @@ jobs:
with:
kube-config: ${{ secrets.KUBE_CONFIG_PROD }}
kube-namespace: swiss-ai-center-prod
kubectl-context: ./services/image-resize/kubernetes
kubectl-context: ./kubernetes
kubectl-args: |
apply \
-f image-resize.config-map.yml \
Expand Down
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
## Material for MkDocs

# Cache
.cache

# Output directory
/public

## Python

# Environments
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# image-resize

_Check the [related documentation](https://swiss-ai-center.github.io/swiss-ai-center/reference/image-resize) for more information._
_Check the [related documentation](https://docs.swiss-ai-center.ch/reference/services/image-resize) for more information._
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
aiofile==3.8.7
common-code[test] @ git+https://github.com/swiss-ai-center/core-engine.git@main#subdirectory=common-code
common-code[test] @ git+https://github.com/swiss-ai-center/common-code.git@main
flake8==5.0.4
numpy==1.21.4
opencv-python==4.7.0.68
Expand Down
2 changes: 2 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class MyService(Service):

# Any additional fields must be excluded for Pydantic to work
model: object = Field(exclude=True)
logger: object = Field(exclude=True)

def __init__(self):
super().__init__(
Expand All @@ -58,6 +59,7 @@ def __init__(self):
],
has_ai=False
)
self.logger = get_logger(settings)

def process(self, data):
raw = data["image"].data
Expand Down

0 comments on commit f7ab320

Please sign in to comment.