Run the specified set of plugins against a given protocol.
542920
def runPlugins(self, category, func, protocol, *args):
        
        # Plugins are already sorted by priority
        for plugin in self.plugins:
            # If a plugin throws an exception, we should catch it gracefully.
            try:
                event_listener = getattr(plugin, func)
            except AttributeError:
                # If the plugin doesn't implement the event, do nothing
                pass
            else:
                try:
                    stop = event_listener(protocol, *args)
                    if stop:
                        break
                except Exception:
                    # A plugin should not be able to crash the bot.
                    # Catch and log all errors.
                    traceback.print_exc()
492035
public void run() {

        try {
            // add a list of plugins to execute
            // be sure to use the right order
            m_plugins = new ArrayList<I_CmsUpdateDBPart>();

            if (getDetectedVersion() < 7) {
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBDropOldIndexes());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBUpdateOU());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBCmsUsers());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBProjectId());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBNewTables());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBHistoryTables());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBHistoryPrincipals());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBDropUnusedTables());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBContentTables());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBAlterTables());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBDropBackupTables());
                m_plugins.add(new org.opencms.setup.db.update6to7.CmsUpdateDBCreateIndexes7());
            } else {
                m_plugins.add(new org.opencms.setup.db.update7to8.CmsUpdateDBNewTables());
                m_plugins.add(new org.opencms.setup.db.update7to8.CmsUpdatePasswordColumn());
            }
        } catch (Throwable t) {
            t.printStackTrace();
            throw new RuntimeException(t);
        }

        Iterator<String> it = getPools().iterator();
        while (it.hasNext()) {
            String dbPool = it.next();
            System.out.println("Starting DB Update for pool " + dbPool + "... ");

            try {
                updateDatabase(dbPool);
            } catch (Throwable t) {
                t.printStackTrace();
            }

            System.out.println("... DB Update finished for " + dbPool + ".");
        }
    }
1351685
def _run_helper(self, graph, protocol: Iterable[Dict]):
        
        result = graph

        for entry in protocol:
            meta_entry = entry.get('meta')

            if meta_entry is None:
                name, args, kwargs = _get_protocol_tuple(entry)
                func = self._get_function(name)
                result = func(result, *args, **kwargs)
            else:
                networks = (
                    self._run_helper(graph, subprotocol)
                    for subprotocol in entry['pipelines']
                )

                if meta_entry == META_UNION:
                    result = union(networks)

                elif meta_entry == META_INTERSECTION:
                    result = node_intersection(networks)

                else:
                    raise MetaValueError('invalid meta-command: {}'.format(meta_entry))

        return result
68073
def run(self):
        
        args = []
        for arg in self.args:
            args.append(arg)
        Args = Pyro.util.ArgParser()
        Args.parse(args, 'hkmrvxn:p:b:c:d:s:i:1:2:')

        hostname = Args.getOpt('n', None)
        identification = Args.getOpt('i', None)
        port = None
        useNameServer = True

        if port:
            port = int(port)
        norange = (port == 0)

        self.starter = Pyro.EventService.Server.EventServiceStarter(
            identification=identification)
        self.starter.start(
            hostname, port, useNameServer=useNameServer, norange=norange)
1113955
def run(addr, *commands, **kwargs):
    
    results = []
    handler = VarnishHandler(addr, **kwargs)
    for cmd in commands:
        if isinstance(cmd, tuple) and len(cmd)>1:
            results.extend([getattr(handler, c[0].replace('.','_'))(*c[1:]) for c in cmd])
        else:
            results.append(getattr(handler, cmd.replace('.','_'))(*commands[1:]))
            break
    handler.close()
    return results
187946
def run(self):
        """"""
        self._listening_sock, self._address = (
            bind_domain_socket(self._address)
            if self._uds_path
            else bind_tcp_socket(self._address))

        if self._ssl:
            certfile = os.path.join(os.path.dirname(__file__), 'server.pem')
            self._listening_sock = _ssl.wrap_socket(
                self._listening_sock,
                certfile=certfile,
                server_side=True)
        self._accept_thread = threading.Thread(target=self._accept_loop)
        self._accept_thread.daemon = True
        self._accept_thread.start()
        return self.port
