Skip to content

Commit

Permalink
Executor - Support SuperBench Executor running on Windows (#475)
Browse files Browse the repository at this point in the history
**Description**
Support SuperBench Executor running on Windows.

**Major Revision**
- Lazy import ansible related module
  • Loading branch information
yukirora authored Feb 13, 2023
1 parent f21bfef commit 62a2913
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
13 changes: 13 additions & 0 deletions superbench/common/utils/lazy_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,16 @@ def __dir__(self):
"""
self._import()
return dir(self._module)

def __call__(self, *args, **kwargs):
"""Override __call__.
Args:
*args (list): Arguments.
**kwargs (dict): Keyword arguments.
Returns:
Any: The return value of the function.
"""
self._import()
return self._module(*args, **kwargs)
4 changes: 3 additions & 1 deletion superbench/runner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

"""SuperBench runner module."""

from superbench.runner.ansible import AnsibleClient
from superbench.common.utils.lazy_import import LazyImport
from superbench.runner.runner import SuperBenchRunner

AnsibleClient = LazyImport('superbench.runner.ansible', 'AnsibleClient')

__all__ = [
'AnsibleClient',
'SuperBenchRunner',
Expand Down
4 changes: 3 additions & 1 deletion superbench/runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
from omegaconf import ListConfig, OmegaConf

from superbench.common.utils import SuperBenchLogger, logger, gen_ibstat, gen_traffic_pattern_host_groups
from superbench.runner.ansible import AnsibleClient
from superbench.common.utils.lazy_import import LazyImport
from superbench.benchmarks import ReduceType, Reducer
from superbench.monitor import MonitorRecord

AnsibleClient = LazyImport('superbench.runner.ansible', 'AnsibleClient')


class SuperBenchRunner():
"""SuperBench runner class."""
Expand Down

0 comments on commit 62a2913

Please sign in to comment.