From 7f05e73277c38bf96fb332707bf94aa485cd641e Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Tue, 7 Jan 2025 09:05:05 +0200 Subject: [PATCH 01/11] Upgrade due to sec vul --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 983ac80..e0b501e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ celery-types>=0.20.0 connexion>=2.11.2,<3 foca>=0.12.1 geopy>=2.2.0 -gunicorn>=20.1.0,<21 +gunicorn>=22 ip2geotools>=0.1.6 py-tes>=0.4.2 pytest-ordering>=0.6 From 7eee2864b420d57fade82e42a5fd48aaee232eae Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Wed, 8 Jan 2025 09:07:13 +0200 Subject: [PATCH 02/11] Now we need to install docker-compose (before it was provided) --- .github/workflows/checks.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 4365257..9a3f38e 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -44,6 +44,8 @@ jobs: run: | pip install . pip install -r requirements_dev.txt + curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + chmod +x /usr/local/bin/docker-compose - name: Deploy app run: docker-compose up -d --build - name: Wait for app startup From b2b20e551820606c29fa9b8a9d208dc4961cdea2 Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Wed, 8 Jan 2025 09:23:45 +0200 Subject: [PATCH 03/11] Disable 2 pylint warnings --- pro_tes/gunicorn.py | 2 +- pro_tes/tasks/track_task_progress.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pro_tes/gunicorn.py b/pro_tes/gunicorn.py index 2e8b33b..0e4ff74 100644 --- a/pro_tes/gunicorn.py +++ b/pro_tes/gunicorn.py @@ -17,7 +17,7 @@ forwarded_allow_ips = "*" # pylint: disable=invalid-name # Set Gunicorn bind address -bind = f"{app_config.server.host}:{app_config.server.port}" +bind = f"{app_config.server.host}:{app_config.server.port}" # pylint: disable=C0103 # Source environment variables for Gunicorn workers raw_env = [ diff --git a/pro_tes/tasks/track_task_progress.py b/pro_tes/tasks/track_task_progress.py index 09b6fa0..156d2b9 100644 --- a/pro_tes/tasks/track_task_progress.py +++ b/pro_tes/tasks/track_task_progress.py @@ -26,7 +26,7 @@ ignore_result=True, track_started=True, ) -def task__track_task_progress( # pylint: disable=too-many-arguments +def task__track_task_progress( # pylint: disable=too-many-arguments,R0917 self, # pylint: disable=unused-argument worker_id: str, remote_host: str, From ce08f7587d64d22ea8ebfb83a2430c4295ebc62a Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Wed, 8 Jan 2025 10:07:45 +0200 Subject: [PATCH 04/11] Set the max line width to a 21st century number --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index e6f9317..754b5e3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,5 @@ [flake8] per-file-ignores = pro_tes/ga4gh/tes/models.py:D101 + +max-line-length = 120 From af0ea90dd4c2edb123f6a378a0dfe5493a0bd7f0 Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Wed, 8 Jan 2025 12:44:58 +0200 Subject: [PATCH 05/11] Add wait for port --- .github/workflows/checks.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 9a3f38e..03dcbd6 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -49,7 +49,12 @@ jobs: - name: Deploy app run: docker-compose up -d --build - name: Wait for app startup - run: sleep 20 + run: | + for i in $(seq 1 24); do + sleep 5; curl localhost:8080 -so /dev/null && return; + docker-compose ps; + echo "Retrying ($i) in 5 seconds..."; + done - name: Run integration tests shell: bash run: pytest tests/test_integration From 7e3762dcd9196294e3c5ba8fb77f8046b0190fe9 Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Thu, 9 Jan 2025 09:08:56 +0200 Subject: [PATCH 06/11] Remove the hyphen and replace it by a space --- .github/workflows/checks.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 03dcbd6..0e3a1da 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -44,22 +44,20 @@ jobs: run: | pip install . pip install -r requirements_dev.txt - curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - chmod +x /usr/local/bin/docker-compose - name: Deploy app - run: docker-compose up -d --build + run: docker compose up -d --build - name: Wait for app startup run: | for i in $(seq 1 24); do sleep 5; curl localhost:8080 -so /dev/null && return; - docker-compose ps; + docker compose ps; echo "Retrying ($i) in 5 seconds..."; done - name: Run integration tests shell: bash run: pytest tests/test_integration - name: Tear down app - run: docker-compose down + run: docker compose down publish: name: Build and publish app image runs-on: ubuntu-latest From 2652a4082bbf15038eef14a7b1117dfcdcbb9c58 Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Fri, 10 Jan 2025 10:56:35 +0200 Subject: [PATCH 07/11] Fix the pymongo version so it does not fail --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index e0b501e..ead6931 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ types-PyYAML>=6.0.12 types-requests>=2.28.5 types-simplejson>=3.17.7 types-urllib3>=1.26.17 +pymongo==4.8.0 From da2f58b5bf7e947a4f7a04cf3dcab81a44af656d Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Fri, 10 Jan 2025 11:13:57 +0200 Subject: [PATCH 08/11] Fix the pymongo version so it does not fail --- .github/workflows/checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 0e3a1da..9f9fc29 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -49,7 +49,7 @@ jobs: - name: Wait for app startup run: | for i in $(seq 1 24); do - sleep 5; curl localhost:8080 -so /dev/null && return; + sleep 5; curl localhost:8080 -so /dev/null && break; docker compose ps; echo "Retrying ($i) in 5 seconds..."; done From 72fc588bd0189d609e9b608c4b3608b5a6c04cfd Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Fri, 10 Jan 2025 11:28:57 +0200 Subject: [PATCH 09/11] Fix the mypy version --- requirements_dev.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 6674972..347e998 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -7,5 +7,5 @@ mypy>=0.990 pylint>=2.15.5 pytest>=7.2.0 python-semantic-release>=7.32.2 -mypy>=1.8.0 -types-python-dateutil>=2.8.19.20240106 \ No newline at end of file +mypy==1.14.1 +types-python-dateutil>=2.8.19.20240106 From 0abbaed4261431133ab2f737c2aea0ad120196d2 Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Fri, 10 Jan 2025 11:39:25 +0200 Subject: [PATCH 10/11] Fix mypy (model.py) warnings --- pro_tes/ga4gh/tes/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pro_tes/ga4gh/tes/models.py b/pro_tes/ga4gh/tes/models.py index a9bdb2c..6aa1e92 100644 --- a/pro_tes/ga4gh/tes/models.py +++ b/pro_tes/ga4gh/tes/models.py @@ -38,7 +38,7 @@ class TesCreateTaskResponse(CustomBaseModel): class TesExecutor(CustomBaseModel): image: str = Field( - default=[""], + default="", description=( "Name of the container image. The string will be passed as " " the image\nargument to the containerization run command. " @@ -626,7 +626,7 @@ class TesTask(CustomBaseModel): ) resources: Optional[TesResources] = None executors: list[TesExecutor] = Field( - default=[TesExecutor], + default=[TesExecutor()], description=( "An array of executors to be run. Each of the executors " " will run one\nat a time sequentially. Each executor is a" From 936729ebae5dc81e24d996ad119d8e5c593b8e7d Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Mon, 10 Feb 2025 13:30:09 +0200 Subject: [PATCH 11/11] Disable E501 error --- pro_tes/gunicorn.py | 2 +- setup.cfg | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pro_tes/gunicorn.py b/pro_tes/gunicorn.py index 0e4ff74..0c6ed85 100644 --- a/pro_tes/gunicorn.py +++ b/pro_tes/gunicorn.py @@ -17,7 +17,7 @@ forwarded_allow_ips = "*" # pylint: disable=invalid-name # Set Gunicorn bind address -bind = f"{app_config.server.host}:{app_config.server.port}" # pylint: disable=C0103 +bind = f"{app_config.server.host}:{app_config.server.port}" # pylint: disable=C0103 # noqa: E501 # Source environment variables for Gunicorn workers raw_env = [ diff --git a/setup.cfg b/setup.cfg index 754b5e3..e6f9317 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,3 @@ [flake8] per-file-ignores = pro_tes/ga4gh/tes/models.py:D101 - -max-line-length = 120