当前位置: 首页>>代码示例>>Python>>正文


Python threadMgr.add函数代码示例

本文整理汇总了Python中pyanaconda.threading.threadMgr.add函数的典型用法代码示例。如果您正苦于以下问题:Python add函数的具体用法?Python add怎么用?Python add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_start_clicked

    def on_start_clicked(self, *args):
        # First, update some widgets to not be usable while discovery happens.
        self._startButton.hide()
        self._cancelButton.set_sensitive(False)
        self._okButton.set_sensitive(False)

        self._conditionNotebook.set_current_page(1)
        self._set_configure_sensitive(False)
        self._initiatorEntry.set_sensitive(False)

        # Now get the node discovery credentials.
        credentials = discoverMap[self._authNotebook.get_current_page()](self.builder)

        discoveredLabelText = _("The following nodes were discovered using the iSCSI initiator "\
                                "<b>%(initiatorName)s</b> using the target IP address "\
                                "<b>%(targetAddress)s</b>.  Please select which nodes you "\
                                "wish to log into:") % \
                                {"initiatorName": escape_markup(credentials.initiator),
                                 "targetAddress": escape_markup(credentials.targetIP)}

        discoveredLabel = self.builder.get_object("discoveredLabel")
        discoveredLabel.set_markup(discoveredLabelText)

        bind = self._bindCheckbox.get_active()

        spinner = self.builder.get_object("waitSpinner")
        spinner.start()

        threadMgr.add(AnacondaThread(name=constants.THREAD_ISCSI_DISCOVER, target=self._discover,
                                     args=(credentials, bind)))
        Timer().timeout_msec(250, self._check_discover)
开发者ID:zhangsju,项目名称:anaconda,代码行数:31,代码来源:iscsi.py

示例2: test_exception_handling

def test_exception_handling():
    """
    Function that can be used for testing exception handling in anaconda. It
    tries to prepare a worst case scenario designed from bugs seen so far.

    """

    # XXX: this is a huge hack, but probably the only way, how we can get
    #      "unique" stack and thus unique hash and new bugreport
    def raise_exception(msg, non_ascii):
        timestamp = str(time.time()).split(".", 1)[0]

        code = """
def f%s(msg, non_ascii):
        raise RuntimeError(msg)

f%s(msg, non_ascii)
""" % (timestamp, timestamp)

        eval(compile(code, "str_eval", "exec"))

    # test non-ascii characters dumping
    non_ascii = u'\u0159'

    msg = "NOTABUG: testing exception handling"

    # raise exception from a separate thread
    from pyanaconda.threading import AnacondaThread
    threadMgr.add(AnacondaThread(name=THREAD_EXCEPTION_HANDLING_TEST,
                                 target=raise_exception,
                                 args=(msg, non_ascii)))
开发者ID:rvykydal,项目名称:anaconda,代码行数:31,代码来源:exception.py

示例3: wait_and_fetch_net_data

def wait_and_fetch_net_data(url, out_file, ca_certs=None):
    """
    Function that waits for network connection and starts a thread that fetches
    data over network.

    :see: org_fedora_oscap.data_fetch.fetch_data
    :return: the name of the thread running fetch_data
    :rtype: str

    """

    # get thread that tries to establish a network connection
    nm_conn_thread = threadMgr.get(constants.THREAD_WAIT_FOR_CONNECTING_NM)
    if nm_conn_thread:
        # NM still connecting, wait for it to finish
        nm_conn_thread.join()

    if not nm.nm_is_connected():
        raise OSCAPaddonNetworkError("Network connection needed to fetch data.")

    fetch_data_thread = AnacondaThread(name=THREAD_FETCH_DATA,
                                       target=fetch_data,
                                       args=(url, out_file, ca_certs),
                                       fatal=False)

    # register and run the thread
    threadMgr.add(fetch_data_thread)

    return THREAD_FETCH_DATA
开发者ID:OpenSCAP,项目名称:oscap-anaconda-addon,代码行数:29,代码来源:common.py

示例4: initialize

 def initialize(self):
     # Start a thread to wait for the payload and run the first, automatic
     # dependency check
     self.initialize_start()
     super(SoftwareSpoke, self).initialize()
     threadMgr.add(AnacondaThread(name=THREAD_SOFTWARE_WATCHER,
                                  target=self._initialize))
开发者ID:jaymzh,项目名称:anaconda,代码行数:7,代码来源:software_selection.py

