Skip to content

Commit 050b3e6

Browse files
pcrespovsanderegg
andauthored
♻️⬆️ Migrating director service to fastapi ⚠️ 🚨 (#6657)
Co-authored-by: sanderegg <[email protected]>
1 parent 5c0da83 commit 050b3e6

File tree

168 files changed

+4107
-7584
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+4107
-7584
lines changed

.env-devel

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,17 @@ DASK_TLS_CA_FILE=/home/scu/.dask/dask-crt.pem
7070
DASK_TLS_CERT=/home/scu/.dask/dask-crt.pem
7171
DASK_TLS_KEY=/home/scu/.dask/dask-key.pem
7272

73+
DIRECTOR_DEFAULT_MAX_MEMORY=2147483648
74+
DIRECTOR_DEFAULT_MAX_NANO_CPUS=1000000000
7375
DIRECTOR_GENERIC_RESOURCE_PLACEMENT_CONSTRAINTS_SUBSTITUTIONS='{}'
7476
DIRECTOR_HOST=director
75-
DIRECTOR_PORT=8080
76-
DIRECTOR_REGISTRY_CACHING_TTL=900
77+
DIRECTOR_LOGLEVEL=INFO
78+
DIRECTOR_MONITORING_ENABLED=True
79+
DIRECTOR_PORT=8000
80+
DIRECTOR_PUBLISHED_HOST_NAME="127.0.0.1:9081"
81+
DIRECTOR_REGISTRY_CACHING_TTL=00:15:00
7782
DIRECTOR_REGISTRY_CACHING=True
83+
DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS=null
7884
DIRECTOR_TRACING={}
7985

8086
EFS_USER_ID=8006
@@ -186,6 +192,7 @@ REDIS_SECURE=false
186192
REDIS_USER=null
187193

188194
REGISTRY_AUTH=True
195+
REGISTRY_PATH=""
189196
REGISTRY_PW=adminadminadmin
190197
REGISTRY_SSL=True
191198
REGISTRY_URL=registry.osparc-master.speag.com

.github/workflows/ci-testing-deploy.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ on:
3737
- all
3838

3939
env:
40-
DEFAULT_MAX_NANO_CPUS: 10000000
41-
DEFAULT_MAX_MEMORY: 268435456
40+
# NOTE: 'COLUMNS' is a shell env var that represents the width (number of columns)
41+
# of the terminal or command-line interface in characters.
4242
COLUMNS: 120
4343

4444
concurrency:
@@ -189,6 +189,8 @@ jobs:
189189
- 'packages/**'
190190
- 'services/director/**'
191191
- 'services/docker-compose*'
192+
- 'scripts/mypy/*'
193+
- 'mypy.ini'
192194
director-v2:
193195
- 'packages/**'
194196
- 'services/director-v2/**'
@@ -912,11 +914,8 @@ jobs:
912914
runs-on: ${{ matrix.os }}
913915
strategy:
914916
matrix:
915-
# KEEP 3.6 Development of this service is frozen
916-
# KEEP ubuntu 20.04, else no python 3.6
917-
python: [3.6]
918-
os: [ubuntu-20.04]
919-
docker_buildx: [v0.10.4]
917+
python: ["3.11"]
918+
os: [ubuntu-22.04]
920919
fail-fast: false
921920
steps:
922921
- uses: actions/checkout@v4
@@ -929,12 +928,27 @@ jobs:
929928
uses: actions/setup-python@v5
930929
with:
931930
python-version: ${{ matrix.python }}
931+
- name: install uv
932+
uses: astral-sh/setup-uv@v3
933+
with:
934+
version: "0.4.x"
935+
enable-cache: false
936+
cache-dependency-glob: "**/director/requirements/ci.txt"
932937
- name: show system version
933938
run: ./ci/helpers/show_system_versions.bash
934939
- name: install
935940
run: ./ci/github/unit-testing/director.bash install
941+
- name: typecheck
942+
run: ./ci/github/unit-testing/director.bash typecheck
936943
- name: test
944+
if: ${{ !cancelled() }}
937945
run: ./ci/github/unit-testing/director.bash test
946+
- name: upload failed tests logs
947+
if: ${{ !cancelled() }}
948+
uses: actions/upload-artifact@v4
949+
with:
950+
name: ${{ github.job }}_docker_logs
951+
path: ./services/director/test_failures
938952
- uses: codecov/[email protected]
939953
env:
940954
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -2132,6 +2146,11 @@ jobs:
21322146
python: ["3.11"]
21332147
os: [ubuntu-22.04]
21342148
fail-fast: false
2149+
env:
2150+
# NOTE: DIRECTOR_DEFAULT_MAX_* used for integration-tests that include `director` service
2151+
DIRECTOR_DEFAULT_MAX_MEMORY: 268435456
2152+
DIRECTOR_DEFAULT_MAX_NANO_CPUS: 10000000
2153+
DIRECTOR_TRACING: null
21352154
steps:
21362155
- uses: actions/checkout@v4
21372156
- name: setup docker buildx

ci/github/unit-testing/director.bash

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,29 @@ set -o pipefail # don't hide errors within pipes
66
IFS=$'\n\t'
77

88
install() {
9-
# Replaces 'bash ci/helpers/ensure_python_pip.bash'
10-
11-
echo "INFO:" "$(python --version)" "@" "$(command -v python)"
12-
13-
# installs pip if not in place
14-
python -m ensurepip
15-
16-
echo "INFO:" "$(pip --version)" "@" "$(command -v pip)"
17-
# NOTE: pip<22.0 for python 3.6
18-
pip3 install --upgrade \
19-
pip~=21.0 \
20-
wheel \
21-
setuptools
22-
python3 -m venv .venv
9+
make devenv
2310
# shellcheck source=/dev/null
2411
source .venv/bin/activate
2512
pushd services/director
26-
pip3 install -r requirements/ci.txt
13+
make install-ci
2714
popd
15+
uv pip list
2816
}
2917

3018
test() {
3119
# shellcheck source=/dev/null
3220
source .venv/bin/activate
3321
pushd services/director
34-
pytest \
35-
--color=yes \
36-
--cov-append \
37-
--cov-config=.coveragerc \
38-
--cov-report=term-missing \
39-
--cov-report=xml \
40-
--cov=simcore_service_director \
41-
--durations=10 \
42-
--keep-docker-up \
43-
--log-date-format="%Y-%m-%d %H:%M:%S" \
44-
--log-format="%(asctime)s %(levelname)s %(message)s" \
45-
--verbose \
46-
tests/
22+
make test-ci-unit
23+
popd
24+
}
25+
26+
typecheck() {
27+
# shellcheck source=/dev/null
28+
source .venv/bin/activate
29+
uv pip install mypy
30+
pushd services/director
31+
make mypy
4732
popd
4833
}
4934

packages/aws-library/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def read_reqs(reqs_path: Path) -> set[str]:
3333
"version": Path(CURRENT_DIR / "VERSION").read_text().strip(),
3434
"author": "Sylvain Anderegg (sanderegg)",
3535
"description": "Core service library for AWS APIs",
36-
"python_requires": "~=3.10",
36+
"python_requires": "~=3.11",
3737
"classifiers": [
3838
"Development Status :: 2 - Pre-Alpha",
3939
"Intended Audience :: Developers",

packages/dask-task-models-library/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def read_reqs(reqs_path: Path) -> set[str]:
3636
"version": Path(CURRENT_DIR / "VERSION").read_text().strip(),
3737
"author": "Sylvain Anderegg (sanderegg)",
3838
"description": "Core service library for simcore pydantic dask task models",
39-
"python_requires": "~=3.10",
39+
"python_requires": "~=3.11",
4040
"classifiers": [
4141
"Development Status :: 2 - Pre-Alpha",
4242
"Intended Audience :: Developers",

packages/models-library/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def read_reqs(reqs_path: Path) -> set[str]:
3434
"version": Path(CURRENT_DIR / "VERSION").read_text().strip(),
3535
"author": "Sylvain Anderegg (sanderegg)",
3636
"description": "Core service library for simcore pydantic models",
37-
"python_requires": "~=3.10",
37+
"python_requires": "~=3.11",
3838
"classifiers": [
3939
"Development Status :: 2 - Pre-Alpha",
4040
"Intended Audience :: Developers",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from ..services_metadata_published import ServiceMetaDataPublished
2+
3+
4+
class ServiceDataGet(ServiceMetaDataPublished):
5+
...

packages/notifications-library/requirements/_test.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#
99
--constraint _base.txt
1010

11+
aiodocker
1112
coverage
1213
docker
1314
faker

packages/notifications-library/requirements/_test.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
aiodocker==0.23.0
2+
# via -r requirements/_test.in
3+
aiohappyeyeballs==2.4.3
4+
# via aiohttp
5+
aiohttp==3.10.10
6+
# via
7+
# -c requirements/../../../requirements/constraints.txt
8+
# aiodocker
9+
aiosignal==1.3.1
10+
# via aiohttp
11+
attrs==24.2.0
12+
# via
13+
# -c requirements/_base.txt
14+
# aiohttp
115
certifi==2024.8.30
216
# via
317
# -c requirements/../../../requirements/constraints.txt
@@ -12,6 +26,10 @@ docker==7.1.0
1226
# via -r requirements/_test.in
1327
faker==29.0.0
1428
# via -r requirements/_test.in
29+
frozenlist==1.5.0
30+
# via
31+
# aiohttp
32+
# aiosignal
1533
greenlet==3.1.1
1634
# via
1735
# -c requirements/_base.txt
@@ -22,8 +40,14 @@ idna==3.10
2240
# via
2341
# -c requirements/_base.txt
2442
# requests
43+
# yarl
2544
iniconfig==2.0.0
2645
# via pytest
46+
multidict==6.1.0
47+
# via
48+
# -c requirements/_base.txt
49+
# aiohttp
50+
# yarl
2751
mypy==1.12.0
2852
# via sqlalchemy
2953
mypy-extensions==1.0.0
@@ -101,3 +125,7 @@ urllib3==2.2.3
101125
# -c requirements/../../../requirements/constraints.txt
102126
# docker
103127
# requests
128+
yarl==1.12.1
129+
# via
130+
# -c requirements/_base.txt
131+
# aiohttp

0 commit comments

Comments
 (0)