• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python threadMgr.add函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: on_format_clicked

    def on_format_clicked(self, *args):
        """
        Once the format button is clicked, the option to cancel expires.
        We also need to display the spinner showing activity.
        """
        self._cancel_button.set_sensitive(False)
        self._ok_button.set_sensitive(False)
        self._notebook.set_current_page(1)

        # Format dasds and update the storage.
        threadMgr.add(AnacondaThread(name=constants.THREAD_DASDFMT, target=self.run_format, args=()))
开发者ID:rvykydal,项目名称:anaconda,代码行数:11,代码来源:dasdfmt.py


示例17: on_start_clicked

    def on_start_clicked(self, *args):
        """ Go through the process of validating entry contents and then
            attempt to add the device.
        """
        # First update widgets
        self._startButton.hide()
        self._cancelButton.set_sensitive(False)
        self._okButton.set_sensitive(False)
        self._set_configure_sensitive(False)
        self._conditionNotebook.set_current_page(1)

        # Initialize.
        config_error = None
        device = None
        wwpn = None
        lun = None

        # Get the input.
        device_name = self._deviceEntry.get_text().strip()
        wwpn_name = self._wwpnEntry.get_text().strip()
        lun_name = self._lunEntry.get_text().strip()

        # Check the input.
        if not DASD_DEVICE_NUMBER.match(device_name):
            config_error = "Incorrect format of the given device number."
        elif not ZFCP_WWPN_NUMBER.match(wwpn_name):
            config_error = "Incorrect format of the given WWPN number."
        elif not ZFCP_LUN_NUMBER.match(lun_name):
            config_error = "Incorrect format of the given LUN number."
        else:
            try:
                # Get the full ids.
                device = blockdev.s390.sanitize_dev_input(device_name)
                wwpn = blockdev.s390.zfcp_sanitize_wwpn_input(wwpn_name)
                lun = blockdev.s390.zfcp_sanitize_lun_input(lun_name)
            except (blockdev.S390Error, ValueError) as err:
                config_error = str(err)

        # Process the configuration error.
        if config_error:
            self._errorLabel.set_text(config_error)
            self._conditionNotebook.set_current_page(2)
            self._set_configure_sensitive(True)
            self._cancelButton.set_sensitive(True)
        # Start the discovery.
        else:
            # Discover.
            self._spinner.start()
            threadMgr.add(AnacondaThread(name=constants.THREAD_ZFCP_DISCOVER,
                                         target=self._discover,
                                         args=(device, wwpn, lun)))

            # Periodically call the check till it is done.
            GLib.timeout_add(250, self._check_discover)
开发者ID:jaymzh,项目名称:anaconda,代码行数:54,代码来源:zfcp.py


示例18: on_start_clicked

    def on_start_clicked(self, *args):
        self._conditionNotebook.set_current_page(PAGE_ACTION)

        for widget in [self._startButton, self._cancelButton, self._sectorSizeSpinButton,
                       self._okButton]:
            widget.set_sensitive(False)

        self._reconfigureSpinner.start()

        threadMgr.add(AnacondaThread(name=THREAD_NVDIMM_RECONFIGURE, target=self._reconfigure,
                                     args=(self.namespaces, NVDIMM_MODE_SECTOR, self.sector_size)))
开发者ID:zhangsju,项目名称:anaconda,代码行数:11,代码来源:nvdimm.py


示例19: initialize

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

        # Ask for a default passphrase.
        if flags.automatedInstall and flags.ksprompt:
            self.run_passphrase_dialog()

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

        self._selected_disks = self._disk_select_observer.proxy.SelectedDisks
开发者ID:rvykydal,项目名称:anaconda,代码行数:12,代码来源:storage.py


示例20: on_format_clicked

    def on_format_clicked(self, *args):
        """
        Once the format button is clicked, the option to cancel expires.
        We also need to display the spinner showing activity.
        """
        self._cancel_button.set_sensitive(False)
        self._ok_button.set_sensitive(False)
        self._notebook.set_current_page(1)

        # Loop through all of our unformatted DASDs and format them
        threadMgr.add(AnacondaThread(name=constants.THREAD_DASDFMT,
                                target=self.run_dasdfmt, args=(self._epoch,)))
开发者ID:jaymzh,项目名称:anaconda,代码行数:12,代码来源:dasdfmt.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python threadMgr.add函数代码示例发布时间:2022-05-25
下一篇:
Python simpleconfig.SimpleConfigFile类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap