From d06ce92f38466ef4e6c148693c6d5a11502d1ec9 Mon Sep 17 00:00:00 2001 From: Anh-Dung Nguyen <80659317+nguu0123@users.noreply.github.com> Date: Mon, 27 May 2024 16:54:51 +0300 Subject: [PATCH 1/5] Create python-ci.yml --- .github/workflows/python-ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/python-ci.yml diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml new file mode 100644 index 0000000..7530895 --- /dev/null +++ b/.github/workflows/python-ci.yml @@ -0,0 +1,29 @@ +name: Python CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: 3.10 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r dev_requirements.txt + pip install -r ml_requirements.txt + - name: Cache pre-commit hooks + uses: actions/cache@v2 + with: + path: ~/.cache/pre-commit + key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files From 84176043e8e47dd7e1304fec9f2250b16e511d1d Mon Sep 17 00:00:00 2001 From: Anh-Dung Nguyen <80659317+nguu0123@users.noreply.github.com> Date: Mon, 27 May 2024 16:56:12 +0300 Subject: [PATCH 2/5] Update python-ci.yml --- .github/workflows/python-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 7530895..1d8c0aa 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -11,7 +11,7 @@ jobs: - name: Set up Python 3.10 uses: actions/setup-python@v3 with: - python-version: 3.10 + python-version: "3.10" - name: Install dependencies run: | python -m pip install --upgrade pip From 9f97816bc142d4a5b1ba31ee8d672316288d4704 Mon Sep 17 00:00:00 2001 From: Anh-Dung Nguyen <80659317+nguu0123@users.noreply.github.com> Date: Mon, 27 May 2024 16:59:52 +0300 Subject: [PATCH 3/5] Update python-ci.yml --- .github/workflows/python-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 1d8c0aa..8f2d3f8 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -15,6 +15,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + cd qoa4ml_lib pip install -r requirements.txt pip install -r dev_requirements.txt pip install -r ml_requirements.txt From 04a9887ef1705e38ed32a4b3ae274662e54af8d7 Mon Sep 17 00:00:00 2001 From: Anh-Dung Nguyen <80659317+nguu0123@users.noreply.github.com> Date: Tue, 28 May 2024 10:04:07 +0300 Subject: [PATCH 4/5] Update python-ci.yml --- .github/workflows/python-ci.yml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 8f2d3f8..1cbd31b 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -3,13 +3,11 @@ name: Python CI on: [push, pull_request] jobs: - build: + pre-commit: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install dependencies @@ -18,13 +16,7 @@ jobs: cd qoa4ml_lib pip install -r requirements.txt pip install -r dev_requirements.txt - pip install -r ml_requirements.txt - - name: Cache pre-commit hooks - uses: actions/cache@v2 - with: - path: ~/.cache/pre-commit - key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }} - - name: Install pre-commit - run: pip install pre-commit - - name: Run pre-commit - run: pre-commit run --all-files + # Uncomment when fix ydata + #pip install -r ml_requirements.txt + cd .. + - uses: pre-commit/action@v3.0.1 From bb8597dda707a7cb12ac5c6d426f71f07120a423 Mon Sep 17 00:00:00 2001 From: Tri Nguyen Date: Tue, 28 May 2024 10:44:01 +0300 Subject: [PATCH 5/5] add init module --- example/simple/test.py | 1 - qoa4ml_lib/VERSION | 2 +- qoa4ml_lib/qoa4ml/__init__.py | 17 ++++++++++------- qoa4ml_lib/qoa4ml/config/__init__.py | 0 qoa4ml_lib/qoa4ml/lang/__init__.py | 0 qoa4ml_lib/qoa4ml/qoa_client.py | 5 ++--- qoa4ml_lib/qoa4ml/utils/__init__.py | 0 7 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 qoa4ml_lib/qoa4ml/config/__init__.py create mode 100644 qoa4ml_lib/qoa4ml/lang/__init__.py create mode 100644 qoa4ml_lib/qoa4ml/utils/__init__.py diff --git a/example/simple/test.py b/example/simple/test.py index 6829457..65330b9 100644 --- a/example/simple/test.py +++ b/example/simple/test.py @@ -10,7 +10,6 @@ from devtools import debug from qoa4ml.qoa_client import QoaClient -from qoa4ml.reports.rohe_reports import RoheReport client1 = QoaClient(config_path="./config/client1.yaml") client2 = QoaClient(config_path="./config/client2.yaml") diff --git a/qoa4ml_lib/VERSION b/qoa4ml_lib/VERSION index 0ea3a94..7179039 100644 --- a/qoa4ml_lib/VERSION +++ b/qoa4ml_lib/VERSION @@ -1 +1 @@ -0.2.0 +0.2.3 diff --git a/qoa4ml_lib/qoa4ml/__init__.py b/qoa4ml_lib/qoa4ml/__init__.py index e923901..12fcf54 100644 --- a/qoa4ml_lib/qoa4ml/__init__.py +++ b/qoa4ml_lib/qoa4ml/__init__.py @@ -1,8 +1,11 @@ # NOTE: Mark lazy module globally, only load when used -# -# lazy_import.lazy_module("numpy") -# lazy_import.lazy_module("tensorflow") -# lazy_import.lazy_module("psutil") -# lazy_import.lazy_module("pydantic") -# lazy_import.lazy_module("fastapi") -# lazy_import.lazy_module("tinyflux") +import lazy_import + +lazy_import.lazy_module("requests") +lazy_import.lazy_module("tensorflow") +lazy_import.lazy_module("numpy") +lazy_import.lazy_module("pandas") +lazy_import.lazy_module("fastapi") +lazy_import.lazy_module("tinyflux") +lazy_import.lazy_module("psutil") + diff --git a/qoa4ml_lib/qoa4ml/config/__init__.py b/qoa4ml_lib/qoa4ml/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/qoa4ml_lib/qoa4ml/lang/__init__.py b/qoa4ml_lib/qoa4ml/lang/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/qoa4ml_lib/qoa4ml/qoa_client.py b/qoa4ml_lib/qoa4ml/qoa_client.py index 2941141..04b3372 100644 --- a/qoa4ml_lib/qoa4ml/qoa_client.py +++ b/qoa4ml_lib/qoa4ml/qoa_client.py @@ -7,11 +7,9 @@ import uuid from threading import Thread from typing import Any, Dict, Generic, List, Optional, Type, TypeVar, Union - -import requests from pydantic import create_model from qoa4ml.reports.rohe_reports import RoheReport - +import requests from qoa4ml.reports.abstract_report import AbstractReport # from .connector.mqtt_connector import Mqtt_Connector @@ -153,6 +151,7 @@ def __init__( def registration(self, url: str): # get connector configuration by registering with the monitoring service + return requests.request( "POST", url, headers=headers, data=self.client_config.json() ) diff --git a/qoa4ml_lib/qoa4ml/utils/__init__.py b/qoa4ml_lib/qoa4ml/utils/__init__.py new file mode 100644 index 0000000..e69de29