except ImportError: # Python 2.6 UnsupportedOperation = None import eventlet from eventlet import event from oslo.config import cfg from rally.openstack.common import eventlet_backdoor from rally.openstack.common.gettextutils import _LE, _LI, _LW from rally.openstack.common import importutils from rally.openstack.common import log as logging from rally.openstack.common import systemd from rally.openstack.common import threadgroup rpc = importutils.try_import('rally.openstack.common.rpc') CONF = cfg.CONF LOG = logging.getLogger(__name__) def _sighup_supported(): return hasattr(signal, 'SIGHUP') def _is_daemon(): # The process group for a foreground process will match the # process group of the controlling terminal. If those values do # not match, or ioctl() fails on the stdout file handle, we assume # the process is running in the background as a daemon. # http://www.gnu.org/software/bash/manual/bashref.html#Job-Control-Basics try:
import xmlrpclib except ImportError: # NOTE(jaypipes): xmlrpclib was renamed to xmlrpc.client in Python3 # however the function and object call signatures # remained the same. This whole try/except block should # be removed and replaced with a call to six.moves once # six 1.4.2 is released. See http://bit.ly/1bqrVzu import xmlrpc.client as xmlrpclib import six from rally.openstack.common import gettextutils from rally.openstack.common import importutils from rally.openstack.common import timeutils netaddr = importutils.try_import("netaddr") _nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod, inspect.isfunction, inspect.isgeneratorfunction, inspect.isgenerator, inspect.istraceback, inspect.isframe, inspect.iscode, inspect.isbuiltin, inspect.isroutine, inspect.isabstract] _simple_types = (six.string_types + six.integer_types + (type(None), bool, float)) def to_primitive(value, convert_instances=False, convert_datetime=True, level=0, max_depth=3): """Convert a complex object into primitives.
# # 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. import itertools from rally import db from rally import exceptions from rally.openstack.common import importutils plt = importutils.try_import("matplotlib.pyplot") ticker = importutils.try_import("matplotlib.ticker") def aggregated_plot(task_id, aggregated_field): """Draws an aggregated figure of benchmark runtimes in a separate window. The resulting figure has the aggregated field values on the X axis and the benchmark runtimes (in seconds) on the Y axis. For each benchmark run, minimum, maximum and average runtime values will be drawn, thus resulting in three plots on the figure. :param task_id: ID of the task to draw the plot for :param aggregated_field: Field from the test config to aggregate the data on. This can be e.g. "active_users", "times" etc. """
# Python 2.6 UnsupportedOperation = None import eventlet from eventlet import event from oslo.config import cfg from rally.openstack.common import eventlet_backdoor from rally.openstack.common.gettextutils import _LE, _LI, _LW from rally.openstack.common import importutils from rally.openstack.common import log as logging from rally.openstack.common import systemd from rally.openstack.common import threadgroup rpc = importutils.try_import('rally.openstack.common.rpc') CONF = cfg.CONF LOG = logging.getLogger(__name__) def _sighup_supported(): return hasattr(signal, 'SIGHUP') def _is_daemon(): # The process group for a foreground process will match the # process group of the controlling terminal. If those values do # not match, or ioctl() fails on the stdout file handle, we assume # the process is running in the background as a daemon. # http://www.gnu.org/software/bash/manual/bashref.html#Job-Control-Basics try:
def try_append_module(name, modules): if name not in modules: module = importutils.try_import(name) if module is not None: modules[name] = module