Skip to content

Commit

Permalink
streamline logging, minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
justinthelaw committed Oct 4, 2024
1 parent 4fb8de8 commit 0d9076e
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 62 deletions.
35 changes: 22 additions & 13 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,19 @@ includes:
###########################
- badge: ./tasks/badge.yaml
- create: ./tasks/create.yaml
- publish: ./tasks/utils.yaml
- publish: ./tasks/publish.yaml
- setup: ./tasks/setup.yaml
- deploy: ./tasks/deploy.yaml

tasks:
#######
# BADGE
# SETUP
#######
- name: nightly-uds-badge-verification
description: "Runs in a pipeline and produces a report for archiving"
- name: python-development
description: "Check and setup a local Python environment for LeapfrogAI development"
actions:
- description: "Create Reports Directory"
cmd: |
mkdir -p reports
- description: "Run UDS Badge Verification Task"
cmd: |
uds run badge:verify-uds-badge-cpu --no-progress 2>&1 | tee ./reports/intermediate-report.txt
- description: "Clean Up Final Report"
cmd: |
python3 .github/scripts/uds_verification_report.py | tee ./reports/final-report.txt
- task: setup:check-python
- task: setup:python-dependencies

########
# CREATE
Expand Down Expand Up @@ -125,3 +118,19 @@ tasks:
- task: deploy:vllm
- task: deploy:text-embeddings
- task: deploy:whisper

#######
# BADGE
#######
- name: nightly-uds-badge-verification
description: "Runs in a pipeline and produces a report for archiving"
actions:
- description: "Create Reports Directory"
cmd: |
mkdir -p reports
- description: "Run UDS Badge Verification Task"
cmd: |
uds run badge:verify-uds-badge-cpu --no-progress 2>&1 | tee ./reports/intermediate-report.txt
- description: "Clean Up Final Report"
cmd: |
python3 .github/scripts/uds_verification_report.py | tee ./reports/final-report.txt
30 changes: 1 addition & 29 deletions tasks/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,6 @@ includes:
- utils: ./utils.yaml

tasks:
############
# WORKAROUND
############
- name: log
description: "LeapfrogAI logger"
inputs:
log:
description: "Content to be logged to the CLI"
required: true
enable:
description: "Whether to enable or disable the logging"
default: "true"
required: false
actions:
- task: utils:log
with:
log: ${{ .inputs.log }}
enable: ${{ .inputs.enable }}

#########
# UTILITY
#########
Expand All @@ -47,26 +28,17 @@ tasks:
description: "Specifically for packages that are only partially in IronBank (e.g., migrations)"
default: "false"
actions:
- description: "If not running, create a local registry"
- description: "If not running or if local package development, create a local registry"
shell:
linux: bash
darwin: bash
cmd: |
if [[ ${FLAVOR} != "upstream" || ${{ .inputs.override }} != "false" ]]; then
if [ ! "$(docker ps -q -f name=${{ .inputs.name }})" ]; then
docker run -d -p ${{ .inputs.port }}:5000 --restart=always -q --name ${{ .inputs.name }} registry:2 > /dev/null 2>&1
echo "false"
fi
else
echo "true"
fi
mute: true
setVariables:
- name: ENABLE_LOG
- task: utils:log
with:
log: "Non-upstream flavor detected, skipping local registry creation"
enable: ${ENABLE_LOG}

###########
# REUSEABLE
Expand Down
71 changes: 53 additions & 18 deletions tasks/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ includes:
#########################
- setup-common: https://raw.githubusercontent.com/defenseunicorns/uds-common/975093c7191ba7ab5a70ded39c17b7bfc4f0ea64/tasks/setup.yaml

###########################
# LEAPFROGAI-SPECIFIC TASKS
###########################
- create: ./create.yaml

