def configure(self): # plugin part self.config = self.get_option(self.OPTION_CONFIG, '') self.eta_file = self.get_option("eta_file", '') self.core.add_artifact_file(self.eta_file) self.phantom_path = self.get_option("phantom_path", 'phantom') self.enum_ammo = self.get_option("enum_ammo", False) self.buffered_seconds = int( self.get_option("buffered_seconds", self.buffered_seconds)) self.exclude_markers = set( filter((lambda marker: marker != ''), self.get_option('exclude_markers', []).split(' '))) self.taskset_affinity = self.get_option('affinity', '') try: autostop = self.core.get_plugin_of_type(AutostopPlugin) autostop.add_criteria_class(UsedInstancesCriteria) except KeyError: self.log.debug( "No autostop plugin found, not adding instances criteria") self.predefined_phout = self.get_option(PhantomConfig.OPTION_PHOUT, '') if not self.get_option(self.OPTION_CONFIG, '') and self.predefined_phout: self.phout_import_mode = True if not self.config and not self.phout_import_mode: self.phantom = PhantomConfig(self.core) self.phantom.read_config()
def configure(self): # plugin part self.config = self.get_option(self.OPTION_CONFIG, '') self.eta_file = self.get_option("eta_file", '') self.core.add_artifact_file(self.eta_file) self.phantom_path = self.get_option("phantom_path", 'phantom') self.enum_ammo = self.get_option("enum_ammo", False) self.buffered_seconds = int( self.get_option("buffered_seconds", self.buffered_seconds)) self.exclude_markers = set(filter((lambda marker: marker != ''), self.get_option('exclude_markers', []).split(' '))) self.taskset_affinity = self.get_option('affinity', '') try: autostop = self.core.get_plugin_of_type(AutostopPlugin) autostop.add_criteria_class(UsedInstancesCriteria) except KeyError: self.log.debug( "No autostop plugin found, not adding instances criteria") self.predefined_phout = self.get_option(PhantomConfig.OPTION_PHOUT, '') if not self.get_option(self.OPTION_CONFIG, '') and self.predefined_phout: self.phout_import_mode = True if not self.config and not self.phout_import_mode: self.phantom = PhantomConfig(self.core) self.phantom.read_config()
def get_available_options(self): opts = [ "eta_file", "phantom_path", "buffered_seconds", "exclude_markers" ] opts += 'affinity' opts += [PhantomConfig.OPTION_PHOUT, self.OPTION_CONFIG] opts += PhantomConfig.get_available_options() return opts
def get_available_options(self): opts = ["eta_file", "phantom_path", "buffered_seconds", "exclude_markers"] opts += 'affinity' opts += [PhantomConfig.OPTION_PHOUT, self.OPTION_CONFIG] opts += PhantomConfig.get_available_options() return opts
class PhantomPlugin(AbstractPlugin, AggregateResultListener): """ Plugin for running phantom tool """ OPTION_CONFIG = "config" SECTION = PhantomConfig.SECTION def __init__(self, core): AbstractPlugin.__init__(self, core) self.config = None self.process = None self.predefined_phout = None self.phout_import_mode = False self.did_phout_import_try = False self.phantom_path = None self.eta_file = None self.processed_ammo_count = 0 self.phantom_start_time = time.time() self.buffered_seconds = "2" self.taskset_affinity = None self.cpu_count = mp.cpu_count() self.phantom = None self.cached_info = None self.phantom_stderr = None self.enum_ammo = False @staticmethod def get_key(): return __file__ def get_available_options(self): opts = ["eta_file", "phantom_path", "buffered_seconds", "exclude_markers"] opts += 'affinity' opts += [PhantomConfig.OPTION_PHOUT, self.OPTION_CONFIG] opts += PhantomConfig.get_available_options() return opts def configure(self): # plugin part self.config = self.get_option(self.OPTION_CONFIG, '') self.eta_file = self.get_option("eta_file", '') self.core.add_artifact_file(self.eta_file) self.phantom_path = self.get_option("phantom_path", 'phantom') self.enum_ammo = self.get_option("enum_ammo", False) self.buffered_seconds = int( self.get_option("buffered_seconds", self.buffered_seconds)) self.exclude_markers = set(filter((lambda marker: marker != ''), self.get_option('exclude_markers', []).split(' '))) self.taskset_affinity = self.get_option('affinity', '') try: autostop = self.core.get_plugin_of_type(AutostopPlugin) autostop.add_criteria_class(UsedInstancesCriteria) except KeyError: self.log.debug( "No autostop plugin found, not adding instances criteria") self.predefined_phout = self.get_option(PhantomConfig.OPTION_PHOUT, '') if not self.get_option(self.OPTION_CONFIG, '') and self.predefined_phout: self.phout_import_mode = True if not self.config and not self.phout_import_mode: self.phantom = PhantomConfig(self.core) self.phantom.read_config() def prepare_test(self): aggregator = None try: aggregator = self.core.get_plugin_of_type(AggregatorPlugin) except Exception, ex: self.log.warning("No aggregator found: %s", ex) if aggregator: aggregator.reader = PhantomReader(aggregator, self) aggregator.reader.buffered_seconds = self.buffered_seconds if self.phantom: self.phantom.set_timeout(aggregator.get_timeout()) aggregator.add_result_listener(self) if not self.config and not self.phout_import_mode: if aggregator: aggregator.reader.phout_file = self.phantom.phout_file # generate config self.config = self.phantom.compose_config() args = [self.phantom_path, 'check', self.config] try: result = tankcore.execute(args, catch_out=True) except OSError: raise RuntimeError("Phantom I/O engine is not installed!") retcode = result[0] if retcode: raise RuntimeError( "Config check failed. Subprocess returned code %s" % retcode) if result[2]: raise RuntimeError( "Subprocess returned message: %s" % result[2]) else: if aggregator: aggregator.reader.phout_file = self.predefined_phout try: console = self.core.get_plugin_of_type(ConsoleOnlinePlugin) except Exception, ex: self.log.debug("Console not found: %s", ex) console = None
class PhantomPlugin(AbstractPlugin, AggregateResultListener): """ Plugin for running phantom tool """ OPTION_CONFIG = "config" SECTION = PhantomConfig.SECTION def __init__(self, core): AbstractPlugin.__init__(self, core) self.config = None self.process = None self.predefined_phout = None self.phout_import_mode = False self.did_phout_import_try = False self.phantom_path = None self.eta_file = None self.processed_ammo_count = 0 self.phantom_start_time = time.time() self.buffered_seconds = "2" self.taskset_affinity = None self.cpu_count = mp.cpu_count() self.phantom = None self.cached_info = None self.phantom_stderr = None self.enum_ammo = False @staticmethod def get_key(): return __file__ def get_available_options(self): opts = [ "eta_file", "phantom_path", "buffered_seconds", "exclude_markers" ] opts += 'affinity' opts += [PhantomConfig.OPTION_PHOUT, self.OPTION_CONFIG] opts += PhantomConfig.get_available_options() return opts def configure(self): # plugin part self.config = self.get_option(self.OPTION_CONFIG, '') self.eta_file = self.get_option("eta_file", '') self.core.add_artifact_file(self.eta_file) self.phantom_path = self.get_option("phantom_path", 'phantom') self.enum_ammo = self.get_option("enum_ammo", False) self.buffered_seconds = int( self.get_option("buffered_seconds", self.buffered_seconds)) self.exclude_markers = set( filter((lambda marker: marker != ''), self.get_option('exclude_markers', []).split(' '))) self.taskset_affinity = self.get_option('affinity', '') try: autostop = self.core.get_plugin_of_type(AutostopPlugin) autostop.add_criteria_class(UsedInstancesCriteria) except KeyError: self.log.debug( "No autostop plugin found, not adding instances criteria") self.predefined_phout = self.get_option(PhantomConfig.OPTION_PHOUT, '') if not self.get_option(self.OPTION_CONFIG, '') and self.predefined_phout: self.phout_import_mode = True if not self.config and not self.phout_import_mode: self.phantom = PhantomConfig(self.core) self.phantom.read_config() def prepare_test(self): aggregator = None try: aggregator = self.core.get_plugin_of_type(AggregatorPlugin) except Exception, ex: self.log.warning("No aggregator found: %s", ex) if aggregator: aggregator.reader = PhantomReader(aggregator, self) aggregator.reader.buffered_seconds = self.buffered_seconds if self.phantom: self.phantom.set_timeout(aggregator.get_timeout()) aggregator.add_result_listener(self) if not self.config and not self.phout_import_mode: if aggregator: aggregator.reader.phout_file = self.phantom.phout_file # generate config self.config = self.phantom.compose_config() args = [self.phantom_path, 'check', self.config] try: result = tankcore.execute(args, catch_out=True) except OSError: raise RuntimeError("Phantom I/O engine is not installed!") retcode = result[0] if retcode: raise RuntimeError( "Config check failed. Subprocess returned code %s" % retcode) if result[2]: raise RuntimeError("Subprocess returned message: %s" % result[2]) else: if aggregator: aggregator.reader.phout_file = self.predefined_phout try: console = self.core.get_plugin_of_type(ConsoleOnlinePlugin) except Exception, ex: self.log.debug("Console not found: %s", ex) console = None