320228
def run(iface_name=None, bpf=None, summary=None, max_packets=50):
    """"""

    # Create the classes
    streamer = packet_streamer.PacketStreamer(iface_name=iface_name, bpf=bpf, max_packets=max_packets)
    meta = packet_meta.PacketMeta()
    rdns = reverse_dns.ReverseDNS()
    tags = packet_tags.PacketTags()
    tmeta = transport_meta.TransportMeta()
    printer = packet_summary.PacketSummary()

    # Set up the chain
    meta.link(streamer)
    rdns.link(meta)
    tags.link(rdns)
    tmeta.link(tags)
    printer.link(tmeta)

    # Pull the chain
    printer.pull()
1124399
def run(plugins):
    '''
    
    '''
    all_plugins = list_plugins()

    if isinstance(plugins, six.string_types):
        plugins = plugins.split(',')

    data = {}
    for plugin in plugins:
        if plugin not in all_plugins:
            continue
        data[plugin] = {}
        muninout = __salt__['cmd.run'](
                'munin-run {0}'.format(plugin),
                python_shell=False)
        for line in muninout.split('\n'):
            if 'value' in line:  # This skips multigraph lines, etc
                key, val = line.split(' ')
                key = key.split('.')[0]
                try:
                    # We only want numbers
                    if '.' in val:
                        val = float(val)
                    else:
                        val = int(val)
                    data[plugin][key] = val
                except ValueError:
                    pass
    return data
953898
def call_plugins(plugins, method, *arg, **kw):
    
    for plug in plugins:
        func = getattr(plug, method, None)
        if func is None:
            continue
        #LOG.debug("call plugin %s: %s", plug.name, method)
        result = func(*arg, **kw)
        if result is not None:
            return result
    return None
798110
private function startPluginTraits()
    {
        foreach ($this->getPluginTraits() as $trait) {
            if (method_exists(get_called_class(), $method = 'start' . class_basename($trait) . 'Plugin')) {
                call_user_func([ $this, $method ], $this->app);
            }
        }
    }
378981
def run_container(self, conf, images, **kwargs):
        """"""
        with self._run_container(conf, images, **kwargs):
            pass
395170
def run(ctx, service, args, show_args, daemon, editable, integration):
    """"""
    home = ctx.obj["HOME"]
    service_path = plugin_utils.get_plugin_path(home, SERVICES, service, editable)
    service_log_path = os.path.join(service_path, LOGS_DIR)

    logger.debug("running command %s (%s)", ctx.command.name, ctx.params,
                 extra={"command": ctx.command.name, "params": ctx.params})

    logger.debug("loading {} ({})".format(service, service_path))
    service = register_service(service_path)

    if show_args:
        return plugin_utils.print_plugin_args(service_path)

    # get our service class instance
    service_module = get_service_module(service_path)
    service_args = plugin_utils.parse_plugin_args(args, config_utils.get_config_parameters(service_path))
    service_obj = service_module.service_class(alert_types=service.alert_types, service_args=service_args)

    if not os.path.exists(service_log_path):
        os.mkdir(service_log_path)

    # prepare runner
    if daemon:
        runner = myRunner(service_obj,
                          pidfile=service_path + ".pid",
                          stdout=open(os.path.join(service_log_path, STDOUTLOG), "ab"),
                          stderr=open(os.path.join(service_log_path, STDERRLOG), "ab"))

        files_preserve = []
        for handler in logging.getLogger().handlers:
            if hasattr(handler, "stream"):
                if hasattr(handler.stream, "fileno"):
                    files_preserve.append(handler.stream.fileno())
            if hasattr(handler, "socket"):
                files_preserve.append(handler.socket.fileno())

        runner.daemon_context.files_preserve = files_preserve
        runner.daemon_context.signal_map.update({
            signal.SIGTERM: service_obj._on_server_shutdown,
            signal.SIGINT: service_obj._on_server_shutdown,
        })
        logger.debug("daemon_context", extra={"daemon_context": vars(runner.daemon_context)})

    for integration_name in integration:
        integration_path = plugin_utils.get_plugin_path(home, INTEGRATIONS, integration_name, editable)
        configure_integration(integration_path)

    click.secho("[+] Launching {} {}".format(service.name, "in daemon mode" if daemon else ""))
    try:
        # save service_args for external reference (see test)
        with open(os.path.join(service_path, ARGS_JSON), "w") as f:
            f.write(json.dumps(service_args))
        runner._start() if daemon else service_obj.run()
    except KeyboardInterrupt:
        service_obj._on_server_shutdown()

    click.secho("[*] {} has stopped".format(service.name))
