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


Python threadMgr.add函数代码示例

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


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

示例1: 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.threads import AnacondaThread

    threadMgr.add(AnacondaThread(name=THREAD_EXCEPTION_HANDLING_TEST, target=raise_exception, args=(msg, non_ascii)))
开发者ID:josefbacik,项目名称:anaconda,代码行数:33,代码来源:exception.py

示例2: _fetch_data_and_initialize

    def _fetch_data_and_initialize(self):
        """Fetch data from a specified URL and initialize everything."""

        with self._fetch_flag_lock:
            if self._fetching:
                # prevent multiple fetches running simultaneously
                return
            self._fetching = True

        thread_name = None
        if any(self._addon_data.content_url.startswith(net_prefix)
               for net_prefix in data_fetch.NET_URL_PREFIXES):
            # need to fetch data over network
            thread_name = common.wait_and_fetch_net_data(
                                     self._addon_data.content_url,
                                     self._addon_data.raw_preinst_content_path,
                                     self._addon_data.certificates)

        # pylint: disable-msg=E1101
        hubQ.send_message(self.__class__.__name__,
                          _("Fetching content data"))
        # pylint: disable-msg=E1101
        hubQ.send_not_ready(self.__class__.__name__)
        threadMgr.add(AnacondaThread(name="OSCAPguiWaitForDataFetchThread",
                                     target=self._init_after_data_fetch,
                                     args=(thread_name,)))
开发者ID:M4rtinK,项目名称:oscap-anaconda-addon,代码行数:26,代码来源:oscap.py

示例3: _apply

    def _apply(self):
        if not self.environment:
            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 set(addons) != set(self._origAddons):
            for group in addons:
                if group not in self.selectedGroups:
                    self.selectedGroups.append(group)

            self._selectFlag = False
            self.payload.data.packages.packageList = []
            self.payload.data.packages.groupList = []
            self.payload.selectEnvironment(self.environment)
            for group in self.selectedGroups:
                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:dougsland,项目名称:anaconda,代码行数:27,代码来源:software.py

示例4: __init__

    def __init__(self, *args, **kwargs):
        StorageChecker.__init__(self)
        NormalSpoke.__init__(self, *args, **kwargs)
        self.applyOnSkip = True

        self._ready = False
        self.autoPartType = None
        self.encrypted = False
        self.passphrase = ""
        self.selected_disks = self.data.ignoredisk.onlyuse[:]

        # This list contains all possible disks that can be included in the install.
        # All types of advanced disks should be set up for us ahead of time, so
        # there should be no need to modify this list.
        self.disks = []

        if not flags.automatedInstall:
            # default to using autopart for interactive installs
            self.data.autopart.autopart = True

        self.autopart = self.data.autopart.autopart
        self.autoPartType = None
        self.clearPartType = CLEARPART_TYPE_NONE

        if self.data.zerombr.zerombr and arch.isS390():
            # run dasdfmt on any unformatted DASDs automatically
            threadMgr.add(AnacondaThread(name=constants.THREAD_DASDFMT,
                            target=self.run_dasdfmt))

        self._previous_autopart = False

        self._last_clicked_overview = None
        self._cur_clicked_overview = None

        self._grabObjects()
开发者ID:akozumpl,项目名称:anaconda,代码行数:35,代码来源:storage.py

示例5: 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:dougsland,项目名称:anaconda,代码行数:7,代码来源:software.py

示例6: _apply

    def _apply(self):
        env = self._get_selected_environment()
        if not env:
            return

        addons = self._get_selected_addons()
        for group in addons:
            if group not in self.selectedGroups:
                self.selectedGroups.append(group)

        self._selectFlag = False
        self.payload.data.packages.groupList = []
        self.payload.selectEnvironment(env)
        self.environment = env
        for group in self.selectedGroups:
            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:pombreda,项目名称:anaconda,代码行数:25,代码来源:software.py

示例7: 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,)))
        GLib.timeout_add(250, self._check_login)
开发者ID:mairin,项目名称:anaconda,代码行数:25,代码来源:iscsi.py

示例8: _apply

    def _apply(self):
        env = self._get_selected_environment()

        # Check if a kickstart install still looks like a kickstart install
        # If an environment is selected and either the environment or the
        # addon list does not match the ksdata, the packages were
        # selected interactively.
        if env and self._kickstarted:
            if env != self.data.packages.environment or \
                    set(self.selectedGroups) != set(self.data.packages.groupList):
                self._kickstarted = False

        # Not a kickstart with packages, setup the environment and groups
        if env and not self._kickstarted:
            addons = self._get_selected_addons()
            for group in addons:
                if group not in self.selectedGroups:
                    self.selectedGroups.append(group)

            self._selectFlag = False
            self.payload.data.packages.packageList = []
            self.payload.data.packages.groupList = []
            self.payload.selectEnvironment(env)
            self.environment = env
            for group in self.selectedGroups:
                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:KosiehBarter,项目名称:anaconda,代码行数:35,代码来源:software.py