示例5: on_login_clicked

    def on_login_clicked(self, *args):
        # Make the buttons UI while we work.
        self._okButton.set_sensitive(False)
        self._cancelButton.set_sensitive(False)
        self._loginButton.set_sensitive(False)

        self._loginConditionNotebook.set_current_page(0)
        self._set_login_sensitive(False)

        spinner = self.builder.get_object("loginSpinner")
        spinner.start()
        spinner.set_visible(True)
        spinner.show()

        # Are we reusing the credentials from the discovery step?  If so, grab them
        # out of the UI again here.  They should still be there.
        page = self._loginAuthNotebook.get_current_page()
        if page == 3:
            credentials = discoverMap[self._authNotebook.get_current_page()](self.builder)
        else:
            credentials = loginMap[page](self.builder)

        threadMgr.add(AnacondaThread(name=constants.THREAD_ISCSI_LOGIN, target=self._login,
                                     args=(credentials,)))
        Timer().timeout_msec(250, self._check_login)
开发者ID:zhangsju,项目名称:anaconda,代码行数:25,代码来源:iscsi.py

示例6: _refresh_server_working

    def _refresh_server_working(self, itr):
        """ Runs a new thread with _set_server_ok_nok(itr) as a taget. """

        self._serversStore.set_value(itr, SERVER_WORKING, constants.NTP_SERVER_QUERY)
        threadMgr.add(AnacondaThread(prefix=constants.THREAD_NTP_SERVER_CHECK,
                                     target=self._set_server_ok_nok,
                                     args=(itr, self._epoch)))
开发者ID:zhangsju,项目名称:anaconda,代码行数:7,代码来源:datetime_spoke.py

示例7: initialize

    def initialize(self):
        NormalTUISpoke.initialize(self)
        self.initialize_start()

        threadMgr.add(AnacondaThread(name=THREAD_SOURCE_WATCHER,
                                     target=self._initialize))
        payloadMgr.addListener(payloadMgr.STATE_ERROR, self._payload_error)
开发者ID:zhangsju,项目名称:anaconda,代码行数:7,代码来源:installation_source.py

示例8: restart_thread

    def restart_thread(self, storage, ksdata, payload,
                       fallback=False, checkmount=True, onlyOnChange=False):
        """Start or restart the payload thread.

        This method starts a new thread to restart the payload thread, so
        this method's return is not blocked by waiting on the previous payload
        thread. If there is already a payload thread restart pending, this method
        has no effect.

        :param pyanaconda.storage.InstallerStorage storage: The blivet storage instance
        :param kickstart.AnacondaKSHandler ksdata: The kickstart data instance
        :param payload.Payload payload: The payload instance
        :param bool fallback: Whether to fall back to the default repo in case of error
        :param bool checkmount: Whether to check for valid mounted media
        :param bool onlyOnChange: Restart thread only if existing repositories changed.
                                  This won't restart thread even when a new repository was added!!
        """
        log.debug("Restarting payload thread")

        # If a restart thread is already running, don't start a new one
        if threadMgr.get(THREAD_PAYLOAD_RESTART):
            return

        thread_args = (storage, ksdata, payload, fallback, checkmount, onlyOnChange)
        # Launch a new thread so that this method can return immediately
        threadMgr.add(AnacondaThread(name=THREAD_PAYLOAD_RESTART, target=self._restart_thread,
                                     args=thread_args))
开发者ID:rvykydal,项目名称:anaconda,代码行数:27,代码来源:manager.py

示例9: show_all

    def show_all(self):
        super().show_all()
        from pyanaconda.installation import doInstall, doConfiguration
        from pyanaconda.threading import threadMgr, AnacondaThread

        thread_args = (self.storage, self.payload, self.data, self.instclass)

        threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall, args=thread_args))

        # This will run until we're all done with the install thread.
        self._update_progress()

        threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration, args=thread_args))

        # This will run until we're all done with the configuration thread.
        self._update_progress()

        util.ipmi_report(IPMI_FINISHED)

        if self.instclass.eula_path:
            # Notify user about the EULA (if any).
            print(_("Installation complete"))
            print('')
            print(_("Use of this product is subject to the license agreement found at:"))
            print(self.instclass.eula_path)
            print('')

        # kickstart install, continue automatically if reboot or shutdown selected
        if flags.automatedInstall and self.data.reboot.action in [KS_REBOOT, KS_SHUTDOWN]:
            # Just pretend like we got input, and our input doesn't care
            # what it gets, it just quits.
            raise ExitMainLoop()
开发者ID:zhangsju,项目名称:anaconda,代码行数:32,代码来源:installation_progress.py

示例10: _apply

    def _apply(self):
        # Environment needs to be set during a GUI installation, but is not required
        # for a kickstart install (even partial)
        if not self.environment:
            log.debug("Environment is not set, skip user packages settings")
            return

        # NOTE: This block is skipped for kickstart where addons and _origAddons will
        # both be [], preventing it from wiping out the kickstart's package selection
        addons = self._get_selected_addons()
        if not self._kickstarted and set(addons) != set(self._origAddons):
            self._selectFlag = False
            self.payload.data.packages.packageList = []
            self.payload.data.packages.groupList = []
            self.payload.selectEnvironment(self.environment)
            log.debug("Environment selected for installation: %s", self.environment)
            log.debug("Groups selected for installation: %s", addons)
            for group in addons:
                self.payload.selectGroup(group)

            # And then save these values so we can check next time.
            self._origAddons = addons
            self._origEnvironment = self.environment

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_not_ready("SourceSpoke")
        threadMgr.add(AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE,
                                     target=self.checkSoftwareSelection))
