Coverage for mlos_bench/mlos_bench/tests/services/remote/mock/mock_remote_exec_service.py: 100%
8 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-21 01:50 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-21 01:50 +0000
1#
2# Copyright (c) Microsoft Corporation.
3# Licensed under the MIT License.
4#
5"""A collection Service functions for mocking remote script execution."""
7from collections.abc import Callable
8from typing import Any
10from mlos_bench.services.base_service import Service
11from mlos_bench.services.types.remote_exec_type import SupportsRemoteExec
12from mlos_bench.tests.services.remote.mock import mock_operation
15class MockRemoteExecService(Service, SupportsRemoteExec):
16 """Mock remote script execution service."""
18 def __init__(
19 self,
20 config: dict[str, Any] | None = None,
21 global_config: dict[str, Any] | None = None,
22 parent: Service | None = None,
23 methods: dict[str, Callable] | list[Callable] | None = None,
24 ):
25 """
26 Create a new instance of mock remote exec service.
28 Parameters
29 ----------
30 config : dict
31 Free-format dictionary that contains the benchmark environment
32 configuration.
33 global_config : dict
34 Free-format dictionary of global parameters.
35 parent : Service
36 Parent service that can provide mixin functions.
37 """
38 super().__init__(
39 config,
40 global_config,
41 parent,
42 self.merge_methods(
43 methods,
44 {
45 "remote_exec": mock_operation,
46 "get_remote_exec_results": mock_operation,
47 },
48 ),
49 )