mirror of
https://github.com/apache/impala.git
synced 2025-12-30 21:02:41 -05:00
This is general clean up in prep for use with the stress test.
Changes:
1) Failed commands and failure to connect now raise exceptions.
Previously run_cmd() was not guaranteed to do anything at all in
remote mode.
2) Fix scope of 'hosts' which was at the class level but was modified
by instance level functions which makes no sense since different
instances could clash with each other.
3) Remove uses of opaque *args and **kwargs instead of named args. The
generic forms should be avoided since they impair readability.
4) Stop trying to get the cluster hosts from an environment variable
unconditionally upon construction.
5) Remove 'local' member variable, it's not needed and allowing 'local'
to be set to False when no 'hosts' are not set makes no sense.
6) Simplify and remove unneeded methods and arguments.
Change-Id: Id90bd3b640f2681bb7e82a5e6d5e49ed8c5a7b98
Reviewed-on: http://gerrit.cloudera.org:8080/514
Reviewed-by: Casey Ching <casey@cloudera.com>
Tested-by: Internal Jenkins
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
#!/usr/bin/env python
|
|
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from tests.util.cluster_controller import ClusterController
|
|
from tests.benchmark.plugins import Plugin
|
|
|
|
class ClearBufferCache(Plugin):
|
|
"""Plugin that clears the buffer cache before a query is run."""
|
|
|
|
__name__ = "ClearBufferCache"
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
self.cluster_controller = ClusterController(*args, **kwargs)
|
|
Plugin.__init__(self, *args, **kwargs)
|
|
|
|
def run_pre_hook(self, context=None):
|
|
# Drop the page cache (drop_caches=1). We'll leave the inodes and dentries
|
|
# since that is not what we are testing and it causes excessive performance
|
|
# variability.
|
|
cmd = "sysctl -w vm.drop_caches=1 vm.drop_caches=0"
|
|
self.cluster_controller.deprecated_run_cmd(cmd)
|