"git@developer.sourcefind.cn:gaoqiong/pybind11.git" did not exist on "b322018e1571b42513de77d9ad9fde1d030c8cc6"
docker_base.py 1.85 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

"""Module of the docker-benchmark base class."""

from abc import abstractmethod

from superbench.benchmarks import BenchmarkType
from superbench.benchmarks.base import Benchmark


class DockerBenchmark(Benchmark):
    """The base class of benchmarks packaged in docker container."""
    def __init__(self, name, parameters=''):
        """Constructor.

        Args:
            name (str): benchmark name.
            parameters (str): benchmark parameters.
        """
        super().__init__(name, parameters)
        self._benchmark_type = BenchmarkType.DOCKER
        # Command lines to launch the docker image and run the benchmarks inside docker.
        self.__commands = list()

    '''
    # If need to add new arguments, super().add_parser_arguments() must be called.
    def add_parser_arguments(self):
        """Add the specified arguments."""
        super().add_parser_arguments()
    '''

    def _preprocess(self):
        """Preprocess/preparation operations before the benchmarking.

        Return:
            True if _preprocess() succeed.
        """
        return super()._preprocess()

    @abstractmethod
    def _benchmark(self):
        """Implementation for benchmarking."""
        pass

46
    def _process_raw_result(self, raw_output):
47
48
49
        """Function to process raw results and save the summarized results.

        Args:
50
51
52
53
            raw_output (str): raw output string of the docker benchmark.

        Return:
            True if the raw output string is valid and result can be extracted.
54
55
        """
        # TODO: will implement it when add real benchmarks in the future.
56
        return True
57
58
59
60
61

    def print_env_info(self):
        """Print environments or dependencies information."""
        # TODO: will implement it when add real benchmarks in the future.
        pass