From 1fb86786b79caf77e1d38920037336d1a93cbf93 Mon Sep 17 00:00:00 2001 From: TahaMerzouki Date: Sun, 14 Apr 2024 21:41:47 +0100 Subject: [PATCH 1/5] bump api version --- .../model-package/regression_model/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/section-07-ci-and-publishing/model-package/regression_model/VERSION b/section-07-ci-and-publishing/model-package/regression_model/VERSION index c4e41f945..4d54daddb 100644 --- a/section-07-ci-and-publishing/model-package/regression_model/VERSION +++ b/section-07-ci-and-publishing/model-package/regression_model/VERSION @@ -1 +1 @@ -4.0.3 +4.0.2 From f5573cb8704399a61e4dfde16addc6547c4b32db Mon Sep 17 00:00:00 2001 From: TahaMerzouki Date: Sun, 14 Apr 2024 22:05:00 +0100 Subject: [PATCH 2/5] update tox.ini file --- section-07-ci-and-publishing/model-package/tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/section-07-ci-and-publishing/model-package/tox.ini b/section-07-ci-and-publishing/model-package/tox.ini index d93e00636..8ae84679e 100644 --- a/section-07-ci-and-publishing/model-package/tox.ini +++ b/section-07-ci-and-publishing/model-package/tox.ini @@ -21,6 +21,7 @@ passenv = KAGGLE_USERNAME KAGGLE_KEY GEMFURY_PUSH_URL + RAILWAY_TOKEN [testenv:test_package] allowlist_externals = python From ce5957b17891c7b91092f2982e8df60e2099494b Mon Sep 17 00:00:00 2001 From: TahaMerzouki Date: Sun, 14 Apr 2024 22:48:57 +0100 Subject: [PATCH 3/5] fix: add service option to railway command --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index db25d0339..aa6d716da 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,7 +54,7 @@ jobs: - run: name: Deploy to Railway App (You must set RAILWAY_TOKEN env var) command: | - cd section-07-ci-and-publishing/house-prices-api && railway up --detach + cd section-07-ci-and-publishing/house-prices-api && railway up --detach -s splendid-writer -e production section_07_test_and_upload_regression_model: <<: *defaults @@ -92,7 +92,7 @@ jobs: - run: name: Build and run Dockerfile (see https://docs.railway.app/deploy/dockerfiles) command: | - cd section-08-deploying-with-containers && railway up --detach + cd section-08-deploying-with-containers && railway up --detach -s splendid-writer -e production test_regression_model_py37: docker: From 31a90711d8ac3f48f0a46bd02bb9d29c66591461 Mon Sep 17 00:00:00 2001 From: TahaMerzouki Date: Sun, 14 Apr 2024 23:09:37 +0100 Subject: [PATCH 4/5] ci: try [test and upload] step --- .circleci/config.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index aa6d716da..0b91c1b3f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -279,7 +279,15 @@ workflows: - demo # upload after git tags are created - section_07_test_and_upload_regression_model: - <<: *tags_only + # <<: *tags_only + requires: + - section_07_deploy_app_to_railway + filters: + branches: + only: + - main + - master + - demo - section_08_deploy_app_container_via_railway: filters: From 722d88a73f9f641ec25f812935f3a3fc5608a9a0 Mon Sep 17 00:00:00 2001 From: TahaMerzouki Date: Mon, 15 Apr 2024 21:11:55 +0100 Subject: [PATCH 5/5] make predictitions type fix --- .../model-package/regression_model/predict.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/section-07-ci-and-publishing/model-package/regression_model/predict.py b/section-07-ci-and-publishing/model-package/regression_model/predict.py index d27739780..7a9bc55c5 100644 --- a/section-07-ci-and-publishing/model-package/regression_model/predict.py +++ b/section-07-ci-and-publishing/model-package/regression_model/predict.py @@ -25,9 +25,10 @@ def make_prediction( if not errors: predictions = _price_pipe.predict( X=validated_data[config.model_config.features] - ) + ) + dtype = np.result_type(np.float32, predictions) results = { - "predictions": [np.exp(pred) for pred in predictions], # type: ignore + "predictions": [np.exp(pred).astype(dtype) for pred in predictions], # type: ignore "version": _version, "errors": errors, }