Skip to content

Commit

Permalink
MLI file names conform to snake case (#689)
Browse files Browse the repository at this point in the history
Update MLI filenames to be snake case.
  • Loading branch information
AlyssaCote authored Aug 30, 2024
1 parent 8aa990c commit f6d55d8
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 54 deletions.
1 change: 1 addition & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Jump to:

Description

- Filenames conform to snake case
- Update SmartSim environment variables using new naming convention
- Refactor `exception_handler`
- Add RequestDispatcher and the possibility of batching inference requests
Expand Down
2 changes: 1 addition & 1 deletion ex/high_throughput_inference/mli_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
NUM_RANKS = 4
NUM_WORKERS = 1
filedir = os.path.dirname(__file__)
worker_manager_script_name = os.path.join(filedir, "standalone_workermanager.py")
worker_manager_script_name = os.path.join(filedir, "standalone_worker_manager.py")
app_script_name = os.path.join(filedir, "mock_app.py")
model_name = os.path.join(filedir, f"resnet50.{DEVICE}.pt")

Expand Down
2 changes: 1 addition & 1 deletion ex/high_throughput_inference/mock_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import torch

from mpi4py import MPI
from smartsim._core.mli.infrastructure.storage.dragonfeaturestore import (
from smartsim._core.mli.infrastructure.storage.dragon_feature_store import (
DragonFeatureStore,
)
from smartsim._core.mli.message_handler import MessageHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@

from smartsim._core.entrypoints.service import Service
from smartsim._core.mli.comm.channel.channel import CommChannelBase
from smartsim._core.mli.comm.channel.dragonchannel import DragonCommChannel
from smartsim._core.mli.comm.channel.dragonfli import DragonFLIChannel
from smartsim._core.mli.infrastructure.storage.dragonfeaturestore import (
from smartsim._core.mli.comm.channel.dragon_channel import DragonCommChannel
from smartsim._core.mli.comm.channel.dragon_fli import DragonFLIChannel
from smartsim._core.mli.infrastructure.storage.dragon_feature_store import (
DragonFeatureStore,
)
from smartsim._core.mli.infrastructure.control.requestdispatcher import (
from smartsim._core.mli.infrastructure.control.request_dispatcher import (
RequestDispatcher,
)
from smartsim._core.mli.infrastructure.control.workermanager import WorkerManager
from smartsim._core.mli.infrastructure.environmentloader import EnvironmentConfigLoader
from smartsim._core.mli.infrastructure.storage.dragonfeaturestore import (
from smartsim._core.mli.infrastructure.control.worker_manager import WorkerManager
from smartsim._core.mli.infrastructure.environment_loader import EnvironmentConfigLoader
from smartsim._core.mli.infrastructure.storage.dragon_feature_store import (
DragonFeatureStore,
)
from smartsim._core.mli.infrastructure.worker.worker import MachineLearningWorkerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from contextlib import _GeneratorContextManager, contextmanager

from .....log import get_logger
from ...infrastructure.storage.featurestore import FeatureStore
from ..storage.feature_store import FeatureStore
from ..worker.worker import MachineLearningWorkerBase, RequestBatch

logger = get_logger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
from .....error import SmartSimError
from .....log import get_logger
from ....utils.timings import PerfTimer
from ...infrastructure.environmentloader import EnvironmentConfigLoader
from ...infrastructure.storage.featurestore import FeatureStore
from ...infrastructure.worker.worker import (
from ..environment_loader import EnvironmentConfigLoader
from ..storage.feature_store import FeatureStore
from ..worker.worker import (
InferenceRequest,
MachineLearningWorkerBase,
ModelIdentifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@
import typing as t
from queue import Empty

from smartsim._core.mli.infrastructure.storage.featurestore import FeatureStore
from smartsim._core.mli.infrastructure.storage.feature_store import FeatureStore

from .....log import get_logger
from ....entrypoints.service import Service
from ....utils.timings import PerfTimer
from ...infrastructure.environmentloader import EnvironmentConfigLoader
from ...infrastructure.worker.worker import (
from ...message_handler import MessageHandler
from ..environment_loader import EnvironmentConfigLoader
from ..worker.worker import (
InferenceReply,
LoadModelResult,
MachineLearningWorkerBase,
RequestBatch,
)
from ...message_handler import MessageHandler
from .devicemanager import DeviceManager, WorkerDevice
from .device_manager import DeviceManager, WorkerDevice
from .error_handling import build_failure_reply, exception_handler

if t.TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import typing as t

from smartsim._core.mli.comm.channel.channel import CommChannelBase
from smartsim._core.mli.infrastructure.storage.featurestore import FeatureStore
from smartsim._core.mli.infrastructure.storage.feature_store import FeatureStore
from smartsim.log import get_logger

logger = get_logger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

# isort: on

from smartsim._core.mli.infrastructure.storage.featurestore import FeatureStore
from smartsim._core.mli.infrastructure.storage.feature_store import FeatureStore
from smartsim.error import SmartSimError
from smartsim.log import get_logger

Expand Down
2 changes: 1 addition & 1 deletion smartsim/_core/mli/infrastructure/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
from .....error import SmartSimError
from .....log import get_logger
from ...comm.channel.channel import CommChannelBase
from ...infrastructure.storage.featurestore import FeatureStore, FeatureStoreKey
from ...message_handler import MessageHandler
from ...mli_schemas.model.model_capnp import Model
from ..storage.feature_store import FeatureStore, FeatureStoreKey

if t.TYPE_CHECKING:
from smartsim._core.mli.mli_schemas.response.response_capnp import Status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import typing as t

import smartsim.error as sse
from smartsim._core.mli.infrastructure.storage.featurestore import FeatureStore
from smartsim._core.mli.infrastructure.storage.feature_store import FeatureStore
from smartsim.log import get_logger

logger = get_logger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions tests/dragon/test_core_machine_learning_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import torch

import smartsim.error as sse
from smartsim._core.mli.infrastructure.storage.featurestore import FeatureStoreKey
from smartsim._core.mli.infrastructure.storage.feature_store import FeatureStoreKey
from smartsim._core.mli.infrastructure.worker.worker import (
InferenceRequest,
MachineLearningWorkerCore,
Expand All @@ -44,7 +44,7 @@
)
from smartsim._core.utils import installed_redisai_backends

from .featurestore import FileSystemFeatureStore, MemoryFeatureStore
from .feature_store import FileSystemFeatureStore, MemoryFeatureStore

# The tests in this file belong to the dragon group
pytestmark = pytest.mark.dragon
Expand Down
4 changes: 2 additions & 2 deletions tests/dragon/test_device_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@

dragon = pytest.importorskip("dragon")

from smartsim._core.mli.infrastructure.control.devicemanager import (
from smartsim._core.mli.infrastructure.control.device_manager import (
DeviceManager,
WorkerDevice,
)
from smartsim._core.mli.infrastructure.storage.featurestore import (
from smartsim._core.mli.infrastructure.storage.feature_store import (
FeatureStore,
FeatureStoreKey,
)
Expand Down
8 changes: 4 additions & 4 deletions tests/dragon/test_environment_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
from dragon.data.ddict.ddict import DDict
from dragon.fli import DragonFLIError, FLInterface

from smartsim._core.mli.comm.channel.dragonchannel import DragonCommChannel
from smartsim._core.mli.comm.channel.dragonfli import DragonFLIChannel
from smartsim._core.mli.infrastructure.environmentloader import EnvironmentConfigLoader
from smartsim._core.mli.infrastructure.storage.dragonfeaturestore import (
from smartsim._core.mli.comm.channel.dragon_channel import DragonCommChannel
from smartsim._core.mli.comm.channel.dragon_fli import DragonFLIChannel
from smartsim._core.mli.infrastructure.environment_loader import EnvironmentConfigLoader
from smartsim._core.mli.infrastructure.storage.dragon_feature_store import (
DragonFeatureStore,
)

Expand Down
18 changes: 9 additions & 9 deletions tests/dragon/test_error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@
from dragon.fli import FLInterface
from dragon.mpbridge.queues import DragonQueue

from smartsim._core.mli.comm.channel.dragonfli import DragonFLIChannel
from smartsim._core.mli.infrastructure.control.devicemanager import WorkerDevice
from smartsim._core.mli.infrastructure.control.requestdispatcher import (
from smartsim._core.mli.comm.channel.dragon_fli import DragonFLIChannel
from smartsim._core.mli.infrastructure.control.device_manager import WorkerDevice
from smartsim._core.mli.infrastructure.control.request_dispatcher import (
RequestDispatcher,
)
from smartsim._core.mli.infrastructure.control.workermanager import (
from smartsim._core.mli.infrastructure.control.worker_manager import (
WorkerManager,
exception_handler,
)
from smartsim._core.mli.infrastructure.environmentloader import EnvironmentConfigLoader
from smartsim._core.mli.infrastructure.storage.dragonfeaturestore import (
from smartsim._core.mli.infrastructure.environment_loader import EnvironmentConfigLoader
from smartsim._core.mli.infrastructure.storage.dragon_feature_store import (
DragonFeatureStore,
)
from smartsim._core.mli.infrastructure.storage.featurestore import (
from smartsim._core.mli.infrastructure.storage.feature_store import (
FeatureStore,
FeatureStoreKey,
)
Expand Down Expand Up @@ -314,12 +314,12 @@ def mock_exception_handler(exc, reply_channel, failure_message):
return exception_handler(exc, mock_reply_channel, failure_message)

monkeypatch.setattr(
"smartsim._core.mli.infrastructure.control.workermanager.exception_handler",
"smartsim._core.mli.infrastructure.control.worker_manager.exception_handler",
mock_exception_handler,
)

monkeypatch.setattr(
"smartsim._core.mli.infrastructure.control.requestdispatcher.exception_handler",
"smartsim._core.mli.infrastructure.control.request_dispatcher.exception_handler",
mock_exception_handler,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/dragon/test_reply_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

dragon = pytest.importorskip("dragon")

from smartsim._core.mli.infrastructure.control.workermanager import build_failure_reply
from smartsim._core.mli.infrastructure.control.worker_manager import build_failure_reply
from smartsim._core.mli.infrastructure.worker.worker import InferenceReply

if t.TYPE_CHECKING:
Expand Down
14 changes: 7 additions & 7 deletions tests/dragon/test_request_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,24 @@

from smartsim._core.entrypoints.service import Service
from smartsim._core.mli.comm.channel.channel import CommChannelBase
from smartsim._core.mli.comm.channel.dragonchannel import DragonCommChannel
from smartsim._core.mli.comm.channel.dragonfli import DragonFLIChannel
from smartsim._core.mli.infrastructure.control.requestdispatcher import (
from smartsim._core.mli.comm.channel.dragon_channel import DragonCommChannel
from smartsim._core.mli.comm.channel.dragon_fli import DragonFLIChannel
from smartsim._core.mli.infrastructure.control.request_dispatcher import (
RequestBatch,
RequestDispatcher,
)
from smartsim._core.mli.infrastructure.control.workermanager import (
from smartsim._core.mli.infrastructure.control.worker_manager import (
EnvironmentConfigLoader,
)
from smartsim._core.mli.infrastructure.storage.dragonfeaturestore import (
from smartsim._core.mli.infrastructure.storage.dragon_feature_store import (
DragonFeatureStore,
)
from smartsim._core.mli.infrastructure.storage.featurestore import FeatureStore
from smartsim._core.mli.infrastructure.storage.feature_store import FeatureStore
from smartsim._core.mli.infrastructure.worker.torch_worker import TorchWorker
from smartsim._core.mli.message_handler import MessageHandler
from smartsim.log import get_logger

from .featurestore import FileSystemFeatureStore
from .feature_store import FileSystemFeatureStore
from .utils.channel import FileSystemCommChannel

logger = get_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/dragon/test_torch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from torch import nn
from torch.nn import functional as F

from smartsim._core.mli.infrastructure.storage.featurestore import FeatureStoreKey
from smartsim._core.mli.infrastructure.storage.feature_store import FeatureStoreKey
from smartsim._core.mli.infrastructure.worker.torch_worker import TorchWorker
from smartsim._core.mli.infrastructure.worker.worker import (
ExecuteResult,
Expand Down
10 changes: 5 additions & 5 deletions tests/dragon/test_worker_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@
from dragon.mpbridge.queues import DragonQueue

from smartsim._core.mli.comm.channel.channel import CommChannelBase
from smartsim._core.mli.comm.channel.dragonfli import DragonFLIChannel
from smartsim._core.mli.infrastructure.control.workermanager import (
from smartsim._core.mli.comm.channel.dragon_fli import DragonFLIChannel
from smartsim._core.mli.infrastructure.control.worker_manager import (
EnvironmentConfigLoader,
WorkerManager,
)
from smartsim._core.mli.infrastructure.storage.dragonfeaturestore import (
from smartsim._core.mli.infrastructure.storage.dragon_feature_store import (
DragonFeatureStore,
)
from smartsim._core.mli.infrastructure.storage.featurestore import FeatureStore
from smartsim._core.mli.infrastructure.storage.feature_store import FeatureStore
from smartsim._core.mli.infrastructure.worker.torch_worker import TorchWorker
from smartsim._core.mli.message_handler import MessageHandler
from smartsim.log import get_logger

from .featurestore import FileSystemFeatureStore
from .feature_store import FileSystemFeatureStore
from .utils.channel import FileSystemCommChannel

logger = get_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/mli/featurestore.py → tests/mli/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import typing as t

import smartsim.error as sse
from smartsim._core.mli.infrastructure.storage.featurestore import FeatureStore
from smartsim._core.mli.infrastructure.storage.feature_store import FeatureStore
from smartsim.log import get_logger

logger = get_logger(__name__)
Expand Down

0 comments on commit f6d55d8

Please sign in to comment.