Skip to content

Commit

Permalink
[openfl.experimental] Use absolute imports
Browse files Browse the repository at this point in the history
Signed-off-by: Shah, Karan <[email protected]>
  • Loading branch information
MasterSkepticista committed Jun 6, 2024
1 parent cafb965 commit a302bd5
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 76 deletions.
7 changes: 3 additions & 4 deletions openfl/experimental/component/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.component package."""

from .aggregator import Aggregator
from .collaborator import Collaborator

__all__ = ["Aggregator", "Collaborator"]
# FIXME: Too much recursion
from openfl.experimental.component.aggregator import Aggregator
from openfl.experimental.component.collaborator import Collaborator
7 changes: 2 additions & 5 deletions openfl/experimental/component/aggregator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.component.aggregator package."""

from .aggregator import Aggregator

__all__ = [
"Aggregator",
]
# FIXME: Too much recursion.
from openfl.experimental.component.aggregator import Aggregator
7 changes: 2 additions & 5 deletions openfl/experimental/component/collaborator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.component.collaborator package."""

from .collaborator import Collaborator

__all__ = [
"Collaborator",
]
# FIXME: Too much recursion.
from openfl.experimental.component.collaborator.collaborator import Collaborator
5 changes: 2 additions & 3 deletions openfl/experimental/federated/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.federated package."""

from .plan import Plan # NOQA

__all__ = ["Plan"]
# FIXME: Recursion!
from openfl.experimental.federated.plan import Plan
7 changes: 2 additions & 5 deletions openfl/experimental/federated/plan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
# SPDX-License-Identifier: Apache-2.0
"""Experimental Plan package."""

from .plan import Plan

__all__ = [
"Plan",
]
# FIXME: Too much recursion in namespace
from openfl.experimental.federated.plan.plan import Plan
6 changes: 2 additions & 4 deletions openfl/experimental/interface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.interface package."""

from .fl_spec import FLSpec
from .participants import Aggregator, Collaborator

__all__ = ["FLSpec", "Aggregator", "Collaborator"]
from openfl.experimental.interface.fl_spec import FLSpec
from openfl.experimental.interface.participants import Aggregator, Collaborator
4 changes: 1 addition & 3 deletions openfl/experimental/placement/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.placement package."""

from .placement import aggregator, collaborator

__all__ = ["aggregator", "collaborator"]
from openfl.experimental.placement import aggregator, collaborator
10 changes: 4 additions & 6 deletions openfl/experimental/transport/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Copyright (C) 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.transport package."""
from .grpc import AggregatorGRPCClient, AggregatorGRPCServer

__all__ = [
"AggregatorGRPCServer",
"AggregatorGRPCClient",
]
from openfl.experimental.transport.grpc import (
AggregatorGRPCClient,
AggregatorGRPCServer,
)
16 changes: 7 additions & 9 deletions openfl/experimental/transport/grpc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.transport.grpc package."""

from .aggregator_client import AggregatorGRPCClient
from .aggregator_server import AggregatorGRPCServer
from openfl.experimental.transport.grpc.aggregator_client import (
AggregatorGRPCClient,
)
from openfl.experimental.transport.grpc.aggregator_server import (
AggregatorGRPCServer,
)


# FIXME: Not the right place for exceptions
class ShardNotFoundError(Exception):
"""Indicates that director has no information about that shard."""


__all__ = [
"AggregatorGRPCServer",
"AggregatorGRPCClient",
"ShardNotFoundError",
]
5 changes: 3 additions & 2 deletions openfl/experimental/transport/grpc/aggregator_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
import grpc

from openfl.experimental.protocols import aggregator_pb2, aggregator_pb2_grpc
from openfl.experimental.transport.grpc.grpc_channel_options import (
channel_options,
)
from openfl.utilities import check_equal

from .grpc_channel_options import channel_options


class ConstantBackoff:
"""Constant Backoff policy."""
Expand Down
5 changes: 3 additions & 2 deletions openfl/experimental/transport/grpc/aggregator_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
from grpc import StatusCode, server, ssl_server_credentials

from openfl.experimental.protocols import aggregator_pb2, aggregator_pb2_grpc
from openfl.experimental.transport.grpc.grpc_channel_options import (
channel_options,
)
from openfl.utilities import check_equal, check_is_in

from .grpc_channel_options import channel_options

logger = logging.getLogger(__name__)


Expand Down
31 changes: 6 additions & 25 deletions openfl/experimental/utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,27 @@
# SPDX-License-Identifier: Apache-2.0
"""openfl.experimental.utilities package."""

from .exceptions import (
from openfl.experimental.utilities.exceptions import (
ResourcesAllocationError,
ResourcesNotAvailableError,
SerializationError,
)
from .metaflow_utils import MetaflowInterface
from .resources import get_number_of_gpus
from .runtime_utils import (
from openfl.experimental.utilities.metaflow_utils import MetaflowInterface
from openfl.experimental.utilities.resources import get_number_of_gpus
from openfl.experimental.utilities.runtime_utils import (
check_resource_allocation,
checkpoint,
filter_attributes,
generate_artifacts,
parse_attrs,
)
from .stream_redirect import (
from openfl.experimental.utilities.stream_redirect import (
RedirectStdStream,
RedirectStdStreamBuffer,
RedirectStdStreamContext,
)
from .transitions import (
from openfl.experimental.utilities.transitions import (
aggregator_to_collaborator,
collaborator_to_aggregator,
should_transfer,
)

__all__ = [
"MetaflowInterface",
"should_transfer",
"aggregator_to_collaborator",
"collaborator_to_aggregator",
"SerializationError",
"ResourcesNotAvailableError",
"ResourcesAllocationError",
"RedirectStdStreamBuffer",
"RedirectStdStream",
"RedirectStdStreamContext",
"get_number_of_gpus",
"parse_attrs",
"generate_artifacts",
"filter_attributes",
"checkpoint",
"check_resource_allocation",
]
4 changes: 1 addition & 3 deletions openfl/experimental/workspace_export/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from .export import WorkspaceExport

__all__ = ["WorkspaceExport"]
from openfl.experimental.workspace_export.export import WorkspaceExport

0 comments on commit a302bd5

Please sign in to comment.