From 760336b114c14260fb15f83b57b56bcbfb9e0670 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 09:19:05 +0100 Subject: [PATCH 01/20] add monitoring --- .github/workflows/MLMonitoringData.yml | 28 ++++++++++++ .github/workflows/MLMonitoringPromotion.yml | 27 ++++++++++++ modules/ml-monitoring/.gitignore | 1 + modules/ml-monitoring/Makefile | 20 +++++++++ modules/ml-monitoring/src/evidently/.DS_Store | Bin 0 -> 6148 bytes .../src/evidently/Monitoring.Dockerfile | 14 ++++++ .../src/evidently/src/regression_report.py | 40 ++++++++++++++++++ .../src/requirements/requirements-dev.txt | 4 ++ .../src/requirements/requirements.txt | 0 modules/ml-pipeline/Makefile | 8 ++-- 10 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/MLMonitoringData.yml create mode 100644 .github/workflows/MLMonitoringPromotion.yml create mode 100644 modules/ml-monitoring/.gitignore create mode 100644 modules/ml-monitoring/Makefile create mode 100644 modules/ml-monitoring/src/evidently/.DS_Store create mode 100644 modules/ml-monitoring/src/evidently/Monitoring.Dockerfile create mode 100644 modules/ml-monitoring/src/evidently/src/regression_report.py create mode 100644 modules/ml-monitoring/src/evidently/src/requirements/requirements-dev.txt create mode 100644 modules/ml-monitoring/src/evidently/src/requirements/requirements.txt diff --git a/.github/workflows/MLMonitoringData.yml b/.github/workflows/MLMonitoringData.yml new file mode 100644 index 0000000..0119ffd --- /dev/null +++ b/.github/workflows/MLMonitoringData.yml @@ -0,0 +1,28 @@ +name: (REPLACE WITH LAMBDA) Run monitoring on data to ensure that fundamentally, the data and its relationships haven't changed + +on: + push: + branches: + - "model-**" + +jobs: + + Verify-Data: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Install packages to generate data report + run: | + pip install --upgrade pip + pip install -r modules/ml-monitoring/src/evidently/src/requirements/requirements.txt + + - name: Build Monitoring Data docker Image + run: | + cd modules/ml-monitoring/src/evidently/ + docker build . --file MonitoringData.Dockerfile --tag monitoring_data_test + + - name: Run Monitoring Data docker container + run: | + docker run monitoring_data_test diff --git a/.github/workflows/MLMonitoringPromotion.yml b/.github/workflows/MLMonitoringPromotion.yml new file mode 100644 index 0000000..89d6977 --- /dev/null +++ b/.github/workflows/MLMonitoringPromotion.yml @@ -0,0 +1,27 @@ +name: Run monitoring on an potential promotions (i.e. a new model registering, make sure results are not just "metric" better but everything makes sense) + +on: + push: + tags: + - 'NewModel**' + +jobs: + + Verify-Model: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Install packages to generate Model report + run: | + pip install --upgrade pip + pip install -r modules/ml-monitoring/src/evidently/src/requirements/requirements.txt + + - name: Build Monitoring Model docker Image + run: | + cd modules/ml-monitoring/src/evidently/ + docker build . --file MonitoringModel.Dockerfile --tag monitoring_model_test + + - name: Run Monitoring Model docker container + run: | + docker run monitoring_model_test diff --git a/modules/ml-monitoring/.gitignore b/modules/ml-monitoring/.gitignore new file mode 100644 index 0000000..832692f --- /dev/null +++ b/modules/ml-monitoring/.gitignore @@ -0,0 +1 @@ +.dev_env_monitoring/ diff --git a/modules/ml-monitoring/Makefile b/modules/ml-monitoring/Makefile new file mode 100644 index 0000000..20767ff --- /dev/null +++ b/modules/ml-monitoring/Makefile @@ -0,0 +1,20 @@ +export PYENV_ROOT=$(HOME)/.pyenv +export PATH := $(PYENV_ROOT)/bin:$(PATH) +PYTHON_VERSION ?= 3.10.12 + +.PHONY: init +init: dev-pyenv + +.PHONY: dev-pyenv +dev-pyenv: + curl https://pyenv.run | bash || echo "Pyenv - Already installed" + pyenv install ${PYTHON_VERSION} || echo "Python version already installed" + pyenv global ${PYTHON_VERSION} + python3 -m venv .dev_env_monitoring + . .dev_env_monitoring/bin/activate && pip install --upgrade pip && pip install -r src/evidently/src/requirements/requirements-dev.txt && pre-commit install + echo "TO ACTIVATE ENVIRONMENT, USE THE FOLLOWING COMMAND" + echo "source .dev_env_monitoring/bin/activate" + +.PHONY: dvc-init +dvc-init: + . .dev_env_monitoring/bin/activate && dvc init --subdir diff --git a/modules/ml-monitoring/src/evidently/.DS_Store b/modules/ml-monitoring/src/evidently/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..21bc00dcfb25777ef16a0cb30e9297058ce7f07a GIT binary patch literal 6148 zcmeHK%}T>S5Z-O8O({YS3Oz1(Em*767B3;z7cim+m718M!I&*cYYwH5v%Zi|;`2DO zy8(+ii`W_1{pNQ!`$6`HF~;3Rc*vN|7_*=ua#Sh=-Ibx5Nk-&2Mm7s#8G!W>%uMXB z1Acp*Wh`Y6LH_;w<0zZ=dY`;jZ)|Nht)|ts?z|_Ndvkxj$Xq|YLF-b=I4E^LxQeFv z#NIuV$=r{UX{rjMa0)56*HIG6+?9(Y%v7zX16IpwP3+Ecc`_VzMSnP0b;WYj?{&rT z(O|V|S$q2jrx%mw_$85VnobUEE7>tv!aFEtHLqTp#4>pVPnlh25fTH$05L!eY&HYt zT(H`kO#`i-7$62J7{L8OKtps478=#o0UchSG2TE#0Uh5Gh{B*_u+Rt*5UxuBbtyMb z46e(;FHD|eu+XT>8CNsIIA-SZ@xs;Y;1?>LaYrNd!~ij{&Olw8HlF|I@XJ&_^4Ckq zA_jf7i!x{HkLBT6E1=y&L&3ZP6%f$ZE&*WRKGIP^9T%uWo@21kh@+ri Rl>^d6KoLS6G4Klvd;yeYNtFNq literal 0 HcmV?d00001 diff --git a/modules/ml-monitoring/src/evidently/Monitoring.Dockerfile b/modules/ml-monitoring/src/evidently/Monitoring.Dockerfile new file mode 100644 index 0000000..71661d8 --- /dev/null +++ b/modules/ml-monitoring/src/evidently/Monitoring.Dockerfile @@ -0,0 +1,14 @@ +# Dockerfile that can be used to test loading a model to generate a prediction (part of CI/CD flow) +FROM python:3.10.12-slim + +COPY src/requirements/requirements.txt requirements.txt + +RUN pip install --upgrade pip +RUN pip install -r requirements.txt + +# Assuming in the CI/CD step, there will be a dvc pull step to get data and model, so will just need to run a single script +COPY src/ /home/src/ + +WORKDIR /home/src/ + +CMD [ "python", "regression_report.py"] diff --git a/modules/ml-monitoring/src/evidently/src/regression_report.py b/modules/ml-monitoring/src/evidently/src/regression_report.py new file mode 100644 index 0000000..49f424c --- /dev/null +++ b/modules/ml-monitoring/src/evidently/src/regression_report.py @@ -0,0 +1,40 @@ +import boto3 +import pandas as pd +from evidently.report import Report +from evidently.metric_preset import ( + DataDriftPreset, + DataQualityPreset, +) + + +def run_evidently_dashboard(local_output: str = "./report.html"): + + # DUMMY TEST CASE + ref = pd.read_parquet( + "s3://retrofit-data-dev/model_build_data/change_data/rdsap_full/train_validation_data.parquet" + ).head(100) + cur = pd.read_parquet( + "s3://retrofit-data-dev/model_build_data/change_data/rdsap_full/test_data.parquet" + ).head(100) + + report = Report( + metrics=[ + DataDriftPreset(), + DataQualityPreset(), + ] + ) + + report.run(reference_data=ref, current_data=cur) + report.save_html(local_output) + + s3 = boto3.client("s3") + + s3.upload_file(local_output, "retrofit-data-dev", "monitoring/test-report.html") + + print( + f'{local_output} uploaded to {"retrofit-data-dev" + "/" + "monitoring/test-report.html"} successfully.' + ) + + +if __name__ == "__main__": + run_evidently_dashboard() diff --git a/modules/ml-monitoring/src/evidently/src/requirements/requirements-dev.txt b/modules/ml-monitoring/src/evidently/src/requirements/requirements-dev.txt new file mode 100644 index 0000000..b5e534e --- /dev/null +++ b/modules/ml-monitoring/src/evidently/src/requirements/requirements-dev.txt @@ -0,0 +1,4 @@ +evidently==0.4.4 +pre-commit==3.3.3 +sphinx==7.2.5 +sphinx_rtd_theme==1.3.0 diff --git a/modules/ml-monitoring/src/evidently/src/requirements/requirements.txt b/modules/ml-monitoring/src/evidently/src/requirements/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/modules/ml-pipeline/Makefile b/modules/ml-pipeline/Makefile index 45a16f5..d4d6fb7 100644 --- a/modules/ml-pipeline/Makefile +++ b/modules/ml-pipeline/Makefile @@ -10,11 +10,11 @@ dev-pyenv: curl https://pyenv.run | bash || echo "Pyenv - Already installed" pyenv install ${PYTHON_VERSION} || echo "Python version already installed" pyenv global ${PYTHON_VERSION} - python3 -m venv .dev_env - . .dev_env/bin/activate && pip install --upgrade pip && pip install -r src/pipeline/src/requirements/training/requirements-dev.txt && pip install -r src/pipeline/src/requirements/version_control/requirements.txt && pre-commit install + python3 -m venv .dev_env_pipeline + . .dev_env_pipeline/bin/activate && pip install --upgrade pip && pip install -r src/pipeline/src/requirements/training/requirements-dev.txt && pip install -r src/pipeline/src/requirements/version_control/requirements.txt && pre-commit install echo "TO ACTIVATE ENVIRONMENT, USE THE FOLLOWING COMMAND" - echo "source .dev_env/bin/activate" + echo "source .dev_env_pipeline/bin/activate" .PHONY: dvc-init dvc-init: - . .dev_env/bin/activate && dvc init --subdir + . .dev_env_pipeline/bin/activate && dvc init --subdir From a1c91a59149832d689bbcd02a5c80a94e1517239 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 09:20:09 +0100 Subject: [PATCH 02/20] correctly name --- .../{Monitoring.Dockerfile => MonitoringData.Dockerfile} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/ml-monitoring/src/evidently/{Monitoring.Dockerfile => MonitoringData.Dockerfile} (100%) diff --git a/modules/ml-monitoring/src/evidently/Monitoring.Dockerfile b/modules/ml-monitoring/src/evidently/MonitoringData.Dockerfile similarity index 100% rename from modules/ml-monitoring/src/evidently/Monitoring.Dockerfile rename to modules/ml-monitoring/src/evidently/MonitoringData.Dockerfile From 3a6a6530e9a2862433da0f315cb375858b803d45 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 09:21:43 +0100 Subject: [PATCH 03/20] correctly name - add requirements --- .../src/evidently/src/requirements/requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ml-monitoring/src/evidently/src/requirements/requirements.txt b/modules/ml-monitoring/src/evidently/src/requirements/requirements.txt index e69de29..6c60e50 100644 --- a/modules/ml-monitoring/src/evidently/src/requirements/requirements.txt +++ b/modules/ml-monitoring/src/evidently/src/requirements/requirements.txt @@ -0,0 +1,2 @@ +boto3==1.28.41 +evidently==0.4.4 From edd0d92d444403b1794f8c6e79aa37fb2e8ef611 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 09:31:52 +0100 Subject: [PATCH 04/20] Run regression report --- .github/workflows/MLMonitoringData.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/MLMonitoringData.yml b/.github/workflows/MLMonitoringData.yml index 0119ffd..d033b19 100644 --- a/.github/workflows/MLMonitoringData.yml +++ b/.github/workflows/MLMonitoringData.yml @@ -18,11 +18,19 @@ jobs: pip install --upgrade pip pip install -r modules/ml-monitoring/src/evidently/src/requirements/requirements.txt - - name: Build Monitoring Data docker Image + - name: Run Monitoring Data report + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }} run: | - cd modules/ml-monitoring/src/evidently/ - docker build . --file MonitoringData.Dockerfile --tag monitoring_data_test + cd modules/ml-monitoring/src/evidently/src + python regression_report.py - - name: Run Monitoring Data docker container - run: | - docker run monitoring_data_test + # - name: Build Monitoring Data docker Image + # run: | + # cd modules/ml-monitoring/src/evidently/ + # docker build . --file MonitoringData.Dockerfile --tag monitoring_data_test + + # - name: Run Monitoring Data docker container + # run: | + # docker run monitoring_data_test From 9a286bce1908e878b87ec35064e3b6387f8d986f Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 12:18:43 +0100 Subject: [PATCH 05/20] disable monitoring --- .github/workflows/MLMonitoringData.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/MLMonitoringData.yml b/.github/workflows/MLMonitoringData.yml index d033b19..dc89a02 100644 --- a/.github/workflows/MLMonitoringData.yml +++ b/.github/workflows/MLMonitoringData.yml @@ -1,9 +1,9 @@ name: (REPLACE WITH LAMBDA) Run monitoring on data to ensure that fundamentally, the data and its relationships haven't changed -on: - push: - branches: - - "model-**" +# on: +# push: +# branches: +# - "model-**" jobs: From 573f0e2182e2f99a499e4793dbfdaf37e9a1f31e Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 12:25:26 +0100 Subject: [PATCH 06/20] disable monitoring --- .github/workflows/MLMonitoringData.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/MLMonitoringData.yml b/.github/workflows/MLMonitoringData.yml index dc89a02..df764fd 100644 --- a/.github/workflows/MLMonitoringData.yml +++ b/.github/workflows/MLMonitoringData.yml @@ -1,9 +1,9 @@ name: (REPLACE WITH LAMBDA) Run monitoring on data to ensure that fundamentally, the data and its relationships haven't changed -# on: -# push: -# branches: -# - "model-**" +on: + push: + branches: + - "off-**" jobs: From eb1f6ecaf2a13d5074c3e00a0136c658bb368459 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 18:36:33 +0100 Subject: [PATCH 07/20] new data location --- .../src/pipeline/src/configs/build_model.yaml | 4 +- .../src/configs/feature_processor.yaml | 6 +-- .../pipeline/src/configs/prepare_data.yaml | 2 +- modules/ml-pipeline/src/pipeline/src/dvc.lock | 44 +++++++++---------- modules/ml-pipeline/src/pipeline/src/dvc.yaml | 4 ++ 5 files changed, 32 insertions(+), 28 deletions(-) diff --git a/modules/ml-pipeline/src/pipeline/src/configs/build_model.yaml b/modules/ml-pipeline/src/pipeline/src/configs/build_model.yaml index d97cf22..a1307c1 100644 --- a/modules/ml-pipeline/src/pipeline/src/configs/build_model.yaml +++ b/modules/ml-pipeline/src/pipeline/src/configs/build_model.yaml @@ -1,5 +1,5 @@ -model_type: SKLearnLinearRegression -model_save_filepath: ./data/model/model.joblib +model_type: AutogluonAutoML +model_save_filepath: ./data/model/autogluonmodel/ SKLearnLinearRegression: null diff --git a/modules/ml-pipeline/src/pipeline/src/configs/feature_processor.yaml b/modules/ml-pipeline/src/pipeline/src/configs/feature_processor.yaml index 18e6f84..9aa02f0 100644 --- a/modules/ml-pipeline/src/pipeline/src/configs/feature_processor.yaml +++ b/modules/ml-pipeline/src/pipeline/src/configs/feature_processor.yaml @@ -3,6 +3,6 @@ feature_processor_config: subsample_amount: null subsample_seed: 0 target: RDSAP_CHANGE - drop_columns: ["UPRN", "HEAT_DEMAND_CHANGE"] - retain_features: ["TOTAL_FLOOR_AREA", "FLOOR_HEIGHT"] - # retain_features: null + drop_columns: ["UPRN", "HEAT_DEMAND_CHANGE", "CARBON_CHANGE"] + # retain_features: ["TOTAL_FLOOR_AREA_STARTING", "SAP_STARTING", "TOTAL_FLOOR_AREA_ENDING"] + retain_features: null diff --git a/modules/ml-pipeline/src/pipeline/src/configs/prepare_data.yaml b/modules/ml-pipeline/src/pipeline/src/configs/prepare_data.yaml index af8a802..273e78d 100644 --- a/modules/ml-pipeline/src/pipeline/src/configs/prepare_data.yaml +++ b/modules/ml-pipeline/src/pipeline/src/configs/prepare_data.yaml @@ -1,7 +1,7 @@ input_dataclient_type: aws-s3 output_dataclient_type: local datahandler_type: parquet -data_filepath: s3://retrofit-data-dev/model_build_data/change_data/rdsap_full/train_validation_data.parquet +data_filepath: s3://retrofit-data-dev/sap_change_model/dataset.parquet train_proportion: 0.1 output_train_filepath: ./data/prepared_data/train.parquet output_test_filepath: ./data/prepared_data/test.parquet diff --git a/modules/ml-pipeline/src/pipeline/src/dvc.lock b/modules/ml-pipeline/src/pipeline/src/dvc.lock index b5d7e23..f04423a 100644 --- a/modules/ml-pipeline/src/pipeline/src/dvc.lock +++ b/modules/ml-pipeline/src/pipeline/src/dvc.lock @@ -15,8 +15,8 @@ stages: outs: - path: data/prepared_data/ hash: md5 - md5: f7e45d3997cf165904174b2bc2d2eba5.dir - size: 4396934 + md5: febdc8362200167078dfa578cf2bc889.dir + size: 24296908 nfiles: 2 build_model: cmd: python build_model.py @@ -27,8 +27,8 @@ stages: size: 3948 - path: data/prepared_data hash: md5 - md5: f7e45d3997cf165904174b2bc2d2eba5.dir - size: 4396934 + md5: febdc8362200167078dfa578cf2bc889.dir + size: 24296908 nfiles: 2 params: configs/build_model.yaml: @@ -42,26 +42,26 @@ stages: SKLearnLinearRegression: SKLearnSVMRegression: kernel: linear - model_save_filepath: ./data/model/model.joblib - model_type: SKLearnLinearRegression + model_save_filepath: ./data/model/autogluonmodel/ + model_type: AutogluonAutoML outs: - path: data/model/ hash: md5 - md5: 1d4bc40f23a6866c8daa9f2f5b639d67.dir - size: 904 - nfiles: 1 + md5: 154f823d56a9892948a633789d9b08a5.dir + size: 680552724 + nfiles: 18 generate_predictions: cmd: python generate_predictions.py deps: - path: data/model hash: md5 - md5: 1d4bc40f23a6866c8daa9f2f5b639d67.dir - size: 904 - nfiles: 1 + md5: 154f823d56a9892948a633789d9b08a5.dir + size: 680552724 + nfiles: 18 - path: data/prepared_data hash: md5 - md5: f7e45d3997cf165904174b2bc2d2eba5.dir - size: 4396934 + md5: febdc8362200167078dfa578cf2bc889.dir + size: 24296908 nfiles: 2 - path: generate_predictions.py hash: md5 @@ -77,21 +77,21 @@ stages: outs: - path: data/predictions/ hash: md5 - md5: ea0431b600f0ef357de3a543482cefe7.dir - size: 4085105 + md5: d8abefde18d78588158ef6acf282e2ed.dir + size: 2948553 nfiles: 1 generate_metrics: cmd: python generate_metrics.py deps: - path: data/predictions hash: md5 - md5: ea0431b600f0ef357de3a543482cefe7.dir - size: 4085105 + md5: d8abefde18d78588158ef6acf282e2ed.dir + size: 2948553 nfiles: 1 - path: data/prepared_data hash: md5 - md5: f7e45d3997cf165904174b2bc2d2eba5.dir - size: 4396934 + md5: febdc8362200167078dfa578cf2bc889.dir + size: 24296908 nfiles: 2 - path: generate_metrics.py hash: md5 @@ -107,8 +107,8 @@ stages: outs: - path: metrics/metrics.json hash: md5 - md5: ae53c4781cb8a754d24e29ba7ddb16ea - size: 183 + md5: f5aaae75ea74241500cd1ce76751c579 + size: 182 startup_cleanup: cmd: python startup_cleanup.py deps: diff --git a/modules/ml-pipeline/src/pipeline/src/dvc.yaml b/modules/ml-pipeline/src/pipeline/src/dvc.yaml index 42e8947..afaaa71 100644 --- a/modules/ml-pipeline/src/pipeline/src/dvc.yaml +++ b/modules/ml-pipeline/src/pipeline/src/dvc.yaml @@ -19,6 +19,7 @@ stages: - train_proportion outs: - data/prepared_data/ + always_changed: true build_model: cmd: python build_model.py deps: @@ -28,6 +29,7 @@ stages: - configs/build_model.yaml: outs: - data/model/ + always_changed: true generate_predictions: cmd: python generate_predictions.py deps: @@ -38,6 +40,7 @@ stages: - configs/generate_predictions.yaml: outs: - data/predictions/ + always_changed: true generate_metrics: cmd: python generate_metrics.py deps: @@ -48,5 +51,6 @@ stages: - configs/generate_metrics.yaml: outs: - metrics/metrics.json + always_changed: true metrics: - metrics/metrics.json From 07813c68b785e77451de12b2ac3fffad976df43f Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 18:58:06 +0100 Subject: [PATCH 08/20] test gto show --- .github/workflows/MLPipelinePostMerge.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index 19c6ce1..733e6a8 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -1,22 +1,22 @@ name: Register the model for the given pipeline branch -# on: -# push: -# branches: -# - "model-**" - on: - pull_request: - types: - - closed + push: branches: - - "master" + - "model-**" + +# on: +# pull_request: +# types: +# - closed +# branches: +# - "master" permissions: write-all jobs: Register-Major-Model-Dev: - if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }} + # if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -35,6 +35,8 @@ jobs: git config user.name "Github-Bot" git config user.email "Github-Bot@no-reply.com" + gto show + # gto register test --repo https://github.com/Hestia-Homes/ML/ # echo "chicken" >> test.md From 424c5463f27fe1c449b1d1931841e330b22d5459 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 19:04:55 +0100 Subject: [PATCH 09/20] test major --- .github/workflows/MLPipelinePostMerge.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index 733e6a8..a4819f2 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -30,19 +30,23 @@ jobs: - name: Register Model run: | - REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + # REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') git config user.name "Github-Bot" git config user.email "Github-Bot@no-reply.com" - gto show + gto show ${REGISTER_MODEL_NAME}@latest --ref + + # git tag -a ${REGISTER_MODEL_NAME} -m "Registering new Major Version" + # git push origin ${REGISTER_MODEL_NAME} # gto register test --repo https://github.com/Hestia-Homes/ML/ # echo "chicken" >> test.md # gto register ${REGISTER_MODEL_NAME} --bump-major # gto assign regression --stage dev - # gto show >> Model_Register.md + # gto show >> MODEL_REGISTRY.md Register-Minor-Model-Dev: if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'minor')) }} From 49194ac6fafb040b7eaf048f03878b4a7b822809 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 19:16:55 +0100 Subject: [PATCH 10/20] try update --- .github/workflows/MLPipelinePostMerge.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index a4819f2..f8b3260 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -36,7 +36,16 @@ jobs: git config user.name "Github-Bot" git config user.email "Github-Bot@no-reply.com" - gto show ${REGISTER_MODEL_NAME}@latest --ref + latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') + increment_version=$(echo ${latest_version} | awk -F'.' '{OFS="."; $1+=1; print}') + + new_tag=${REGISTER_MODEL_NAME}@v${increment_version} + + git tag -a new_tag -m "Registering new Major Version" + git push origin new_tag + + gto show >> MODEL_REGISTRY.md + # git tag -a ${REGISTER_MODEL_NAME} -m "Registering new Major Version" # git push origin ${REGISTER_MODEL_NAME} From aaac719571ea90e859731c42ee0176f693aa7615 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 19:18:44 +0100 Subject: [PATCH 11/20] try again --- .github/workflows/MLPipelinePostMerge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index f8b3260..524ccf0 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -41,8 +41,8 @@ jobs: new_tag=${REGISTER_MODEL_NAME}@v${increment_version} - git tag -a new_tag -m "Registering new Major Version" - git push origin new_tag + git tag -a ${new_tag} -m "Registering new Major Version" + git push origin ${new_tag} gto show >> MODEL_REGISTRY.md From 8bc5ab0a8c22b2a9840d3f16ee2ee7a14eb40b4d Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 19:25:32 +0100 Subject: [PATCH 12/20] test minor --- .github/workflows/MLPipelinePostMerge.yml | 89 +++++++++++------------ 1 file changed, 43 insertions(+), 46 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index 524ccf0..a7acfdd 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -16,7 +16,38 @@ permissions: write-all jobs: Register-Major-Model-Dev: - # if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }} + if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install packages to register model + run: | + pip install --upgrade pip + pip install -r modules/ml-pipeline/src/pipeline/src/requirements/version_control/requirements.txt + + - name: Register Model + run: | + REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + # REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') + + git config user.name "Github-Bot" + git config user.email "Github-Bot@no-reply.com" + + latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') + increment_version=$(echo ${latest_version} | awk -F'.' '{OFS="."; $1+=1; print}') + + new_tag=${REGISTER_MODEL_NAME}@v${increment_version} + + git tag -a ${new_tag} -m "Registering new Major Version" + git push origin ${new_tag} + + gto show >> MODEL_REGISTRY.md + + Register-Minor-Model-Dev: + # if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'minor')) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -37,53 +68,15 @@ jobs: git config user.email "Github-Bot@no-reply.com" latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') - increment_version=$(echo ${latest_version} | awk -F'.' '{OFS="."; $1+=1; print}') + increment_version=$(echo ${latest_version} | awk 'BEGIN{FS=OFS="."} {$2++; print}') new_tag=${REGISTER_MODEL_NAME}@v${increment_version} - git tag -a ${new_tag} -m "Registering new Major Version" + git tag -a ${new_tag} -m "Registering new Minor Version" git push origin ${new_tag} gto show >> MODEL_REGISTRY.md - - # git tag -a ${REGISTER_MODEL_NAME} -m "Registering new Major Version" - # git push origin ${REGISTER_MODEL_NAME} - - # gto register test --repo https://github.com/Hestia-Homes/ML/ - # echo "chicken" >> test.md - - # gto register ${REGISTER_MODEL_NAME} --bump-major - # gto assign regression --stage dev - # gto show >> MODEL_REGISTRY.md - - Register-Minor-Model-Dev: - if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'minor')) }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install packages to register model - run: | - pip install --upgrade pip - pip install -r modules/ml-pipeline/src/pipeline/src/requirements/version_control/requirements.txt - - - name: Register Model - run: | - REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') - - git config user.name "Github-Bot" - git config user.email "Github-Bot@no-reply.com" - - # gto register test --repo https://github.com/Hestia-Homes/ML/ - # echo "chicken" >> test.md - - # gto register ${REGISTER_MODEL_NAME} --bump-minor - # gto assign regression --stage dev - # gto show >> Model_Register.md - Register-Patch-Model-Dev: if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'patch')) }} runs-on: ubuntu-latest @@ -100,16 +93,20 @@ jobs: - name: Register Model run: | REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + # REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') git config user.name "Github-Bot" git config user.email "Github-Bot@no-reply.com" - # gto register test --repo https://github.com/Hestia-Homes/ML/ - # echo "chicken" >> test.md + latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') + increment_version=$(echo ${latest_version} | awk 'BEGIN{FS=OFS="."} {$3++; print}') - # gto register ${REGISTER_MODEL_NAME} --bump-major - # gto assign regression --stage dev - # gto show >> Model_Register.md + new_tag=${REGISTER_MODEL_NAME}@v${increment_version} + + git tag -a ${new_tag} -m "Registering new Minor Version" + git push origin ${new_tag} + + gto show >> MODEL_REGISTRY.md Promote-Artefacts-To-Dev: if: github.event.pull_request.merged == true From bb2bd8651d663ae4f32772a18ecd0f7062c69ef4 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 19:28:09 +0100 Subject: [PATCH 13/20] try patch --- .github/workflows/MLPipelinePostMerge.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index a7acfdd..77e7201 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -45,9 +45,11 @@ jobs: git push origin ${new_tag} gto show >> MODEL_REGISTRY.md + git commit -am "Update Registry" + git push Register-Minor-Model-Dev: - # if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'minor')) }} + if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'minor')) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -61,8 +63,8 @@ jobs: - name: Register Model run: | - # REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') - REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') + REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + # REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') git config user.name "Github-Bot" git config user.email "Github-Bot@no-reply.com" @@ -76,9 +78,11 @@ jobs: git push origin ${new_tag} gto show >> MODEL_REGISTRY.md + git commit -am "Update Registry" + git push Register-Patch-Model-Dev: - if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'patch')) }} + # if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'patch')) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -107,6 +111,8 @@ jobs: git push origin ${new_tag} gto show >> MODEL_REGISTRY.md + git commit -am "Update Registry" + git push Promote-Artefacts-To-Dev: if: github.event.pull_request.merged == true From 45a4211242c9361eac145440b4afef83e9ae2ee4 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 19:30:20 +0100 Subject: [PATCH 14/20] test pathc --- .github/workflows/MLPipelinePostMerge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index 77e7201..34138eb 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -96,8 +96,8 @@ jobs: - name: Register Model run: | - REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') - # REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') + # REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') git config user.name "Github-Bot" git config user.email "Github-Bot@no-reply.com" From 398b9d51150e96e3e4cb2eecfb4b3aecc7afedfa Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 19:31:43 +0100 Subject: [PATCH 15/20] test pathc --- .github/workflows/MLPipelinePostMerge.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index 34138eb..2501be3 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -45,7 +45,8 @@ jobs: git push origin ${new_tag} gto show >> MODEL_REGISTRY.md - git commit -am "Update Registry" + git add . + git commit -m "Update Registry" git push Register-Minor-Model-Dev: @@ -78,7 +79,8 @@ jobs: git push origin ${new_tag} gto show >> MODEL_REGISTRY.md - git commit -am "Update Registry" + git add . + git commit -m "Update Registry" git push Register-Patch-Model-Dev: @@ -111,7 +113,8 @@ jobs: git push origin ${new_tag} gto show >> MODEL_REGISTRY.md - git commit -am "Update Registry" + git add . + git commit -m "Update Registry" git push Promote-Artefacts-To-Dev: From 2e140c3020f31402f84af42f52dfb3dac66e161c Mon Sep 17 00:00:00 2001 From: Github-Bot Date: Fri, 15 Sep 2023 18:32:22 +0000 Subject: [PATCH 16/20] Update Registry --- MODEL_REGISTRY.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 MODEL_REGISTRY.md diff --git a/MODEL_REGISTRY.md b/MODEL_REGISTRY.md new file mode 100644 index 0000000..fa2ad5a --- /dev/null +++ b/MODEL_REGISTRY.md @@ -0,0 +1,5 @@ +╒════════╤══════════╕ +│ name │ latest │ +╞════════╪══════════╡ +│ model │ v2.1.3 │ +╘════════╧══════════╛ From ed47abcfc748c78b2a714c382aa629c2ebe506b0 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 19:40:24 +0100 Subject: [PATCH 17/20] try new model --- .github/workflows/MLPipelinePostMerge.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index 2501be3..cd239cd 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -16,7 +16,7 @@ permissions: write-all jobs: Register-Major-Model-Dev: - if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }} + # if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -30,14 +30,19 @@ jobs: - name: Register Model run: | - REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + # REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') # REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') + REGISTER_MODEL_NAME=bob git config user.name "Github-Bot" git config user.email "Github-Bot@no-reply.com" - latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') - increment_version=$(echo ${latest_version} | awk -F'.' '{OFS="."; $1+=1; print}') + latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') || false + if [ -z "${latest_version}" ]; then + increment_version="1.0.0" + else + increment_version=$(echo ${latest_version} | awk -F'.' '{OFS="."; $1+=1; print}') + fi new_tag=${REGISTER_MODEL_NAME}@v${increment_version} @@ -84,7 +89,7 @@ jobs: git push Register-Patch-Model-Dev: - # if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'patch')) }} + if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'patch')) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -98,8 +103,8 @@ jobs: - name: Register Model run: | - # REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') - REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') + REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + # REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') git config user.name "Github-Bot" git config user.email "Github-Bot@no-reply.com" @@ -109,7 +114,7 @@ jobs: new_tag=${REGISTER_MODEL_NAME}@v${increment_version} - git tag -a ${new_tag} -m "Registering new Minor Version" + git tag -a ${new_tag} -m "Registering new Patch Version" git push origin ${new_tag} gto show >> MODEL_REGISTRY.md From 9cda62a1a56d301852fa568bb81aff80f396ae2c Mon Sep 17 00:00:00 2001 From: Github-Bot Date: Fri, 15 Sep 2023 18:42:07 +0000 Subject: [PATCH 18/20] Update Registry --- MODEL_REGISTRY.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MODEL_REGISTRY.md b/MODEL_REGISTRY.md index fa2ad5a..117ac39 100644 --- a/MODEL_REGISTRY.md +++ b/MODEL_REGISTRY.md @@ -3,3 +3,9 @@ ╞════════╪══════════╡ │ model │ v2.1.3 │ ╘════════╧══════════╛ +╒════════╤══════════╕ +│ name │ latest │ +╞════════╪══════════╡ +│ bob │ v1.0.0 │ +│ model │ v2.1.3 │ +╘════════╧══════════╛ From 573e1edbe5106779a139832cb9d24dadbc4774e4 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Fri, 15 Sep 2023 19:45:41 +0100 Subject: [PATCH 19/20] try new model --- .github/workflows/MLPipelinePostMerge.yml | 35 ++++++++++++++--------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index cd239cd..1767cd6 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -1,22 +1,22 @@ name: Register the model for the given pipeline branch -on: - push: - branches: - - "model-**" - # on: -# pull_request: -# types: -# - closed +# push: # branches: -# - "master" +# - "model-**" + +on: + pull_request: + types: + - closed + branches: + - "master" permissions: write-all jobs: Register-Major-Model-Dev: - # if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }} + if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -30,9 +30,8 @@ jobs: - name: Register Model run: | - # REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') # REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') - REGISTER_MODEL_NAME=bob git config user.name "Github-Bot" git config user.email "Github-Bot@no-reply.com" @@ -76,7 +75,11 @@ jobs: git config user.email "Github-Bot@no-reply.com" latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') - increment_version=$(echo ${latest_version} | awk 'BEGIN{FS=OFS="."} {$2++; print}') + if [ -z "${latest_version}" ]; then + increment_version="0.1.0" + else + increment_version=$(echo ${latest_version} | awk 'BEGIN{FS=OFS="."} {$2++; print}') + fi new_tag=${REGISTER_MODEL_NAME}@v${increment_version} @@ -110,7 +113,11 @@ jobs: git config user.email "Github-Bot@no-reply.com" latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') - increment_version=$(echo ${latest_version} | awk 'BEGIN{FS=OFS="."} {$3++; print}') + if [ -z "${latest_version}" ]; then + increment_version="0.0.1" + else + increment_version=$(echo ${latest_version} | awk 'BEGIN{FS=OFS="."} {$3++; print}') + fi new_tag=${REGISTER_MODEL_NAME}@v${increment_version} From 17f96971086bd62f05cd4d18a544ebdc9883bd14 Mon Sep 17 00:00:00 2001 From: quandanrepo <45804868+quandanrepo@users.noreply.github.com> Date: Sat, 16 Sep 2023 12:00:00 +0100 Subject: [PATCH 20/20] Update MLPipelinePostMerge.yml --- .github/workflows/MLPipelinePostMerge.yml | 65 +++++++++++------------ 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/.github/workflows/MLPipelinePostMerge.yml b/.github/workflows/MLPipelinePostMerge.yml index 1767cd6..b8ab439 100644 --- a/.github/workflows/MLPipelinePostMerge.yml +++ b/.github/workflows/MLPipelinePostMerge.yml @@ -48,7 +48,7 @@ jobs: git tag -a ${new_tag} -m "Registering new Major Version" git push origin ${new_tag} - gto show >> MODEL_REGISTRY.md + gto show > MODEL_REGISTRY.md git add . git commit -m "Update Registry" git push @@ -86,7 +86,7 @@ jobs: git tag -a ${new_tag} -m "Registering new Minor Version" git push origin ${new_tag} - gto show >> MODEL_REGISTRY.md + gto show > MODEL_REGISTRY.md git add . git commit -m "Update Registry" git push @@ -124,7 +124,7 @@ jobs: git tag -a ${new_tag} -m "Registering new Patch Version" git push origin ${new_tag} - gto show >> MODEL_REGISTRY.md + gto show > MODEL_REGISTRY.md git add . git commit -m "Update Registry" git push @@ -156,44 +156,43 @@ jobs: cd modules/ml-pipeline/src/pipeline/src dvc push -r dev + Register-New-Model-Dev: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 - # Register-New-Model-Dev: - # if: github.event.pull_request.merged == true - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # with: - # fetch-depth: 0 + - name: Install packages to register model + run: | + pip install --upgrade pip + pip install -r modules/ml-pipeline/src/pipeline/src/requirements/version_control/requirements.txt - # - name: Install packages to register model - # env: - # AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }} - # AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }} - # run: | - # pip install --upgrade pip - # pip install -r modules/ml-pipeline/src/pipeline/src/requirements/version_control/requirements.txt + - name: Register Model + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }} + run: | - # - name: Register Model - # env: - # AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }} - # AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }} - # run: | + REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') + # REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') - # # REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}') - # REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}') + git config user.name "Github-Bot" + git config user.email "Github-Bot@no-reply.com" - # git config user.name "Github-Bot" - # git config user.email "Github-Bot@no-reply.com" + latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref) + + new_tag=${latest_version}#dev - # # git tag model@v0.0.1 - # # git push origin model@v0.0.1 + git tag -a ${new_tag} -m "Registering Latest Version to Dev" + git push origin ${new_tag} - # # gto register test --repo https://github.com/Hestia-Homes/ML/ - # # echo "chicken" >> test.md + gto show > MODEL_REGISTRY.md + git add . + git commit -m "Update Registry" + git push - # # gto -v register ${REGISTER_MODEL_NAME} - # # gto assign regression --stage dev - # # gto show Register-Prediction-Image-Dev: needs: Promote-Artefacts-To-Dev