tasks:
#######
# TESTS
#######
- name: e2e-test-user
description: "Creates a test user in KeyCloak with fake credentials, mainly for CI testing workflows"
actions:
Expand All @@ -19,17 +17,14 @@ tasks:
- name: k3d-cpu-cluster-slim
description: "Creates a UDS K3d cluster with slim UDS Core and CPU-only Capability"
actions:
- task: create:log
with:
log: "Creating a UDS K3d cluster with slim UDS Core and CPU-only Capability"
- task: setup-common:k3d-test-cluster

#########
# CLUSTER
#########
- name: k3d-gpu-cluster-slim
description: "Creates a UDS K3d cluster with slim UDS Core and NVIDIA GPU Capability"
actions:
- task: create:log
with:
log: "Creating a UDS K3d cluster with slim UDS Core and NVIDIA GPU Capability"
- task: create:k3d-gpu-image
- task: setup-common:k3d-test-cluster
with:
Expand All @@ -41,9 +36,6 @@ tasks:
- name: k3d-cpu-cluster-full
description: "Creates a UDS K3d cluster with full UDS Core and CPU-only Capability"
actions:
- task: create:log
with:
log: "Creating a UDS K3d cluster with full UDS Core and CPU-only Capability"
- task: setup-common:k3d-full-cluster
with:
version: 0.27.3
Expand All @@ -53,14 +45,57 @@ tasks:
- name: k3d-gpu-cluster-full
description: "Creates a UDS K3d cluster with full UDS Core and NVIDIA GPU Capability"
actions:
- task: create:log
with:
log: "Creating a UDS K3d cluster with full UDS Core and NVIDIA GPU Capability"
- task: create:k3d-gpu-image
- task: setup-common:k3d-full-cluster
with:
version: 0.27.3
snapshots: "false"
insecure_keycloak_admin: ${ENABLE_INSECURE_KEYCLOAK_ADMIN_PASSWORD}
options: "--set K3D_EXTRA_ARGS='--gpus=all --image=ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:${VERSION}'"
# Add dev dependencies installs for local building of all LeapfrogAI components

########
# PYTHON
########

- name: python-dependencies
description: "Install or re-install all development dependencies into a local Python environment"
actions:
- description: "Fresh installation of all Python dependencies"
cmd: |
python -m pip install ".[dev,dev-vllm,dev-whisper]" "src/leapfrogai_api" "src/leapfrogai_sdk" --no-cache-dir --force-reinstall
mute: true

- name: check-python
description: "Checks the local Python environment"
inputs:
path:
description: "Path to the pyproject.toml"
default: "pyproject.toml"
required: false
actions:
- description: "Check the local Python environment version"
shell:
linux: bash
darwin: bash
env:
- PYPROJECT_TOML=${{ .inputs.path }}
cmd: |
# Extract Python version requirement from pyproject.toml
PYTHON_REQ=$(uds zarf tools yq -o yaml -p toml '.project."requires-python"' "$PYPROJECT_TOML")
# Get the local Python version (e.g., 3.11.9)
LOCAL_PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')")
# Function to compare versions using 'packaging.specifiers' library
version_satisfies() {
python3 -c "from packaging.version import Version; from packaging.specifiers import SpecifierSet; \
import sys; sys.exit(0) if Version('$LOCAL_PYTHON_VERSION') in SpecifierSet('$1') else sys.exit(1)"
}
# Check if local Python version satisfies the requirements
if ! version_satisfies "$PYTHON_REQ"; then
exit 1
else
echo "Python version matches the requirement: $LOCAL_PYTHON_VERSION"
fi
mute: true
5 changes: 3 additions & 2 deletions tasks/utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ tasks:
default: "true"
required: false
actions:
- shell:
- description: "Printed LeapfrogAI logs"
shell:
linux: bash
darwin: bash
cmd: |
if [[ ${{ .inputs.enable }} == "true" ]]; then
printf "\n🐸 ${{ .inputs.log }}\n\n"
printf "\n🐸 ${{ .inputs.log }}\n\n"
fi
- name: tag
Expand Down

0 comments on commit 0d9076e

Please sign in to comment.