From 8839c32b2fbbf0f7015fef00f354a70a2fca109c Mon Sep 17 00:00:00 2001 From: Sergii Baidachnyi Date: Fri, 27 Jun 2025 06:46:27 -0700 Subject: [PATCH 1/4] clean the repository --- .buildcontainer/Dockerfile | 42 --------- .github/simple-image-container-app.yaml | 64 ------------- .github/workflows/.gitkeep | 0 .github/workflows/build_csharp.yml | 37 -------- .github/workflows/build_devops_container.yml | 48 ---------- .github/workflows/build_java.yml | 36 ------- ...python.yml => build_validation_python.yml} | 0 .github/workflows/platform_cd_python.yml | 94 ------------------- .github/workflows/platform_ci_python.yml | 45 +-------- .github/workflows/platform_pr_python.yml | 48 +--------- csharp/.csproj | 18 ---- csharp/.gitkeep | 0 java/.gitkeep | 0 java/checkstyle.xml | 16 ---- java/pom.xml | 37 -------- 15 files changed, 3 insertions(+), 482 deletions(-) delete mode 100644 .buildcontainer/Dockerfile delete mode 100644 .github/simple-image-container-app.yaml delete mode 100644 .github/workflows/.gitkeep delete mode 100644 .github/workflows/build_csharp.yml delete mode 100644 .github/workflows/build_devops_container.yml delete mode 100644 .github/workflows/build_java.yml rename .github/workflows/{build_python.yml => build_validation_python.yml} (100%) delete mode 100644 .github/workflows/platform_cd_python.yml delete mode 100644 csharp/.csproj delete mode 100644 csharp/.gitkeep delete mode 100644 java/.gitkeep delete mode 100644 java/checkstyle.xml delete mode 100644 java/pom.xml diff --git a/.buildcontainer/Dockerfile b/.buildcontainer/Dockerfile deleted file mode 100644 index 6a3658a..0000000 --- a/.buildcontainer/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -FROM ubuntu:22.04 - -ARG USERNAME=vscode - -USER root - -RUN apt-get update -y && apt-get install -y sudo wget gnupg software-properties-common curl bash && \ - # Download and install Miniconda - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \ - bash /tmp/miniconda.sh -b -p /opt/miniconda && \ - rm /tmp/miniconda.sh && \ - # Create a non-root user - useradd -m -s /bin/bash $USERNAME && \ - echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME && \ - chmod 0440 /etc/sudoers.d/$USERNAME && \ - # Change ownership of Miniconda to the non-root user - chown -R $USERNAME:$USERNAME /opt/miniconda - -ENV PATH=/opt/miniconda/bin:$PATH - -# Install dependencies -WORKDIR /home/$USERNAME - -# Install Azure CLI -RUN sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl && \ - curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash && \ - az config set extension.use_dynamic_install=yes_without_prompt && \ - az extension add -n ml - -COPY python/requirements.txt . - -# Create Conda environment and install Python dependencies -RUN conda create -n llm-env python=3.12 pip=23.2 -q -y && \ - conda run -n llm-env pip install -r requirements.txt && \ - conda clean -a -y && \ - conda run -n llm-env pip list - -RUN echo "conda activate llm-env" >> /home/$USERNAME/.bashrc - -ENV PATH=/opt/miniconda/envs/llm-env/bin:$PATH - -CMD ["conda", "run", "-n", "llm-env", "python", "--version"] diff --git a/.github/simple-image-container-app.yaml b/.github/simple-image-container-app.yaml deleted file mode 100644 index 0224bf3..0000000 --- a/.github/simple-image-container-app.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: $CONTAINER_APP_NAME -location: eastus -resourceGroup: $RESOURCE_GROUP -environment: default - -identity: - type: UserAssigned - userAssignedIdentities: - "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/llm-app-user": {} - -properties: - configuration: - ingress: - external: true - targetPort: 8000 # Port exposed for the main application - transport: auto - allowInsecure: true - traffic: - - latestRevision: true - weight: 100 # 100% traffic to the latest revision of the main app - identitySettings: - - identity: "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/llm-app-user" - lifecycle: Main - template: - containers: - - image: $ACR_NAME.azurecr.io/$IMAGE_OTELCOL_NAME:$IMAGE_TAG - name: otel-collector - ports: - - containerPort: 4317 # Default OTLP gRPC port - resources: - cpu: "0.5" - memory: "1.0Gi" - env: - - name: APPLICATIONINSIGHTS_CONNECTION_STRING - value: $APPLICATIONINSIGHTS_CONNECTION_STRING - - - image: $ACR_NAME.azurecr.io/$IMAGE_LLMAPP_NAME:$IMAGE_TAG - name: sk-financial-analyst - ports: - - containerPort: 8000 - probes: - - type: Liveness - httpGet: - path: "/" - port: 8000 - initialDelaySeconds: 5 - periodSeconds: 5 - resources: - cpu: "1.0" # Allocate 1 CPU - memory: "2.0Gi" - - scale: - minReplicas: 1 - maxReplicas: 2 - rules: - - name: httpscalingrule - custom: - type: http - metadata: - concurrentRequests: '50' - -networks: - default: - driver: bridge \ No newline at end of file diff --git a/.github/workflows/.gitkeep b/.github/workflows/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/.github/workflows/build_csharp.yml b/.github/workflows/build_csharp.yml deleted file mode 100644 index ba9c091..0000000 --- a/.github/workflows/build_csharp.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build Csharp Validation Workflow - -on: - workflow_call: - -env: - DOTNET_VERSION: "8.0.10" - -jobs: - run-unit-tests-csharp: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Setup .NET - uses: actions/setup-dotnet@v2 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Restore Dependencies - run: dotnet restore - - - name: Lint C# Code - run: dotnet format --check - - - name: Build Project - run: dotnet build --no-restore --configuration Release - - - name: Run Unit Tests - run: dotnet test --no-build --configuration Release --logger "trx;LogFileName=test-results.trx" - - - name: Publish Test Results - uses: actions/upload-artifact@v3 - with: - name: csharp-test-results - path: "**/TestResults/*.trx" \ No newline at end of file diff --git a/.github/workflows/build_devops_container.yml b/.github/workflows/build_devops_container.yml deleted file mode 100644 index e0c8045..0000000 --- a/.github/workflows/build_devops_container.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Pre-build Dev Container Image and Push to Azure Container Registry - -on: - pull_request: - branches: - - 'main' - paths: - - '.github/workflows/build_devops_container.yml' - - 'python/requirements.txt' - -env: - IMAGE_NAME: devops_container_image - REGISTRY: ${{ secrets.ACR_CONTAINER_REGISTRY }}.azurecr.io - -permissions: - id-token: write - contents: read - -jobs: - build-and-push-build-container: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Azure login - uses: azure/login@v2 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - - name: Login to ACR with Azure CLI - run: | - az acr login --name ${{ secrets.ACR_CONTAINER_REGISTRY }} --username ${{ secrets.ACR_USERNAME }} --password ${{ secrets.ACR_PASSWORD }} - - - name: Build and push Docker image - uses: docker/build-push-action@v2 - with: - context: . - file: ./.buildcontainer/Dockerfile - push: true - no-cache: true - tags: ${{ secrets.ACR_CONTAINER_REGISTRY }}.azurecr.io/${{ env.IMAGE_NAME }}:latest \ No newline at end of file diff --git a/.github/workflows/build_java.yml b/.github/workflows/build_java.yml deleted file mode 100644 index a6b7061..0000000 --- a/.github/workflows/build_java.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build Java Validation Workflow - -on: - workflow_call: - -env: - JAVA_VERSION: "21" - -jobs: - run-unit-tests-java: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - java-version: ${{ env.JAVA_VERSION }} - distribution: 'adopt' - cache: maven - - - name: Build with Maven - run: mvn clean install - - - name: Lint Java Code - run: mvn checkstyle:check - - - name: Run Java Unit Tests - run: mvn test - - - name: Publish Java Test Results - uses: actions/upload-artifact@v3 - with: - name: java-test-results - path: "**/target/surefire-reports/*.xml" \ No newline at end of file diff --git a/.github/workflows/build_python.yml b/.github/workflows/build_validation_python.yml similarity index 100% rename from .github/workflows/build_python.yml rename to .github/workflows/build_validation_python.yml diff --git a/.github/workflows/platform_cd_python.yml b/.github/workflows/platform_cd_python.yml deleted file mode 100644 index 3f505cb..0000000 --- a/.github/workflows/platform_cd_python.yml +++ /dev/null @@ -1,94 +0,0 @@ ---- - name: CD Platform Python Workflow - - on: - push: - branches: - - 'main' - paths: - - '.github/**' - - 'python/**' - - 'tests/**' - - 'evaluators/**' - - permissions: - id-token: write - contents: read - - env: - GITHUB_SHA: ${{ github.sha }} - - jobs: - build-and-deploy-python: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Azure login with federated credentials - uses: azure/login@v2 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - - name: Azure CLI script - uses: azure/cli@v2 - with: - azcliversion: latest - inlineScript: | - az account show - - - name: Docker login ACR - uses: Azure/docker-login@v1 - with: - login-server: llmappcontainerregistry.azurecr.io/ - username: ${{ secrets.ACR_USERNAME }} - password: ${{ secrets.ACR_PASSWORD }} - - - name: Build and push Docker image - working-directory: python - run: | - export APPLICATIONINSIGHTS_CONNECTION_STRING=${{secrets.APPLICATIONINSIGHTS_CONNECTION_STRING}} - export AZURE_CLIENT_ID="077e01b1-31dc-4c39-923f-dd7988033567" - export AZURE_TENANT_ID=${{secrets.AZURE_TENANT_ID}} - export MI_CLIENT_ID="077e01b1-31dc-4c39-923f-dd7988033567" - docker compose -f common/deployments/docker-compose.yaml \ - up --build --remove-orphans --detach - docker tag deployments-sk-financial-analyst:latest llmappcontainerregistry.azurecr.io/deployments-sk-financial-analyst:${{ github.sha }} - docker tag deployments-otel-collector:latest llmappcontainerregistry.azurecr.io/deployments-otel-collector:${{ github.sha }} - docker push llmappcontainerregistry.azurecr.io/deployments-sk-financial-analyst:${{ github.sha }} - docker push llmappcontainerregistry.azurecr.io/deployments-otel-collector:${{ github.sha }} - - - name: Set Environment Variables - run: | - echo "CONTAINER_APP_NAME=mlops-llm-containerapp" >> $GITHUB_ENV - echo "RESOURCE_GROUP=mlops-llm-application" >> $GITHUB_ENV - echo "SUBSCRIPTION_ID=$(az account show --query id -o tsv)" >> $GITHUB_ENV - echo "ENVIRONMENT_NAME=default" >> $GITHUB_ENV - echo "ACR_NAME=llmappcontainerregistry" >> $GITHUB_ENV - echo "IMAGE_OTELCOL_NAME=deployments-otel-collector" >> $GITHUB_ENV - echo "IMAGE_LLMAPP_NAME=deployments-sk-financial-analyst" >> $GITHUB_ENV - echo "IMAGE_TAG=${{ github.sha }}" >> $GITHUB_ENV - echo MI_CLIENT_ID="077e01b1-31dc-4c39-923f-dd7988033567" >> $GITHUB_ENV - echo APPLICATIONINSIGHTS_CONNECTION_STRING=${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING}} >> $GITHUB_ENV - echo AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }} >> $GITHUB_ENV - - - name: Substitute Variables in YAML - run: | - envsubst < .github/simple-image-container-app.yaml > .github/simple-image-container-app.processed.yaml - - # the below action doesn't throw an error or fail when the image fails to build in the container. - - name: Build and deploy Container App and Open telemetry collector - uses: azure/container-apps-deploy-action@v1 - with: - yamlConfigPath: .github/simple-image-container-app.processed.yaml - acrName: ${{ env.ACR_NAME }} - acrUsername: ${{ secrets.ACR_USERNAME }} - acrPassword: ${{ secrets.ACR_PASSWORD }} - containerAppName: ${{ env.CONTAINER_APP_NAME }} - resourceGroup: ${{ env.RESOURCE_GROUP }} \ No newline at end of file diff --git a/.github/workflows/platform_ci_python.yml b/.github/workflows/platform_ci_python.yml index 37443d9..f3293ac 100644 --- a/.github/workflows/platform_ci_python.yml +++ b/.github/workflows/platform_ci_python.yml @@ -16,7 +16,7 @@ contents: read jobs: - build-and-deploy-python: + run-and-deploy-python: runs-on: ubuntu-latest steps: - name: Azure login @@ -33,46 +33,3 @@ inlineScript: | az account show - run-generate-eval-report-in-container: - name: Run generate_eval_report_in_container - needs: build-and-deploy-python - runs-on: ubuntu-latest - - container: - image: llmappcontainerregistry.azurecr.io/devops_container_image:latest - credentials: - username: ${{ secrets.ACR_USERNAME }} - password: ${{ secrets.ACR_PASSWORD }} - options: --user root - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Check Azure CLI Availability - run: | - echo "Current PATH: $PATH" - which az - ls -l $(which az) || echo "az not found in the expected directory" - az --version - - - name: Azure login - uses: azure/login@v2 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - - name: Run generate_report - working-directory: python - env: - KEY_VAULT_URL: ${{ vars.KEY_VAULT_URL }} - NEWS_ANALYST_MODEL_NAME: ${{ vars.NEWS_ANALYST_MODEL_NAME }} - FINANCIAL_ANALYST_MODEL_NAME: ${{ vars.FINANCIAL_ANALYST_MODEL_NAME }} - REPORT_GENERATOR_MODEL_NAME: ${{ vars.REPORT_GENERATOR_MODEL_NAME }} - run: | - echo "Verifying Python Path" - which python - echo "Installed Packages:" - pip list - python -u -m sk_financial_analyst.executors.single_item_executor --logging_enabled diff --git a/.github/workflows/platform_pr_python.yml b/.github/workflows/platform_pr_python.yml index 5d1fe44..1b2739a 100644 --- a/.github/workflows/platform_pr_python.yml +++ b/.github/workflows/platform_pr_python.yml @@ -19,49 +19,5 @@ jobs: build-validation-python: - name: Build Validation Python - uses: ./.github/workflows/build_python.yml - - run-generate-eval-report-in-container: - name: Run generate_eval_report_in_container - needs: build-validation-python - runs-on: ubuntu-latest - - container: - image: llmappcontainerregistry.azurecr.io/devops_container_image:latest - credentials: - username: ${{ secrets.ACR_USERNAME }} - password: ${{ secrets.ACR_PASSWORD }} - options: --user root - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Check Azure CLI Availability - run: | - echo "Current PATH: $PATH" - which az - ls -l $(which az) || echo "az not found in the expected directory" - az --version - - - name: Azure login - uses: azure/login@v2 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - - name: Run generate_report - working-directory: python - env: - KEY_VAULT_URL: ${{ vars.KEY_VAULT_URL }} - NEWS_ANALYST_MODEL_NAME: ${{ vars.NEWS_ANALYST_MODEL_NAME }} - FINANCIAL_ANALYST_MODEL_NAME: ${{ vars.FINANCIAL_ANALYST_MODEL_NAME }} - REPORT_GENERATOR_MODEL_NAME: ${{ vars.REPORT_GENERATOR_MODEL_NAME }} - run: | - echo "Verifying Python Path" - which python - echo "Installed Packages:" - pip list - python -u -m sk_financial_analyst.executors.single_item_executor --logging_enabled + name: Validate Python Code + uses: ./.github/workflows/build_validation_python.yml diff --git a/csharp/.csproj b/csharp/.csproj deleted file mode 100644 index 6684df9..0000000 --- a/csharp/.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - Exe - net8.0 - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - diff --git a/csharp/.gitkeep b/csharp/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/java/.gitkeep b/java/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/java/checkstyle.xml b/java/checkstyle.xml deleted file mode 100644 index 3655187..0000000 --- a/java/checkstyle.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/java/pom.xml b/java/pom.xml deleted file mode 100644 index 1ff456a..0000000 --- a/java/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - 4.0.0 - com.microsoft.mlops-llm-application-service - mlops-llm-application-service - 1.3.1-SNAPSHOT - pom - https://github.com/microsoft/mlops-llm-application-service - MLOps LLM Application Service - MLOps LLM Application Service Project - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.5.0 - - checkstyle.xml - UTF-8 - true - true - - - - validate - - check - - - - - - - From b6633720c6e0a8940300de00b1682a07f81f42f8 Mon Sep 17 00:00:00 2001 From: Sergii Baidachnyi Date: Fri, 27 Jun 2025 07:07:15 -0700 Subject: [PATCH 2/4] pre-commit fix --- .pre-commit-config.yaml | 69 ++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c879e1c..af69623 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,55 +2,34 @@ exclude: '.azureml|.devcontainer|.github|.vscode|junit' repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - # - id: check-yaml - #- id: check-json - - id: detect-private-key - - id: check-merge-conflict + - id: trailing-whitespace + - id: end-of-file-fixer + - id: detect-private-key + - id: check-merge-conflict + - repo: https://github.com/psf/black rev: 24.4.2 # Replace by any tag/version: https://github.com/psf/black/tags hooks: - - id: black - language_version: python3 # Should be a command that runs python3.6+ - args: - - "--line-length=120" - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + - id: black + language_version: python3 # Should be a command that runs python3.6+ + args: + - "--line-length=120" + + - repo: https://github.com/pycqa/flake8 + rev: '7.1.1' # pick a git hash / tag to point to hooks: - - id: flake8 - args: - - "--max-line-length=120" - # Temporary disable this since it gets stuck when updating env - # - repo: https://github.com/streetsidesoftware/cspell-cli - # rev: v7.3.0 - # hooks: - # - id: cspell - # args: ['--config', '.cspell.json', "--no-must-find-files"] + - id: flake8 + additional_dependencies: [flake8-docstrings] + args: + - "--max-line-length=120" + - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: 6.0.1 hooks: - - id: isort - # stages: [commit] - name: isort-python - # Use black profile for isort to avoid conflicts - # see https://github.com/PyCQA/isort/issues/1518 - args: ["--profile", "black", --line-length=120] - # - repo: https://github.com/pre-commit/mirrors-eslint - # rev: '' # Use the desired ESLint version - # hooks: - # - id: eslint - # files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx - # types: [file] - # additional_dependencies: - # - eslint-plugin-react@6.10.3 - - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v4.0.0-alpha.8" # Use the sha or tag you want to point at - hooks: - - id: prettier - types_or: [css, ts, tsx, json] - additional_dependencies: - - prettier@2.1.2 - - '@prettier/plugin-xml@0.12.0' + - id: isort + name: isort-python + args: ["--profile", "black", --line-length=120] + + From 282bc87176990097d592773456e6b6d538134d12 Mon Sep 17 00:00:00 2001 From: Sergii Baidachnyi Date: Fri, 27 Jun 2025 07:10:32 -0700 Subject: [PATCH 3/4] disable docstring until final cleanup --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index af69623..ecfccdc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: rev: '7.1.1' # pick a git hash / tag to point to hooks: - id: flake8 - additional_dependencies: [flake8-docstrings] + # additional_dependencies: [flake8-docstrings] args: - "--max-line-length=120" From 106d158ce99a8d3e1a8bcd43856ac349158663b2 Mon Sep 17 00:00:00 2001 From: Sergii Baidachnyi Date: Fri, 27 Jun 2025 07:14:15 -0700 Subject: [PATCH 4/4] remove blank lines --- .pre-commit-config.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ecfccdc..bb1533b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,5 +31,3 @@ repos: - id: isort name: isort-python args: ["--profile", "black", --line-length=120] - -