Skip to content

Commit 382d04c

Browse files
author
Andrei Neagu
committed
removed indirection
1 parent 80b64ed commit 382d04c

File tree

1 file changed

+2
-12
lines changed
  • services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/generic_scheduler

1 file changed

+2
-12
lines changed

services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/generic_scheduler/_store.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,6 @@ def _get_operation_context_hash_key(
100100
)
101101

102102

103-
def _dumps(obj: Any) -> str:
104-
# NOTE: does not support `sets` and `tuples` they get serialised to lists
105-
return json_dumps(obj)
106-
107-
108-
def _loads(obj_str: str) -> Any:
109-
# NOTE: does not support `sets` and `tuples` they get deserialized as lists
110-
return json_loads(obj_str)
111-
112-
113103
class Store(SingletonInAppStateMixin, SupportsLifecycle):
114104
"""
115105
Interface to Redis, shuld not use directly but use the
@@ -145,7 +135,7 @@ async def set_keys_in_hash(self, hash_key: str, updates: dict[str, Any]) -> None
145135
"""saves multiple key-value pairs in a hash"""
146136
await handle_redis_returns_union_types(
147137
self.redis.hset(
148-
hash_key, mapping={k: _dumps(v) for k, v in updates.items()}
138+
hash_key, mapping={k: json_dumps(v) for k, v in updates.items()}
149139
)
150140
)
151141

@@ -158,7 +148,7 @@ async def get_key_from_hash(self, hash_key: str, *keys: str) -> tuple[Any, ...]:
158148
result: list[str | None] = await handle_redis_returns_union_types(
159149
self.redis.hmget(hash_key, list(keys))
160150
)
161-
return tuple(_loads(x) if x else None for x in result)
151+
return tuple(json_loads(x) if x else None for x in result)
162152

163153
async def delete_key_from_hash(self, hash_key: str, *hash_keys: str) -> None:
164154
"""removes keys form a redis hash"""

0 commit comments

Comments
 (0)