Skip to content

Commit

Permalink
Bugfix/director v2 loop (#2356)
Browse files Browse the repository at this point in the history
* fix building targeted service
* fix issue with wrong loop
* correct catalog startup
* fixed api-server as well
* fixed dynamic sidecar
  • Loading branch information
sanderegg authored May 31, 2021
1 parent 6a51091 commit 5e50637
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 176 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ ifeq ($(findstring static-webserver,$(target)),static-webserver)
$(MAKE_C) services/web/client touch compile-dev
endif
# Building service $(target)
@$(_docker_compose_build) $(target)
@$(_docker_compose_build)
endif


Expand Down
12 changes: 8 additions & 4 deletions services/api-server/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then
fi

# RUNNING application ----------------------------------------
if [ "${SC_BOOT_MODE}" = "debug-ptvsd" ]
then
if [ "${SC_BOOT_MODE}" = "debug-ptvsd" ]; then
# NOTE: ptvsd is programmatically enabled inside of the service
# this way we can have reload in place as well
exec uvicorn simcore_service_api_server.__main__:the_app --reload --host 0.0.0.0 --reload-dir services/api-server/src/simcore_service_api_server
exec uvicorn simcore_service_api_server.main:the_app \
--reload \
--host 0.0.0.0 \
--reload-dir services/api-server/src/simcore_service_api_server
else
exec simcore-service-api-server
exec uvicorn simcore_service_api_server.main:the_app \
--host 0.0.0.0 \
--reload-dir services/api-server/src/simcore_service_api_server
fi
5 changes: 0 additions & 5 deletions services/api-server/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,4 @@ def read_reqs(reqs_path: Path):
test_suite="tests",
tests_require=test_requirements,
extras_require={"test": test_requirements},
entry_points={
"console_scripts": [
"simcore-service-api-server = simcore_service_api_server.__main__:main",
],
},
)
35 changes: 0 additions & 35 deletions services/api-server/src/simcore_service_api_server/__main__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ def loglevel(self) -> int:

client_request: ClientRequestSettings

# SERVICE SERVER (see : https://www.uvicorn.org/settings/)
host: str = "0.0.0.0" # nosec
port: int = 8000

debug: bool = False # If True, debug tracebacks should be returned on errors.
remote_debug_port: int = 3000
dev_features_enabled: bool = Field(
Expand Down
8 changes: 8 additions & 0 deletions services/api-server/src/simcore_service_api_server/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Main application to be deployed in for example uvicorn.
"""
from fastapi import FastAPI
from simcore_service_api_server.core.application import init_app


# SINGLETON FastAPI app
the_app: FastAPI = init_app()
9 changes: 7 additions & 2 deletions services/catalog/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ fi
if [ "${SC_BOOT_MODE}" = "debug-ptvsd" ]; then
# NOTE: ptvsd is programmatically enabled inside of the service
# this way we can have reload in place as well
exec uvicorn simcore_service_catalog.__main__:the_app --reload --host 0.0.0.0 --reload-dir services/catalog/src/simcore_service_catalog
exec uvicorn simcore_service_catalog.main:the_app \
--reload \
--host 0.0.0.0 \
--reload-dir services/catalog/src/simcore_service_catalog
else
exec simcore-service-catalog
exec uvicorn simcore_service_catalog.main:the_app \
--host 0.0.0.0 \
--reload-dir services/catalog/src/simcore_service_catalog
fi
5 changes: 0 additions & 5 deletions services/catalog/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,4 @@ def read_reqs(reqs_path: Path):
test_suite="tests",
tests_require=test_requirements,
extras_require={"test": test_requirements},
entry_points={
"console_scripts": [
"simcore-service-catalog=simcore_service_catalog.__main__:main",
],
},
)
36 changes: 0 additions & 36 deletions services/catalog/src/simcore_service_catalog/__main__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ def loglevel(self) -> int:
# DIRECTOR SERVICE
director: DirectorSettings

# SERVICE SERVER (see : https://www.uvicorn.org/settings/)
host: str = "0.0.0.0" # nosec
port: int = 8000
# fastappi app settings
debug: bool = False # If True, debug tracebacks should be returned on errors.

# BACKGROUND TASK
Expand Down
8 changes: 8 additions & 0 deletions services/catalog/src/simcore_service_catalog/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Main application to be deployed in for example uvicorn.
"""
from fastapi import FastAPI
from simcore_service_catalog.core.application import init_app


# SINGLETON FastAPI app
the_app: FastAPI = init_app()
9 changes: 7 additions & 2 deletions services/director-v2/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ fi
if [ "${SC_BOOT_MODE}" = "debug-ptvsd" ]; then
# NOTE: ptvsd is programmatically enabled inside of the service
# this way we can have reload in place as well
exec uvicorn simcore_service_director_v2.__main__:the_app --reload --host 0.0.0.0 --reload-dir services/director-v2/src/simcore_service_director_v2
exec uvicorn simcore_service_director_v2.main:the_app \
--reload \
--host 0.0.0.0 \
--reload-dir services/director-v2/src/simcore_service_director_v2
else
exec simcore-service-director-v2
exec uvicorn simcore_service_director_v2.main:the_app \
--host 0.0.0.0 \
--reload-dir services/director-v2/src/simcore_service_director_v2
fi
5 changes: 0 additions & 5 deletions services/director-v2/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,4 @@ def read_reqs(reqs_path: Path):
test_suite="tests",
tests_require=test_requirements,
extras_require={"test": test_requirements},
entry_points={
"console_scripts": [
"simcore-service-director-v2=simcore_service_director_v2.__main__:main",
],
},
)
36 changes: 0 additions & 36 deletions services/director-v2/src/simcore_service_director_v2/__main__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,10 @@ def loglevel(self) -> int:
# monitoring
monitoring_enabled: str = Field(False, env="MONITORING_ENABLED")

