Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send small variables to storage without blob storage #8897

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ecf3f04
[syft/action_obj] refactor `convert_to_pointers`
khoaguin Jun 11, 2024
ed094f4
[syft/action_obj] skip saving to blob storage if `syft_action_data` i…
khoaguin Jun 11, 2024
a6334ab
[syft/action_obj] set `syft_action_data_cache` for `ActionObject` if …
khoaguin Jun 11, 2024
4c77e40
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 12, 2024
7335c56
[syft/action_obj] remove redundant setting syft_action_data_cache to …
khoaguin Jun 12, 2024
1505f22
[syft/blob_storage] print out on-disk blob store path in dev mode
khoaguin Jun 12, 2024
94793e5
[syft/blob_storage] pass obj's min size to save to the blob storage i…
khoaguin Jun 12, 2024
44fee3a
[syft/blob_storage] stop passing min size to upload obj to blob stora…
khoaguin Jun 12, 2024
495357b
[syft/test] test action object's saving to blob storage behavior when…
khoaguin Jun 13, 2024
217c097
[syft/blob_storage] pass `MIN_SIZE_BLOB_STORAGE_MB` env var into `Set…
khoaguin Jun 13, 2024
fbcb4ea
[syft/tests] add `min_size_blob_storage_mb` to `NodeMetadataJSON` in …
khoaguin Jun 13, 2024
63ee3ec
[syft/blob_storage] fix lint, add some debugging statements
khoaguin Jun 14, 2024
d2addb1
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 14, 2024
d37606c
[syft/action_obj] put action object's upload to blob storage code in …
khoaguin Jun 14, 2024
759f66b
[syft/tests] test saving big objects to blob storage when uploading b…
khoaguin Jun 14, 2024
eb1bcc3
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 20, 2024
716cea8
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 21, 2024
6c8c0fc
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 24, 2024
c9b5c3e
[syft/action_obj] - `_save_to_blob_store` returns a SyftWarning if th…
khoaguin Jun 24, 2024
033365e
[syft/action_obj] set `skip_save_to_blob_stores` and `skip_clear_cach…
khoaguin Jun 24, 2024
7ef9884
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 24, 2024
4b2ec09
[syft/action_obj] set skip_save_to_blob_stores and `skip_clear_cache`…
khoaguin Jun 24, 2024
92c4843
[syft/twin_obj] pass `skip_save_to_blob_stores` and `skip_clear_cache…
khoaguin Jun 24, 2024
f4c9c39
[syft/twin_obj] pass skip_save_to_blob_stores and `skip_clear_cache` …
khoaguin Jun 24, 2024
bbecc07
[syft/twin_obj] pass skip_save_to_blob_stores and `skip_clear_cache` …
khoaguin Jun 24, 2024
1e2f960
[syft] fix lint. Change using print "not saving action objs to blob s…
khoaguin Jun 24, 2024
2c4d59a
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 25, 2024
39fe4a6
fix logger
khoaguin Jun 25, 2024
18ad21b
fix logger in action_service.py
khoaguin Jun 25, 2024
721d90e
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 25, 2024
38c03d2
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 27, 2024
77fb1c2
[syft/action_service] merging flags to save action objects to the blo…
khoaguin Jun 27, 2024
1e869b1
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jun 27, 2024
719a9a5
[syft/action_obj] refactor `ActionObject._save_to_blob_storage`
khoaguin Jun 27, 2024
2272447
[syft/action_obj] stop saving data to cache if saving to the blob store
khoaguin Jun 28, 2024
286c81f
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jul 1, 2024
0675e3b
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jul 1, 2024
a260de8
[syft/chore] change print to `logger.debug` for blob store path and m…
khoaguin Jul 1, 2024
33b9375
Merge branch 'dev' into save-small-variables-without-blob-storage
shubham3121 Jul 2, 2024
d3a6b6a
[syft/action_obj] saving action data cache immediately after trying t…
khoaguin Jul 3, 2024
a652489
Merge branch 'dev' into save-small-variables-without-blob-storage
khoaguin Jul 3, 2024
7f8517e
raise exception if exception raised in action object
shubham3121 Jul 3, 2024
5718f00
get metadata from api_or_context method in action object
shubham3121 Jul 3, 2024
49ceece
fix linting
shubham3121 Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/syft/src/syft/client/domain_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path
import re
from string import Template
import sys
from typing import TYPE_CHECKING
from typing import cast

Expand All @@ -17,6 +18,7 @@
# relative
from ..abstract_node import NodeSideType
from ..serde.serializable import serializable
from ..serde.serialize import _serialize as serialize
from ..service.action.action_object import ActionObject
from ..service.code_history.code_history import CodeHistoriesDict
from ..service.code_history.code_history import UsersCodeHistoriesDict
Expand Down Expand Up @@ -134,6 +136,11 @@ def upload_dataset(self, dataset: CreateDataset) -> SyftSuccess | SyftError:
syft_node_location=self.id,
syft_client_verify_key=self.verify_key,
)
serialized: bytes = serialize(twin, to_bytes=True)
size_mb: float = sys.getsizeof(serialized) / 1024 / 1024
if size_mb < 16:
khoaguin marked this conversation as resolved.
Show resolved Hide resolved
print(f"object's size = {size_mb} (MB), less than 16 MB")
# TODO: if less than 16 MB, save without using blob storage
twin._save_to_blob_storage()
except Exception as e:
tqdm.write(f"Failed to create twin for {asset.name}. {e}")
Expand Down
57 changes: 19 additions & 38 deletions packages/syft/src/syft/service/action/action_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,44 +498,25 @@ def convert_to_pointers(
# relative
from ..dataset.dataset import Asset

arg_list = []
kwarg_dict = {}
if args is not None:
for arg in args:
if (
not isinstance(arg, ActionObject | Asset | UID)
and api.signing_key is not None # type: ignore[unreachable]
):
arg = ActionObject.from_obj( # type: ignore[unreachable]
syft_action_data=arg,
syft_client_verify_key=api.signing_key.verify_key,
syft_node_location=api.node_uid,
)
arg.syft_node_uid = node_uid
r = arg._save_to_blob_storage()
if isinstance(r, SyftError):
print(r.message)
arg = api.services.action.set(arg)
arg_list.append(arg)

if kwargs is not None:
for k, arg in kwargs.items():
if (
not isinstance(arg, ActionObject | Asset | UID)
and api.signing_key is not None # type: ignore[unreachable]
):
arg = ActionObject.from_obj( # type: ignore[unreachable]
syft_action_data=arg,
syft_client_verify_key=api.signing_key.verify_key,
syft_node_location=api.node_uid,
)
arg.syft_node_uid = node_uid
r = arg._save_to_blob_storage()
if isinstance(r, SyftError):
print(r.message)
arg = api.services.action.set(arg)

kwarg_dict[k] = arg
def process_arg(arg: ActionObject | Asset | UID | Any) -> Any:
khoaguin marked this conversation as resolved.
Show resolved Hide resolved
if (
not isinstance(arg, ActionObject | Asset | UID)
and api.signing_key is not None # type: ignore[unreachable]
):
arg = ActionObject.from_obj( # type: ignore[unreachable]
syft_action_data=arg,
syft_client_verify_key=api.signing_key.verify_key,
syft_node_location=api.node_uid,
)
arg.syft_node_uid = node_uid
r = arg._save_to_blob_storage()
if isinstance(r, SyftError):
print(r.message)
arg = api.services.action.set(arg)
return arg

arg_list = [process_arg(arg) for arg in args] if args else []
kwarg_dict = {k: process_arg(v) for k, v in kwargs.items()} if kwargs else {}

return arg_list, kwarg_dict

Expand Down
Loading