From af5334f6acf8805dcffb21840daee29c35534b5d Mon Sep 17 00:00:00 2001 From: teo <teo.milea97@gmail.com> Date: Tue, 14 May 2024 12:06:25 +0300 Subject: [PATCH 1/4] fix request repr --- .../syft/src/syft/service/request/request.py | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/syft/src/syft/service/request/request.py b/packages/syft/src/syft/service/request/request.py index 5d10f6cc75e..9db4b9b2613 100644 --- a/packages/syft/src/syft/service/request/request.py +++ b/packages/syft/src/syft/service/request/request.py @@ -470,6 +470,7 @@ def _coll_repr_(self) -> dict[str, str | dict[str, str]]: "Request time": str(self.request_time), "Description": self.html_description, "Requested By": "\n".join(user_data), + "Creation Time": str(self.request_time), "Status": status_badge, } @@ -1220,18 +1221,19 @@ def nested_repr(self, node: Any | None = None, level: int = 0) -> str: def __repr_syft_nested__(self) -> str: msg = ( - f"Request to change <b>{self.code.service_func_name}</b> " - f"(Pool Id: <b>{self.code.worker_pool_name}</b>) " + f"Request to change <strong>{self.code.service_func_name}</strong> " + f"(Pool Id: <strong>{self.code.worker_pool_name}</strong>) " ) - msg += "to permission <strong>RequestStatus.APPROVED.</strong>" - if self.nested_solved: - if self.link.nested_codes == {}: # type: ignore - msg += "No nested requests." - else: + msg += "to permission RequestStatus.APPROVED." + if self.code.nested_codes is None or self.code.nested_codes == {}: # type: ignore + msg += " No nested requests" + else: + if self.nested_solved: + # else: msg += "<br><br>This change requests the following nested functions calls:<br>" msg += self.nested_repr() - else: - msg += "Nested Requests not resolved." + else: + msg += " Nested Requests not resolved" return msg def _repr_markdown_(self, wrap_as_python: bool = True, indent: int = 0) -> str: From d65bc749f1ba73b31c2d1e76fddd38af18cd59ba Mon Sep 17 00:00:00 2001 From: khoaguin <dkn.work@protonmail.com> Date: Fri, 17 May 2024 09:59:23 +0700 Subject: [PATCH 2/4] [DX] print out SQLite database path in dev mode when launching python in memory nodes --- packages/syft/src/syft/node/node.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/syft/src/syft/node/node.py b/packages/syft/src/syft/node/node.py index 7861ee422e0..59acfee2f4b 100644 --- a/packages/syft/src/syft/node/node.py +++ b/packages/syft/src/syft/node/node.py @@ -437,9 +437,12 @@ def runs_in_docker(self) -> bool: def get_default_store(self, use_sqlite: bool) -> StoreConfig: if use_sqlite: path = self.get_temp_dir("db") + file_name: str = f"{self.id}.sqlite" + if self.dev_mode: + print(f"SQLite db path: {path/file_name}") return SQLiteStoreConfig( client_config=SQLiteStoreClientConfig( - filename=f"{self.id}.sqlite", + filename=file_name, path=path, ) ) From a10f4058a1659a247de7acb0b14c9513cfbc83b0 Mon Sep 17 00:00:00 2001 From: khoaguin <dkn.work@protonmail.com> Date: Tue, 21 May 2024 09:11:59 +0700 Subject: [PATCH 3/4] [DX] pass an argument to print out SQLite store type (document or action store) --- packages/syft/src/syft/node/node.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/syft/src/syft/node/node.py b/packages/syft/src/syft/node/node.py index 59acfee2f4b..34c10dd9efe 100644 --- a/packages/syft/src/syft/node/node.py +++ b/packages/syft/src/syft/node/node.py @@ -372,10 +372,12 @@ def __init__( use_sqlite = local_db or (processes > 0 and not is_subprocess) document_store_config = document_store_config or self.get_default_store( - use_sqlite=use_sqlite + use_sqlite=use_sqlite, + store_type="Document Store", ) action_store_config = action_store_config or self.get_default_store( - use_sqlite=use_sqlite + use_sqlite=use_sqlite, + store_type="Action Store", ) self.init_stores( action_store_config=action_store_config, @@ -434,12 +436,12 @@ def runs_in_docker(self) -> bool: and any("docker" in line for line in open(path)) ) - def get_default_store(self, use_sqlite: bool) -> StoreConfig: + def get_default_store(self, use_sqlite: bool, store_type: str) -> StoreConfig: if use_sqlite: path = self.get_temp_dir("db") file_name: str = f"{self.id}.sqlite" if self.dev_mode: - print(f"SQLite db path: {path/file_name}") + print(f"{store_type}'s SQLite DB path: {path/file_name}") return SQLiteStoreConfig( client_config=SQLiteStoreClientConfig( filename=file_name, From 5c8314cebe9be0253d664e3b8bdf16d87e0f5c6b Mon Sep 17 00:00:00 2001 From: teo <teo.milea97@gmail.com> Date: Tue, 21 May 2024 09:19:22 +0300 Subject: [PATCH 4/4] remove duplicated line --- packages/syft/src/syft/service/request/request.py | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/syft/src/syft/service/request/request.py b/packages/syft/src/syft/service/request/request.py index 9db4b9b2613..889491278e8 100644 --- a/packages/syft/src/syft/service/request/request.py +++ b/packages/syft/src/syft/service/request/request.py @@ -467,7 +467,6 @@ def _coll_repr_(self) -> dict[str, str | dict[str, str]]: ] return { - "Request time": str(self.request_time), "Description": self.html_description, "Requested By": "\n".join(user_data), "Creation Time": str(self.request_time),