Skip to content

Commit 6bdc814

Browse files
♻️ Extract Celery code to a new simcore library (#7698)
Co-authored-by: Mads Bisgaard <[email protected]>
1 parent 4ee83ca commit 6bdc814

Some content is hidden

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

66 files changed

+1990
-447
lines changed

.codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ component_management:
3131
- component_id: pkg_aws_library
3232
paths:
3333
- packages/aws-library/**
34+
- component_id: pkg_celery_library
35+
paths:
36+
- packages/celery-library/**
3437
- component_id: pkg_dask_task_models_library
3538
paths:
3639
- packages/dask-task-models-library/**

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Makefile @pcrespov @sanderegg
1313
/api/ @sanderegg @pcrespov @matusdrobuliak66
1414
/ci/ @sanderegg @pcrespov
1515
/docs/ @pcrespov
16+
/packages/celery-library/ @giancarloromeo
1617
/packages/common-library/ @giancarloromeo
1718
/packages/models-library/ @sanderegg @pcrespov @matusdrobuliak66 @giancarloromeo
1819
/packages/postgres-database/ @matusdrobuliak66

.github/codeql/codeql-config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ disable-default-queries: false
44

55
paths:
66
- packages/aws-library/src
7+
- packages/celery-library/src
78
- packages/dask-task-models-library/src
89
- packages/models-library/src/models_library
910
- packages/postgres-database/src/simcore_postgres_database

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
# Set job outputs to values from filter step
4848
outputs:
4949
aws-library: ${{ steps.filter.outputs.aws-library }}
50+
celery-library: ${{ steps.filter.outputs.celery-library }}
5051
dask-task-models-library: ${{ steps.filter.outputs.dask-task-models-library }}
5152
models-library: ${{ steps.filter.outputs.models-library }}
5253
common-library: ${{ steps.filter.outputs.common-library }}
@@ -94,6 +95,12 @@ jobs:
9495
- 'services/docker-compose*'
9596
- 'scripts/mypy/*'
9697
- 'mypy.ini'
98+
celery-library:
99+
- 'packages/celery-library/**'
100+
- 'packages/pytest-simcore/**'
101+
- 'services/docker-compose*'
102+
- 'scripts/mypy/*'
103+
- 'mypy.ini'
97104
dask-task-models-library:
98105
- 'packages/dask-task-models-library/**'
99106
- 'packages/pytest-simcore/**'
@@ -1035,6 +1042,49 @@ jobs:
10351042
with:
10361043
flags: unittests #optional
10371044

1045+
unit-test-celery-library:
1046+
needs: changes
1047+
if: ${{ needs.changes.outputs.celery-library == 'true' || github.event_name == 'push' || github.event.inputs.force_all_builds == 'true' }}
1048+
timeout-minutes: 18 # if this timeout gets too small, then split the tests
1049+
name: "[unit] celery-library"
1050+
runs-on: ${{ matrix.os }}
1051+
strategy:
1052+
matrix:
1053+
python: ["3.11"]
1054+
os: [ubuntu-24.04]
1055+
fail-fast: false
1056+
steps:
1057+
- uses: actions/checkout@v4
1058+
- name: setup docker buildx
1059+
id: buildx
1060+
uses: docker/setup-buildx-action@v3
1061+
with:
1062+
driver: docker-container
1063+
- name: setup python environment
1064+
uses: actions/setup-python@v5
1065+
with:
1066+
python-version: ${{ matrix.python }}
1067+
- name: install uv
1068+
uses: astral-sh/setup-uv@v6
1069+
with:
1070+
version: "0.6.x"
1071+
enable-cache: false
1072+
cache-dependency-glob: "**/celery-library/requirements/ci.txt"
1073+
- name: show system version
1074+
run: ./ci/helpers/show_system_versions.bash
1075+
- name: install
1076+
run: ./ci/github/unit-testing/celery-library.bash install
1077+
- name: typecheck
1078+
run: ./ci/github/unit-testing/celery-library.bash typecheck
1079+
- name: test
1080+
if: ${{ !cancelled() }}
1081+
run: ./ci/github/unit-testing/celery-library.bash test
1082+
- uses: codecov/codecov-action@v5
1083+
if: ${{ !cancelled() }}
1084+
env:
1085+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1086+
with:
1087+
flags: unittests #optional
10381088

10391089
unit-test-dask-task-models-library:
10401090
needs: changes
@@ -1824,6 +1874,7 @@ jobs:
18241874
unit-test-clusters-keeper,
18251875
unit-test-dask-sidecar,
18261876
unit-test-aws-library,
1877+
unit-test-celery-library,
18271878
unit-test-dask-task-models-library,
18281879
unit-test-datcore-adapter,
18291880
unit-test-director-v2,

.vscode/settings.template.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"python.analysis.typeCheckingMode": "basic",
3434
"python.analysis.extraPaths": [
3535
"./packages/aws-library/src",
36+
"./packages/celery-library/src",
3637
"./packages/common-library/src",
3738
"./packages/dask-task-models-library/src",
3839
"./packages/models-library/src",
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
3+
set -o errexit # abort on nonzero exitstatus
4+
set -o nounset # abort on unbound variable
5+
set -o pipefail # don't hide errors within pipes
6+
IFS=$'\n\t'
7+
8+
install() {
9+
make devenv
10+
# shellcheck source=/dev/null
11+
source .venv/bin/activate
12+
pushd packages/celery-library
13+
make install-ci
14+
popd
15+
uv pip list
16+
}
17+
18+
test() {
19+
# shellcheck source=/dev/null
20+
source .venv/bin/activate
21+
pushd packages/celery-library
22+
make tests-ci
23+
popd
24+
}
25+
26+
typecheck() {
27+
# shellcheck source=/dev/null
28+
source .venv/bin/activate
29+
uv pip install mypy
30+
pushd packages/celery-library
31+
make mypy
32+
popd
33+
}
34+
35+
# Check if the function exists (bash specific)
36+
if declare -f "$1" >/dev/null; then
37+
# call arguments verbatim
38+
"$@"
39+
else
40+
# Show a helpful error
41+
echo "'$1' is not a known function name" >&2
42+
exit 1
43+
fi

packages/celery-library/Makefile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#
2+
# Targets for DEVELOPMENT of Celery Library
3+
#
4+
include ../../scripts/common.Makefile
5+
include ../../scripts/common-package.Makefile
6+
7+
.PHONY: requirements
8+
requirements: ## compiles pip requirements (.in -> .txt)
9+
@$(MAKE_C) requirements reqs
10+
11+
12+
.PHONY: install-dev install-prod install-ci
13+
install-dev install-prod install-ci: _check_venv_active ## install app in development/production or CI mode
14+
# installing in $(subst install-,,$@) mode
15+
@uv pip sync requirements/$(subst install-,,$@).txt
16+
17+
18+
.PHONY: tests tests-ci
19+
tests: ## runs unit tests
20+
# running unit tests
21+
@pytest \
22+
--asyncio-mode=auto \
23+
--color=yes \
24+
--cov-config=../../.coveragerc \
25+
--cov-report=term-missing \
26+
--cov=celery_library \
27+
--durations=10 \
28+
--exitfirst \
29+
--failed-first \
30+
--pdb \
31+
-vv \
32+
$(CURDIR)/tests
33+
34+
tests-ci: ## runs unit tests
35+
# running unit tests
36+
@pytest \
37+
--asyncio-mode=auto \
38+
--color=yes \
39+
--cov-append \
40+
--cov-config=../../.coveragerc \
41+
--cov-report=term-missing \
42+
--cov-report=xml \
43+
--junitxml=junit.xml -o junit_family=legacy \
44+
--cov=celery_library \
45+
--durations=10 \
46+
--log-date-format="%Y-%m-%d %H:%M:%S" \
47+
--log-format="%(asctime)s %(levelname)s %(message)s" \
48+
--verbose \
49+
-m "not heavy_load" \
50+
$(CURDIR)/tests

packages/celery-library/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# simcore Celery library
2+
3+
Provides a wrapper around Celery library [1].
4+
5+
## Installation
6+
7+
```console
8+
make help
9+
make install-dev
10+
```
11+
12+
## Test
13+
14+
```console
15+
make help
16+
make test-dev
17+
```
18+
19+
20+
[1] https://github.com/celery/celery

packages/celery-library/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# Targets to pip-compile requirements
3+
#
4+
include ../../../requirements/base.Makefile
5+
6+
# Add here any extra explicit dependency: e.g. _migration.txt: _base.txt

0 commit comments

Comments
 (0)