360648
def run_protocols
      run_proto = File.open("/var/tmp/run-proto-#{@buildtime}", 'w')
      tcl = connect
      tcl << load_config
      tcl << start_protocols
      tcl << disconnect
      run_proto.write tcl
      run_proto.close
      system "#{@ixia_exe} /var/tmp/run-proto-#{@buildtime}"
      File.delete run_proto
    end
248203
def run_all():
    '''
    
    '''
    plugins = list_plugins()
    ret = {}
    for plugin in plugins:
        ret.update(run(plugin))
    return ret
1290510
def run(**kwargs):
    """"""
    paths = kwargs.pop('paths', ())
    action = kwargs.pop('action')
    plugin = kwargs.pop('plugin')
    junit_xml = kwargs.pop('junit_xml')
    use_tracked_files = kwargs.pop('use_tracked_files')
    quiet = kwargs.pop('quiet')

    colorama.init(strip=kwargs.pop('no_color'))

    git_dir = current_git_dir()

    if git_dir is None:
        output(NOT_GIT_REPO_MSG)
        exit(1)

    repo_root = os.path.dirname(git_dir)

    files = []
    if paths:
        # We want to look at files in their current state if paths are passed through
        kwargs['include_unstaged_changes'] = True

        # If paths were provided get all the files for each path
        for path in paths:
            for f in list_files(path):
                f = os.path.relpath(f, repo_root)
                if not f.startswith('..'):  # Don't include files outside the repo root.
                    files.append(f)
    elif use_tracked_files:
        # If the use tracked files flag was passed, get a list of all the tracked files
        out, err, code = git.ls_files()
        files = out.splitlines()

        if kwargs.get('include_untracked'):
            out, err, code = git.ls_files(o=True, exclude_standard=True)
            files += out.splitlines()

    if files or paths:
        kwargs['files'] = files

    config = get_config(repo_root)
    runner = Runner(config.cwd, **kwargs)
    results = ResultCollection()

    if runner.unstaged_changes and not quiet:
        output(UNSTAGED_CHANGES_MSG, end='\n\n')

    processes = list(config.actions) + list(config.plugins)
    processes.sort(key=lambda x: x.name)  # Sort the list of processes for consistent results

    if plugin:
        try:
            processes = [config.plugins.get(plugin)]
        except config.plugins.DoesNotExist as e:
            output('{}\nAvailable plugins:'.format(e.message))

            for p in config.plugins:
                output(p.name)
            exit(1)

    if action:
        try:
            processes = [config.actions.get(action)]
        except config.actions.DoesNotExist as e:
            output('{}\nAvailable actions:'.format(e.message))

            for a in config.actions:
                output(a.name)
            exit(1)

    for process in processes:
        result, message = runner.run_process(process)
        results.append(result)

        if not quiet:
            output(message)

    if junit_xml:
        with open(junit_xml, 'w+') as f:
            f.write('{}'.format(results.dump_junit()))

    if not quiet:
        output(results.dump())
        output('#{{bright}}{}\nCompleted in: {}s'.format(''.ljust(79, '-'), round(results.execution_time, 2)))

    if results.has_error:
        exit(1)
    elif results.has_failure:
        exit(2)
1054617
def run():
    """"""
    _parser_options()
    set_verbose(args["verbose"])
    
    if _check_global_settings():
        _load_db()
    else:
        exit(-1)

    #Check the server configuration against the script arguments passed in.
    _setup_server()

    if args["rollback"]:
        _server_rollback()
        okay("The server rollback appears to have been successful.")
        exit(0)

    _server_enable()    
    _list_repos()
    _handle_install()
    
    #This is the workhorse once a successful installation has happened.
    _do_cron()
194081
def run(opts, args):
        '''
        '''
        setup_options(opts)

        mode = Modes.ONCE
        if len(args) > 0 and hasattr(Modes, args[0].upper()):
            _mode = args.pop(0).upper()
            mode = getattr(Modes, _mode)

        url = None
        if len(args) > 0:
            # A url was specified
            url = args.pop(0)

        plugin_mgr = PluginManager.load_plugin_from_addonxml(mode, url)
        plugin_mgr.run()