mirror of
https://github.com/apache/impala.git
synced 2026-01-10 00:00:16 -05:00
Change-Id: I81fd9ec742a9efbdb16466c8ee7387fabe3e16e4 Reviewed-on: http://gerrit.ent.cloudera.com:8080/342 Reviewed-by: Ishaan Joshi <ishaan@cloudera.com> Tested-by: Ishaan Joshi <ishaan@cloudera.com>
31 lines
1.1 KiB
Python
31 lines
1.1 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):
|
|
cmd = "sysctl -w vm.drop_caches=3 vm.drop_caches=0"
|
|
self.cluster_controller.run_cmd(cmd)
|