Coverage for mlos_bench/mlos_bench/tests/services/remote/mock/mock_remote_exec_service.py: 100%
8 statements
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-05 00:36 +0000
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-05 00:36 +0000
1#
2# Copyright (c) Microsoft Corporation.
3# Licensed under the MIT License.
4#
5"""
6A collection Service functions for mocking remote script execution.
7"""
9from typing import Any, Callable, Dict, List, Optional, Union
11from mlos_bench.services.base_service import Service
12from mlos_bench.services.types.remote_exec_type import SupportsRemoteExec
13from mlos_bench.tests.services.remote.mock import mock_operation
16class MockRemoteExecService(Service, SupportsRemoteExec):
17 """
18 Mock remote script execution service.
19 """
21 def __init__(self, config: Optional[Dict[str, Any]] = None,
22 global_config: Optional[Dict[str, Any]] = None,
23 parent: Optional[Service] = None,
24 methods: Union[Dict[str, Callable], List[Callable], None] = None):
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, global_config, parent,
40 self.merge_methods(methods, {
41 "remote_exec": mock_operation,
42 "get_remote_exec_results": mock_operation,
43 })
44 )