示例9: restartThread

    def restartThread(self, storage, ksdata, payload, instClass, fallback=False, checkmount=True):
        """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 blivet.Blivet storage: The blivet storage instance
           :param kickstart.AnacondaKSHandler ksdata: The kickstart data instance
           :param packaging.Payload payload: The payload instance
           :param installclass.BaseInstallClass instClass: The install class 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
        """

        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

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

示例10: initialize

    def initialize(self):
        from pyanaconda.ui.gui.utils import setViewportBackground

        NormalSpoke.initialize(self)

        # Wouldn't it be nice if glade knew how to do this?
        label = self.builder.get_object("summary_button").get_children()[0]
        markup = "<span foreground='blue'><u>%s</u></span>" % label.get_text()
        label.set_use_markup(True)
        label.set_markup(markup)

        specializedButton = self.builder.get_object("addSpecializedButton")

        # It's uh... uh... it's down there somewhere, let me take another look.
        label = specializedButton.get_children()[0].get_children()[0].get_children()[1]
        markup = "<span size='large'><b>%s</b></span>" % label.get_text()
        label.set_use_markup(True)
        label.set_markup(markup)
        specializedButton.show_all()

        self.local_disks_box = self.builder.get_object("local_disks_box")
        self.specialized_disks_box = self.builder.get_object("specialized_disks_box")

        threadMgr.add(AnacondaThread(name=constants.THREAD_STORAGE_WATCHER,
                      target=self._initialize))
开发者ID:cs2c-zhangchao,项目名称:nkwin1.0-anaconda,代码行数:25,代码来源:storage.py

示例11: 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)))
        GLib.timeout_add(250, self._check_discover)
开发者ID:mairin,项目名称:anaconda,代码行数:31,代码来源:iscsi.py

示例12: 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)

        discoveredLabel = self.builder.get_object("discoveredLabel")
        discoveredLabel.set_markup(discoveredLabel.get_label() % {"initiatorName": credentials.initiator,
                                                                  "targetAddress": credentials.targetIP})

        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)))
        GLib.timeout_add(250, self._check_discover)
开发者ID:Sabayon,项目名称:anaconda,代码行数:25,代码来源:iscsi.py

示例13: _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, 1, SERVER_QUERY)
        threadMgr.add(AnacondaThread(prefix="AnaNTPserver",
                                     target=self._set_server_ok_nok,
                                     args=(itr, self._epoch)))
开发者ID:akozumpl,项目名称:anaconda,代码行数:7,代码来源:datetime_spoke.py

示例14: execute

    def execute(self):
        # Spawn storage execution as a separate thread so there's no big delay
        # going back from this spoke to the hub while StorageChecker.run runs.
        # Yes, this means there's a thread spawning another thread.  Sorry.
        threadMgr.add(AnacondaThread(name=constants.THREAD_EXECUTE_STORAGE,
                                     target=self._doExecute))

        # Register iSCSI to kickstart data
        iscsi_devices = []
        # Find all selected disks and add all iscsi disks to iscsi_devices list
        for d in [d for d in getDisks(self.storage.devicetree) if d.name in self.selected_disks]:
            # Get parents of a multipath devices
            if isinstance(d, MultipathDevice):
                for parent_dev in d.parents:
                    if isinstance(parent_dev, iScsiDiskDevice) and not parent_dev.ibft:
                        iscsi_devices.append(parent_dev)
            # Add no-ibft iScsiDiskDevice. IBFT disks are added automatically so there is
            # no need to have them in KS.
            elif isinstance(d, iScsiDiskDevice) and not d.ibft:
                iscsi_devices.append(d)

        if iscsi_devices:
            self.data.iscsiname.iscsiname = self.storage.iscsi.initiator
            # Remove the old iscsi data information and generate new one
            self.data.iscsi.iscsi = []
            for device in iscsi_devices:
                iscsi_data = self._create_iscsi_data(device)
                for saved_iscsi in self.data.iscsi.iscsi:
                    if (iscsi_data.ipaddr == saved_iscsi.ipaddr and
                        iscsi_data.target == saved_iscsi.target and
                        iscsi_data.port == saved_iscsi.port):
                        break
                else:
                    self.data.iscsi.iscsi.append(iscsi_data)
开发者ID:evol262,项目名称:anaconda,代码行数:34,代码来源:storage.py

示例15: initialize

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

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

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


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