-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7907 from OpenMined/domain_envs
Listing Domain packages, fix request repr to show node types and owners, add owner to domain list
- Loading branch information
Showing
13 changed files
with
123 additions
and
7 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
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
33 changes: 33 additions & 0 deletions
33
packages/syft/src/syft/service/metadata/metadata_service.py
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,33 @@ | ||
# third party | ||
|
||
# relative | ||
from ...serde.serializable import serializable | ||
from ...store.document_store import DocumentStore | ||
from ...util.telemetry import instrument | ||
from ..context import AuthedServiceContext | ||
from ..service import AbstractService | ||
from ..service import service_method | ||
from ..user.user_roles import GUEST_ROLE_LEVEL | ||
|
||
|
||
@instrument | ||
@serializable() | ||
class MetadataService(AbstractService): | ||
def __init__(self, store: DocumentStore) -> None: | ||
self.store = store | ||
|
||
@service_method( | ||
path="metadata.get_metadata", name="get_metadata", roles=GUEST_ROLE_LEVEL | ||
) | ||
def get_metadata(self, context: AuthedServiceContext): | ||
return context.node.metadata | ||
|
||
# @service_method(path="metadata.get_admin", name="get_admin", roles=GUEST_ROLE_LEVEL) | ||
# def get_admin(self, context: AuthedServiceContext): | ||
# user_service = context.node.get_service("userservice") | ||
# admin_user = user_service.get_all(context=context)[0] | ||
# return admin_user | ||
|
||
@service_method(path="metadata.get_env", name="get_env", roles=GUEST_ROLE_LEVEL) | ||
def get_env(self, context: AuthedServiceContext): | ||
return context.node.packages |
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
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,20 @@ | ||
# stdlib | ||
from typing import Dict | ||
import venv | ||
|
||
# relative | ||
from ..types.syft_object import SYFT_OBJECT_VERSION_1 | ||
from ..types.syft_object import SyftObject | ||
|
||
|
||
class Env(SyftObject): | ||
__canonical_name__ = "Env" | ||
__version__ = SYFT_OBJECT_VERSION_1 | ||
packages_dict: Dict[str, str] | ||
|
||
@property | ||
def packages(self): | ||
return [(k, v) for k, v in self.packages_dict.items()] | ||
|
||
def create_local_env(self): | ||
venv.EnvBuilder() |
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 @@ def settings(worker, faker) -> NodeSettings: | |
description=faker.text(), | ||
deployed_on=datetime.now().date().strftime("%m/%d/%Y"), | ||
signup_enabled=False, | ||
admin_email="[email protected]", | ||
) | ||
|
||
|
||
|
@@ -52,6 +53,7 @@ def metadata_json(faker) -> NodeMetadataJSON: | |
lowest_object_version=LOWEST_SYFT_OBJECT_VERSION, | ||
syft_version=__version__, | ||
signup_enabled=False, | ||
admin_email="[email protected]", | ||
) | ||
|
||
|
||
|
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 |
---|---|---|
|
@@ -233,6 +233,7 @@ def test_settings_allow_guest_registration( | |
lowest_object_version=2, | ||
syft_version=syft.__version__, | ||
signup_enabled=False, | ||
admin_email="[email protected]", | ||
) | ||
|
||
with mock.patch( | ||
|
@@ -307,6 +308,7 @@ def get_mock_client(faker, root_client, role): | |
lowest_object_version=2, | ||
syft_version=syft.__version__, | ||
signup_enabled=False, | ||
admin_email="[email protected]", | ||
) | ||
|
||
with mock.patch( | ||
|