-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds dynamic-sidecar osparc service (🏗️actions required) (#2271)
* moved service-sidecar contents * added task to run unittests * added unittests bash commands * added command to run unittests locally * added entry to build dynamic-sidecar * coverage and deploy now await for dynamic-sidecar * renamed service-sidecar to dynamic-sidecar * renaming missing folder * renaming missing fodler part 2 * updating makefile * updating tox * removing tox * added ci codestyle check before tests run * removed unsued targets * fixed error message * added missing test * added codeoowner entry * moved mocked fucntions to the same module * renamed module * updating log warning messages for mocked calls * added some help * clrifying command usage * using verbatim arguments * fixed typo * renived tests * renaming ServiceSidecarSettings to DynamicSidecarSettings * updated name in changelog * fixed ptsv entrypoint * fixed healt endpoint to fail when status is not healthy * fixed route and test * mappign docs on the same route as other services * added api prefix for interested routes * codestyle * container api routes refactored * renamed storage to shared_store * refacted shared_store to use Pydantic models * missed a rename * added makefile entry to generate openapi spec * adding correct mypy file * mypy suggestions * added openapi.json for the service * codestyle also updates openapi.json * added common scripts to enforce codestyles in development and CI * imported statuses from fastapi/starlette definitions * updated docstring * fixed imports, now importing from starlette * moved mark.asyncio * moved act into bash script * added act entry to common.Makefile * added entry for development of dunamic-sidecar * added test to check the spec has was updated * added missing fixture * updated readme * removed unused APIs and renamed existing * added docker-compose config validation * moved settings and shared state to dependencies * minor improvments * updated requirements * added missing service to SERVICES_LIST * Some suggestions (#3) from sanderegg * naming * consistency * shellcheck * proposed refactoring on dynamic sidecar (#4) * removes responses and raise exceptions for errors * Minor typo * Should include standard entrypoint * refactor health and added dependencies * minor * fixes * fixed codestyle * fixed typos * fixed compose API entrypoints and tests * refactored api structure and endpoints * extended utils * adapted new tests * updated API spec * moving routes under the same module * moved tests and updated openapi.json * updated script entryoint name * renamed endpoint * refactor * refactor error raising and staus code for resource not found * regenerated openapi.json spec * codestyle :\ * merged /containers and /containers:inspect * wrong default value * test clenup * updated openapi.json * clarify comment * removed unused API * removed command timeout when posting to createing services via docker-compose * removing unecessary timeouts * forgot to implement it * after the request is accepted the list of container names is returned * removed flag which is no longer used * fixed tests * moved ApplicationHealth and codestyle fixes * added test to check it can run twice the same compos spec with different project-name * fixed codestyle * setting default and documentation to argument * updated oepnapi.json * fixed test to properly work based on workspace * refactoring application models structure * rending applicaiton strucutre similar to other fastapi services * replacing with response.json() * applied codestyle * comitting new updated dependencies * refactoring error codes * clened up exception throwing * restored error emssage Co-authored-by: Andrei Neagu <[email protected]> Co-authored-by: Sylvain <[email protected]> Co-authored-by: Pedro Crespo-Valero <[email protected]>
- Loading branch information
1 parent
d9125d4
commit 9be551a
Showing
54 changed files
with
2,856 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | ||
set -o errexit # abort on nonzero exitstatus | ||
set -o nounset # abort on unbound variable | ||
set -o pipefail # don't hide errors within pipes | ||
IFS=$'\n\t' | ||
|
||
install() { | ||
bash ci/helpers/ensure_python_pip.bash; | ||
pushd services/dynamic-sidecar; pip3 install -r requirements/ci.txt -r requirements/_tools.txt; popd; | ||
pip list -v | ||
} | ||
|
||
codestyle(){ | ||
scripts/codestyle.bash ci simcore_service_dynamic_sidecar services/dynamic-sidecar | ||
} | ||
|
||
test() { | ||
pytest --cov=simcore_service_dynamic_sidecar --durations=10 --cov-append \ | ||
--color=yes --cov-report=term-missing --cov-report=xml --cov-config=.coveragerc \ | ||
-v -m "not travis" services/dynamic-sidecar/tests/unit | ||
} | ||
|
||
# Check if the function exists (bash specific) | ||
if declare -f "$1" > /dev/null | ||
then | ||
# call arguments verbatim | ||
"$@" | ||
else | ||
# Show a helpful error | ||
echo "'$1' is not a known function name" >&2 | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
IFS=$'\n\t' | ||
|
||
# points to root soruce directory of this project, usually ../../ | ||
ROOT_PROJECT_DIR=$1 | ||
# name of the job, usually defined in the .github/workflows/ci-testing-deploy.yaml | ||
JOB_TO_RUN=$2 | ||
|
||
DOCKER_IMAGE_NAME=dind-act-runner | ||
ACT_RUNNER=ubuntu-20.04=catthehacker/ubuntu:act-20.04 | ||
ACT_VERSION_TAG=v0.2.20 # from https://github.com/nektos/act/releases | ||
|
||
docker build -t $DOCKER_IMAGE_NAME - <<EOF | ||
FROM docker:dind | ||
RUN apk add curl bash | ||
RUN curl -fsSL https://raw.githubusercontent.com/nektos/act/master/install.sh | bash /dev/stdin -d $ACT_VERSION_TAG | ||
WORKDIR /project | ||
CMD /bin/sh -c "act -v -P $ACT_RUNNER -j $JOB_TO_RUN" | ||
EOF | ||
|
||
echo "$(pwd)/${ROOT_PROJECT_DIR}" | ||
docker run --rm -it \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v "$(pwd)"/"${ROOT_PROJECT_DIR}":/project \ | ||
-v "$(pwd)"/ci-logs:/logs \ | ||
$DOCKER_IMAGE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
IFS=$'\n\t' | ||
|
||
SRC_DIRECTORY_NAME=${2} | ||
BASE_PATH_DIR=${3-MISSING_DIR} | ||
|
||
# used for development (fails on pylint and mypy) | ||
development() { | ||
echo "enforcing codestyle to source_directory=$SRC_DIRECTORY_NAME" | ||
echo "isort" | ||
isort setup.py src/"$SRC_DIRECTORY_NAME" tests | ||
echo "black" | ||
black src/"$SRC_DIRECTORY_NAME" tests/ | ||
echo "pylint" | ||
pylint --rcfile=../../.pylintrc src/"$SRC_DIRECTORY_NAME" tests/ | ||
echo "mypy" | ||
mypy --ignore-missing-imports --config-file ../../mypy.ini src/"$SRC_DIRECTORY_NAME" tests/ | ||
} | ||
|
||
# invoked by ci as test (also fails on isort and black) | ||
ci() { | ||
echo "checking codestyle in service=$BASE_PATH_DIR with source_directory=$SRC_DIRECTORY_NAME" | ||
echo "isort" | ||
isort --check setup.py "$BASE_PATH_DIR"/src/"$SRC_DIRECTORY_NAME" "$BASE_PATH_DIR"/tests | ||
echo "black" | ||
black --check "$BASE_PATH_DIR"/src/"$SRC_DIRECTORY_NAME" "$BASE_PATH_DIR"/tests | ||
echo "pylint" | ||
pylint --rcfile=.pylintrc "$BASE_PATH_DIR"/src/"$SRC_DIRECTORY_NAME" "$BASE_PATH_DIR"/tests | ||
echo "mypy" | ||
mypy --config-file mypy.ini --ignore-missing-imports "$BASE_PATH_DIR"/src/"$SRC_DIRECTORY_NAME" "$BASE_PATH_DIR"/tests | ||
} | ||
|
||
# Allows to call a function based on arguments passed to the script | ||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Environment used to configure storage services | ||
# | ||
# - To expose in cmd: export $(grep -v '^#' .env-devel | xargs -0) | ||
# | ||
|
||
# environs in Dockerfile ---------------- | ||
SC_BOOT_MODE=local-development | ||
|
||
|
||
# service specific required vars | ||
DYNAMIC_SIDECAR_compose_namespace=dev-namespace | ||
DYNAMIC_SIDECAR_docker_compose_down_timeout=15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Changelog | ||
All notable changes to this service will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [0.0.1] - 2021-04-14 | ||
### Added | ||
- First working version of the service | ||
- FastAPI based service | ||
- all spawned services and networks are removed when receiving `SIGTERM` |
Oops, something went wrong.