# SERVICE SERVER (see : https://www.uvicorn.org/settings/)
host: str = "0.0.0.0" # nosec
port: PortInt = 8000
# fastappi app settings
debug: bool = False # If True, debug tracebacks should be returned on errors.

# ptvsd settings
remote_debug_port: PortInt = 3000

client_request: ClientRequestSettings
Expand Down
8 changes: 8 additions & 0 deletions services/director-v2/src/simcore_service_director_v2/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Main application to be deployed in for example uvicorn.
"""
from fastapi import FastAPI
from simcore_service_director_v2.core.application import init_app


# SINGLETON FastAPI app
the_app: FastAPI = init_app()
12 changes: 8 additions & 4 deletions services/dynamic-sidecar/docker/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then
fi

# RUNNING application ----------------------------------------
if [ "${SC_BOOT_MODE}" = "debug-ptvsd" ]
then
if [ "${SC_BOOT_MODE}" = "debug-ptvsd" ]; then
# NOTE: ptvsd is programmatically enabled inside of the service
# this way we can have reload in place as well
exec uvicorn simcore_service_dynamic_sidecar.main:app --reload --host 0.0.0.0
exec uvicorn simcore_service_dynamic_sidecar.main:app \
--reload \
--host 0.0.0.0 \
--reload-dir services/dynamic-sidecar/src/simcore_service_dynamic_sidecar
else
exec simcore-service-dynamic-sidecar
exec uvicorn simcore_service_dynamic_sidecar.main:app \
--host 0.0.0.0 \
--reload-dir services/dynamic-sidecar/src/simcore_service_dynamic_sidecar
fi
5 changes: 0 additions & 5 deletions services/dynamic-sidecar/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,4 @@ def read_reqs(reqs_path: Path):
install_requires=install_requires,
tests_require=tests_require,
setup_requires=["setuptools_scm"],
entry_points={
"console_scripts": [
"simcore-service-dynamic-sidecar=simcore_service_dynamic_sidecar.main:main"
],
},
)
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
import sys
from pathlib import Path
"""Main application to be deployed in for example uvicorn.
"""

import uvicorn
from fastapi import FastAPI
from simcore_service_dynamic_sidecar.core.application import assemble_application
from simcore_service_dynamic_sidecar.core.settings import DynamicSidecarSettings

current_dir = Path(sys.argv[0] if __name__ == "__main__" else __file__).resolve().parent


# SINGLETON FastAPI app
app: FastAPI = assemble_application()


def main() -> None:
settings: DynamicSidecarSettings = app.state.settings

uvicorn.run(
"simcore_service_dynamic_sidecar.main:app",
host=settings.host,
port=settings.port,
reload=settings.is_development_mode,
reload_dirs=[
current_dir,
],
log_level=settings.log_level_name.lower(),
)


if __name__ == "__main__":
main()

0 comments on commit 5e50637

Please sign in to comment.