コード例 #1
0
ファイル: vlab_module.py プロジェクト: nokia/STF
import shutil
import time
import subprocess
from stf.modules.base_module import STFBaseModule
from stf.lib.logging.logger import Logger
from stf.lib.SParser import SParser
from stf.managers.test_case_manager import TestStep, TestProcess
from stf.lib.STFParser import STFParser
from stf.lib.stf_utils import *

from novaclient import client as nova_client
from keystoneauth1 import loading
from keystoneauth1 import session
#from neutronclient.v2_0 import client as neutronclient

logger = Logger.getLogger(__name__)


class STFVlabModule(STFBaseModule):
    def __init__(self, pluginManager):
        super(STFVlabModule, self).__init__(pluginManager)
        self.lab = None
        self.parser = None
        self.test_step = None
        self.server_sections = None
        self.server_to_create_or_delete = None
        self.project_name = None
        self.id_rsa_pub = None
        self.keypair_name = 'stf_'
        self.vlab_name_list = []
        self.options = [
コード例 #2
0
ファイル: multi_tasks_manager.py プロジェクト: nokia/STF
"""
:author: SUN, Andy

MultiTasksManager class based on python threading lib is provided for multi-tasks in parallel.
"""

import stf.lib.exceptions_messages as msgs
from stf.lib.logging.logger import Logger
from threading import Thread
from Queue import Queue

LOGGER = Logger.getLogger(__name__)


class MultiTasksManagerError(BaseException):
    """If error, raise it."""
    pass


class MultiTasksManager(object):
    """
    Run multi-tasks in parallel based on Python threading lib.
    The class provides two public methods for external user: register and runMultiTasks. The register method is used for
    registering the tasks that need to run in parallel. The runMultiTasks method will run the registered tasks in
    parallel and be blocked until all tasks are completed and then return the result.

    >>> multiTasks = MultiTasksManager()
    >>> multiTasks.register(function1, arg1, arg2, kwarg1, kwarg2)
    >>> multiTasks.register(function2, arg1, arg2, kwarg1, kwarg2)
    >>> multiTasks.register(function3, arg1, arg2, kwarg1, kwarg2)
    >>> result = multiTasks.runMultiTasksManager()