forked from ITISFoundation/osparc-simcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:ITISFoundation/osparc-simcore int…
…o service-startup-progress
- Loading branch information
Showing
16 changed files
with
116 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
"migration", | ||
"postgres", | ||
"storage", | ||
"redis", | ||
] | ||
|
||
pytest_simcore_ops_services_selection = [ | ||
|
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
"migration", | ||
"postgres", | ||
"storage", | ||
"redis", | ||
] | ||
|
||
pytest_simcore_ops_services_selection = [ | ||
|
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 |
---|---|---|
|
@@ -41,6 +41,7 @@ | |
"migration", | ||
"postgres", | ||
"storage", | ||
"redis", | ||
] | ||
|
||
pytest_simcore_ops_services_selection = [ | ||
|
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 |
---|---|---|
|
@@ -57,6 +57,7 @@ | |
"rabbit", | ||
"redis", | ||
"storage", | ||
"redis", | ||
] | ||
pytest_simcore_ops_services_selection = [ | ||
"adminer", | ||
|
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 |
---|---|---|
|
@@ -45,6 +45,7 @@ | |
"migration", | ||
"postgres", | ||
"storage", | ||
"redis", | ||
] | ||
|
||
pytest_simcore_ops_services_selection = [ | ||
|
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ aioresponses | |
coverage | ||
docker | ||
faker | ||
fakeredis[lua] | ||
moto[server] | ||
pandas | ||
pytest | ||
|
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,35 @@ | ||
import logging | ||
from typing import cast | ||
|
||
from aiohttp import web | ||
from servicelib.redis import RedisClientSDK | ||
from settings_library.redis import RedisDatabase, RedisSettings | ||
|
||
from .constants import APP_CONFIG_KEY | ||
from .settings import Settings | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
_APP_REDIS_KEY = "APP_REDIS_KEY" | ||
|
||
|
||
def setup_redis(app: web.Application): | ||
async def _setup(app: web.Application): | ||
app[_APP_REDIS_KEY] = None | ||
settings: Settings = app[APP_CONFIG_KEY] | ||
assert settings.STORAGE_REDIS # nosec | ||
redis_settings: RedisSettings = settings.STORAGE_REDIS | ||
redis_locks_dsn = redis_settings.build_redis_dsn(RedisDatabase.LOCKS) | ||
app[_APP_REDIS_KEY] = client = RedisClientSDK(redis_locks_dsn) | ||
await client.setup() | ||
|
||
yield | ||
|
||
if client: | ||
await client.shutdown() | ||
|
||
app.cleanup_ctx.append(_setup) | ||
|
||
|
||
def get_redis_client(app: web.Application) -> RedisClientSDK: | ||
return cast(RedisClientSDK, app[_APP_REDIS_KEY]) |
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