开发者ID:zhangsju,项目名称:anaconda,代码行数:28,代码来源:software_selection.py

示例11: initialize

    def initialize(self):
        NormalTUISpoke.initialize(self)
        self.initialize_start()

        threadMgr.add(AnacondaThread(name=THREAD_STORAGE_WATCHER,
                                     target=self._initialize))

        self.selected_disks = self.data.ignoredisk.onlyuse[:]
开发者ID:jaymzh,项目名称:anaconda,代码行数:8,代码来源:storage.py

示例12: _restart_thread

    def _restart_thread(self, storage, ksdata, payload, fallback, checkmount, onlyOnChange):
        # Wait for the old thread to finish
        threadMgr.wait(THREAD_PAYLOAD)

        thread_args = (storage, ksdata, payload, fallback, checkmount, onlyOnChange)
        # Start a new payload thread
        threadMgr.add(AnacondaThread(name=THREAD_PAYLOAD, target=self._run_thread,
                                     args=thread_args))
开发者ID:rvykydal,项目名称:anaconda,代码行数:8,代码来源:manager.py

示例13: initialize

    def initialize(self):
        super().initialize()
        self.initialize_start()


        # set X keyboard defaults
        # - this needs to be done early in spoke initialization so that
        #   the spoke status does not show outdated keyboard selection
        keyboard.set_x_keyboard_defaults(self._l12_module.proxy, self._xkl_wrapper)

        # make sure the x_layouts list has at least one keyboard layout
        if not self._l12_module.proxy.XLayouts:
            self._l12_module.proxy.SetXLayouts([DEFAULT_KEYBOARD])

        self._add_dialog = AddLayoutDialog(self.data)
        self._add_dialog.initialize()

        if conf.system.can_configure_keyboard:
            self.builder.get_object("warningBox").hide()

        # We want to store layouts' names but show layouts as
        # 'language (description)'.
        layoutColumn = self.builder.get_object("layoutColumn")
        layoutRenderer = self.builder.get_object("layoutRenderer")
        override_cell_property(layoutColumn, layoutRenderer, "text", _show_layout,
                                            self._xkl_wrapper)

        self._store = self.builder.get_object("addedLayoutStore")
        self._add_data_layouts()

        self._selection = self.builder.get_object("layoutSelection")

        self._switching_dialog = ConfigureSwitchingDialog(self.data, self._l12_module)
        self._switching_dialog.initialize()

        self._layoutSwitchLabel = self.builder.get_object("layoutSwitchLabel")

        if not conf.system.can_configure_keyboard:
            # Disable area for testing layouts as we cannot make
            # it work without modifying runtime system

            widgets = [self.builder.get_object("testingLabel"),
                       self.builder.get_object("testingWindow"),
                       self.builder.get_object("layoutSwitchLabel")]

            # Use testingLabel's text to explain why this part is not
            # sensitive.
            widgets[0].set_text(_("Testing layouts configuration not "
                                  "available."))

            for widget in widgets:
                widget.set_sensitive(False)

        hubQ.send_not_ready(self.__class__.__name__)
        hubQ.send_message(self.__class__.__name__,
                          _("Getting list of layouts..."))
        threadMgr.add(AnacondaThread(name=THREAD_KEYBOARD_INIT,
                                     target=self._wait_ready))
开发者ID:rvykydal,项目名称:anaconda,代码行数:58,代码来源:keyboard.py

示例14: _check_ntp_servers_async

    def _check_ntp_servers_async(self, servers):
        """Asynchronously check if given NTP servers appear to be working.

        :param list servers: list of servers to check
        """
        for server in servers:
            threadMgr.add(AnacondaThread(prefix=constants.THREAD_NTP_SERVER_CHECK,
                                         target=self._check_ntp_server,
                                         args=(server,)))
开发者ID:rvykydal,项目名称:anaconda,代码行数:9,代码来源:time_spoke.py

示例15: refresh

    def refresh(self):
        from pyanaconda.installation import doInstall
        from pyanaconda.threading import threadMgr, AnacondaThread

        super().refresh()

        self._start_ransom_notes()
        self._update_progress_timer.timeout_msec(250, self._update_progress, self._install_done)
        threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall,
                                     args=(self.storage, self.payload, self.data)))
开发者ID:rvykydal,项目名称:anaconda,代码行数:10,代码来源:progress.py


注:本文中的pyanaconda.threading.threadMgr.add函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。