Skip to content

Commit

Permalink
A new start
Browse files Browse the repository at this point in the history
  • Loading branch information
nguu0123 committed Aug 30, 2024
0 parents commit 5c75334
Show file tree
Hide file tree
Showing 140 changed files with 15,435 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/gh-page-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: gh-page-ci
on:
push:
paths:
- "docs/**"
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material[imaging]
- run: mkdocs gh-deploy --force
55 changes: 55 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Python CI

on: [push, pull_request]

jobs:
tests:
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions tox-uv
- name: Test with tox
run: tox

pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.10.14"

- uses: eifinger/setup-rye@v4
with:
enable-cache: true

- name: Set Rye Config
run: |
rye config --set-bool behavior.global-python=true
rye config --set-bool behavior.use-uv=true
shell: bash

- name: Sync dependencies
run: rye sync

- name: Rye fmt
run: rye fmt --check

- name: Rye lint
run: rye lint src

- name: Rye lint
run: rye sync
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
test/
modules/orchestration/temp/
.venv
*.DS_Store
*.jpg
*.pt
*.pyc
*.egg-info
*.whl
*.gz
*__pycache__/
# *.pyc
.pypirc
.cache/
*.pyo
*.pyd
.ipynb_checkpoints/
.env
*.pem
observability/odop_obs/logs/*.txt
observability/odop_obs/tinyflux/*.csv
.python-version
54 changes: 54 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
fail_fast: true
default_language_version:
python: python3.10
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade

- repo: https://github.com/codespell-project/codespell
rev: "v2.3.0"
hooks:
- id: codespell
additional_dependencies:
- tomli
args: ["--write-changes", "--interactive", "3"]
files: ^src/qoa4ml/.*\.py$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
hooks:
- id: ruff
args: [--fix]
files: ^src/.*\.py$
- id: ruff-format

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
hooks:
- id: shellcheck

- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.4
hooks:
- id: gitleaks

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
files: /.*\.(py|yaml|json)$
- id: end-of-file-fixer
files: /.*\.(py|yaml|json)$
- id: check-yaml
exclude: ^templates/deployment_templates.yaml
files: /.*\.yaml$
args: [--allow-multiple-documents]
- id: check-json
files: /.*\.json$
- id: pretty-format-json
args: [--autofix]
files: /.*\.json$
- id: check-toml
files: /.*\.toml$
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10.14
34 changes: 34 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Change Log
======================

0.0.13 (18/04/2022)
---------------------
First Release

0.0.18 (10/05/2022)
---------------------
Update system metric

0.0.19 (31/05/2022)
---------------------
Update process metric

0.0.54 (20/09/2022)
---------------------
Update monitoring system/process/docker

0.0.62 (20/09/2022)
---------------------
Add metric and modify format of system/process reports

0.0.64 (15/03/2022)
---------------------
Add metric and modify format of system/process reports

0.0.72 (22/05/2023)
---------------------
Refactor source code

0.0.73 (19/04/2024)
---------------------
Add new ODOP observability module
11 changes: 11 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
7 changes: 7 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2021 AaltoSea

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# QoA4ML - Quality of Analytics for Machine Learning Services

---

[![Documentation](https://img.shields.io/badge/Documentation-gray?logo=materialformkdocs)](https://rdsea.github.io/QoA4ML/)
![PyPI - Status](https://img.shields.io/pypi/status/qoa4ml)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/qoa4ml)
![PyPI - Version](https://img.shields.io/pypi/v/qoa4ml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/qoa4ml)
![PyPI - Downloads](https://img.shields.io/pypi/dm/qoa4ml)
[![Code style: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/format.json)](https://github.com/astral-sh/ruff)
[![GitTutorial](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/rdsea/qoa4ml/python-ci.yml?logo=github&label=Github%20Actions)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# Introduction

QoA4ML consists of a set of utilities and specs for supporting quality of analytics in ML services. Especially, we focus on ML services across edge-cloud continuum, which are built as a composition of services.

## QoA4ML Specification

The design of QoA4ML specification is in [language](language/)

## QoA4ML Utilities

Developers can call many functions from a QoAClient and QoA4ML's [utilities](qoa4ml_lib/utils.py) to evaluate/report ML-specific attributes (e.g., data quality, inference performance), build the quality reports, and send them to the observation services.
The QoAClient can be initiated with various configurations for specifying observation server and communication protocols (e.g., messaging) in different formats (e.g., json and yaml).

The detail documents for QoA4ML utilization is presented in [qoa4ml_lib](qoa4ml_lib/)

> For a local build and use QoA4ML one can do:
```bash
$python3 -m pip install build
$cd qoa4ml_lib/
$python -m build
```

## QoA4ML Reports

QoA Reports are implemented in [QoA4ML Utilities](qoa4ml_lib/qoa4ml/), an object supports developers in reporting metrics, computation graphs, and inference graphs of ML services in a concrete format.
![Report schema](img/inf_report.png)

## Examples

Examples are in [examples](example/).

## QoA4ML Observability

The code is in [observability](observability/)

![The overal architecture of the Observability Service](img/qoa4mlos-overview.png)

QoA4ML Monitor is a component monitoring QoA for a ML model which is deployed in a serving platform.

- Monitoring Service: third party monitoring service used for managing monitoring data.
- We use Prometheus and other services: provide information on how to configure them.
- QoA4MLObservabilityService: a service reads QoA4ML specifications and real time monitoring data and detect if any violation occurs

### Implementation using OPA

[OPA engine](https://www.openpolicyagent.org/docs/latest/#running-opa) is used to implement the service for checking violation under [qoa4mlopa](observability/qoa4mlopa/)

### ROHE Implementation

Another new engine is currently developed under [rohe_ObService](observability/rohe_ObService/)

## References

- Hong-Linh Truong, Minh-Tri Nguyen, ["QoA4ML -A Framework for Supporting Contracts in Machine Learning Services"](https://research.aalto.fi/files/65786264/main.pdf), [The 2021 IEEE International Conference on Web Services (ICWS 2021)](https://conferences.computer.org/icws/2021/), to appear.
- Minh-Tri Nguyen, Hong-Linh Truong [Demonstration Paper: Monitoring Machine Learning Contracts with QoA4ML](https://research.aalto.fi/files/56621517/main.pdf), Companion of the 2021 ACM/SPEC International Conference on Performance Engineering (ICPE'21), Apr. 19-23, 2021
- https://www.researchgate.net/publication/341762862_R3E_-An_Approach_to_Robustness_Reliability_Resilience_and_Elasticity_Engineering_for_End-to-End_Machine_Learning_Systems
34 changes: 34 additions & 0 deletions config/rohe_obs_conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"collector": {
"amqp_collector": {
"class": "amqp",
"conf": {
"end_point": "localhost",
"exchange_name": "exchange_name",
"exchange_type": "topic",
"in_queue": "collector_1",
"in_routing_key": "in_routing_key"
}
}
},
"connector": {
"amqp_connector": {
"class": "amqp",
"conf": {
"end_point": "localhost",
"exchange_name": "exchange_name",
"exchange_type": "topic",
"out_routing_key": "out_routing_key"
}
}
},
"database": {
"collection": "registration",
"db_name": "rohe_observation",
"url": "mongodb://localhost:27017/"
},
"false_rate": 3,
"output_folder": "/results/",
"sample_rate": 50,
"timer": 10
}
30 changes: 30 additions & 0 deletions config/template_config/client_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
#client configuration
client:
user_id: aaltosea1
instance_name: data_handling01
stage_id: Gateway
functionality: REST
application_name: test
role: ml

# collector configuration
collector:
amqp_collector:
class: amqp
conf:
end_point: localhost
exchange_name: exchange_name
exchange_type: topic
in_routing_key: qoa1.report.#
in_queue: collector_1

# connector configuration
connector:
amqp_connector:
class: amqp
conf:
end_point: localhost
exchange_name: qoa4ml
exchange_type: topic
out_routing_key: qoa1.report.ml
Loading

0 comments on commit 5c75334

Please sign in to comment.