summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Shakhat <ishakhat@mirantis.com>2016-02-26 19:00:33 +0300
committerIlya Shakhat <ishakhat@mirantis.com>2016-02-26 19:00:33 +0300
commit6c3a43e8d0e195176ebefd151d7a6f99da060668 (patch)
treee00e29f76fc708d8463e43a7398a2d7e538059b9
parent40faea0f35f660db9ba068532f0bc99daca66bc4 (diff)
Remove old and unused executors
-rw-r--r--performa/executors/__init__.py27
-rw-r--r--performa/executors/base.py61
-rw-r--r--performa/executors/shell.py30
3 files changed, 0 insertions, 118 deletions
diff --git a/performa/executors/__init__.py b/performa/executors/__init__.py
deleted file mode 100644
index 96bc51a..0000000
--- a/performa/executors/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
1# Copyright (c) 2016 OpenStack Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12# implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16from performa.executors import shell
17
18EXECUTORS = {
19 '_default': shell.ShellExecutor,
20}
21
22
23def get_executor(test_definition):
24 # returns executor of the specified test on the specified agent
25 executor_class = test_definition['class']
26 klazz = EXECUTORS.get(executor_class, EXECUTORS['_default'])
27 return klazz(test_definition)
diff --git a/performa/executors/base.py b/performa/executors/base.py
deleted file mode 100644
index c79e01c..0000000
--- a/performa/executors/base.py
+++ /dev/null
@@ -1,61 +0,0 @@
1# Copyright (c) 2016 OpenStack Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12# implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16from oslo_log import log as logging
17
18
19LOG = logging.getLogger(__name__)
20
21
22class CommandLine(object):
23 def __init__(self, command):
24 self.tokens = [command]
25
26 def add(self, param_name, param_value=None):
27 token = param_name
28 if param_value is not None:
29 token += '=' + str(param_value)
30 self.tokens.append(token)
31
32 def make(self):
33 return ' '.join(self.tokens)
34
35
36class BaseExecutor(object):
37 def __init__(self, test_definition):
38 super(BaseExecutor, self).__init__()
39 self.test_definition = test_definition
40
41 def get_expected_duration(self):
42 return self.test_definition.get('time') or 60
43
44 def get_command(self):
45 return None
46
47 def process_reply(self, message):
48 LOG.debug('Test %s finished with %s',
49 self.test_definition, message)
50 return dict(stdout=message.get('stdout'),
51 stderr=message.get('stderr'),
52 command=self.get_command())
53
54 def process_failure(self):
55 return dict(command=self.get_command())
56
57
58class ExecutorException(Exception):
59 def __init__(self, record, message):
60 super(ExecutorException, self).__init__(message)
61 self.record = record
diff --git a/performa/executors/shell.py b/performa/executors/shell.py
deleted file mode 100644
index e987acb..0000000
--- a/performa/executors/shell.py
+++ /dev/null
@@ -1,30 +0,0 @@
1# Copyright (c) 2016 OpenStack Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12# implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16from oslo_log import log as logging
17
18from performa.executors import base
19
20
21LOG = logging.getLogger(__name__)
22
23
24class ShellExecutor(base.BaseExecutor):
25 def get_command(self):
26 if 'program' in self.test_definition:
27 cmd = base.CommandLine(self.test_definition['program'])
28 elif 'script' in self.test_definition:
29 cmd = base.Script(self.test_definition['script'])
30 return cmd.make()