Skip to content

Commit 29eeb9e

Browse files
authored
♻️ Maintenance/ensure director v2 restarts only for code change (ITISFoundation#2598)
* ensure rebooting is only checking the python code * remove validator to fix simcore-sdk test
1 parent 41132a9 commit 29eeb9e

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

packages/models-library/src/models_library/generics.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
ValuesView,
1212
)
1313

14-
from pydantic import validator
1514
from pydantic.generics import GenericModel
1615

1716
DictKey = TypeVar("DictKey")
@@ -65,12 +64,3 @@ def __len__(self):
6564
class Envelope(GenericModel, Generic[DataT]):
6665
data: Optional[DataT]
6766
error: Optional[Any]
68-
69-
@validator("error")
70-
@classmethod
71-
def data_and_error_cannot_be_populated_together(cls, v, values):
72-
if v is not None and values.get("data") is not None:
73-
raise ValueError(
74-
"both data and error cannot contain values at the same time"
75-
)
76-
return v

packages/models-library/tests/test_generics.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,3 @@ def test_data_enveloped(faker: Faker):
5656
assert some_enveloped_bool
5757
assert not some_enveloped_bool.data
5858
assert some_enveloped_bool.error == random_text
59-
60-
with pytest.raises(ValueError):
61-
Envelope[int](data=213, error="some error message")

services/director-v2/docker/boot.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ fi
3636
if [ "${SC_BOOT_MODE}" = "debug-ptvsd" ]; then
3737
# NOTE: ptvsd is programmatically enabled inside of the service
3838
# this way we can have reload in place as well
39+
reload_dir_packages=$(find packages -maxdepth 3 -type d -path "*/src/*" ! -path "*.*" -exec echo --reload-dir {} \;)
40+
41+
# NOTE: keep the reload_dir_package as un-quoted as the IFS (internal field separators works only this way. any SH shell guru is welcome to enhance this!
42+
# FIXME: when uvicorn >0.15.0 comes in, replace it with --reload-include '*.py'
43+
IFS=$(printf ' \n\t');
44+
#shellcheck disable=SC2086
3945
exec uvicorn simcore_service_director_v2.main:the_app \
40-
--reload \
4146
--host 0.0.0.0 \
42-
--reload-dir services/director-v2/src/simcore_service_director_v2 \
43-
--reload-dir packages
47+
--reload \
48+
$reload_dir_packages \
49+
--reload-dir services/director-v2/src/simcore_service_director_v2
4450
else
4551
exec uvicorn simcore_service_director_v2.main:the_app \
4652
--host 0.0.0.0

services/storage/src/simcore_service_storage/handlers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ async def get_file_metadata(request: web.Request):
214214
)
215215
# when no metadata is found
216216
if data is None:
217-
return {"error": "No result found"}
217+
# NOTE: This is what happens Larry... data must be an empty {} or else some old
218+
# dynamic services will FAIL (sic)
219+
return {"error": "No result found", "data": {}}
218220

219221
return {
220222
"error": None,

0 commit comments

Comments
 (0)