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


Python debug.critical函数代码示例

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


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

示例1: reload_scripts

def reload_scripts():
    remove_all_scripts()
    if "CLTools" == identifiers.name:
        # this is the original package
        location = os.path.join(vistrails.core.system.current_dot_vistrails(),
                                "CLTools")
        # make sure dir exist
        if not os.path.isdir(location):
            try:
                debug.log("Creating CLTools directory...")
                os.mkdir(location)
            except:
                debug.critical("""Could not create CLTools directory. Make
 sure '%s' does not exist and parent directory is writable""" % location)
                sys.exit(1)
    else:
        # this is a standalone package so modules are placed in this directory
        location = os.path.dirname(__file__)
    
    for path in os.listdir(location):
        if path.endswith(SUFFIX):
            try:
                add_tool(os.path.join(location, path))
            except Exception as exc:
                import traceback
                debug.critical("Package CLTools failed to create module "
                   "from '%s': %s" % (os.path.join(location, path), exc),
                   traceback.format_exc())

    from vistrails.core.interpreter.cached import CachedInterpreter
    CachedInterpreter.clear_package(identifiers.identifier)

    from vistrails.gui.vistrails_window import _app
    _app.invalidate_pipelines()
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:34,代码来源:init.py

示例2: updateCells

 def updateCells(self, info=None):
     # check if we should create a sequence
     if self.cb_loop_sequence.isChecked():
         return self.updateCellsLoop(info)
     self.is_executing = True
     (cellEvents, errors) = self.runAndGetCellEvents()
     if errors is True:
         debug.critical("Mashup job is still running. Run again to check "
                       "if it has completed.")
     self.is_executing = False
     if self.numberOfCells is not None and len(cellEvents) != self.numberOfCells:
         raise RuntimeError(
                 "The number of cells has changed (unexpectedly) "
                 "(%d vs. %d)!\n"
                 "Pipeline results: %s" % (len(cellEvents),
                                           self.numberOfCells,
                                           errors))
     elif self.numberOfCells is None and not errors:
         self.numberOfCells = len(cellEvents)
         if cellEvents:
             self.initCells(cellEvents)
     #self.SaveCamera()
     for i in xrange(self.numberOfCells):
         camera = []
         if (hasattr(self.cellWidgets[i],"getRendererList") and
             self.cb_keep_camera.isChecked()):
             for ren in self.cellWidgets[i].getRendererList():
                 camera.append(ren.GetActiveCamera())
             self.cellWidgets[i].updateContents(cellEvents[i].inputPorts, camera)
             #self.cellWidgets[i].updateContents(cellEvents[i].inputPorts)
         else:
             self.cellWidgets[i].updateContents(cellEvents[i].inputPorts)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:32,代码来源:mashup_app.py

示例3: initialize

def initialize(*args, **keywords):
    if "CLTools" == identifiers.name:
        # this is the original package 
        location = os.path.join(vistrails.core.system.current_dot_vistrails(),
                                "CLTools")
        # make sure dir exist
        if not os.path.isdir(location):
            try:
                debug.log("Creating CLTools directory...")
                os.mkdir(location)
            except:
                debug.critical("""Could not create CLTools directory. Make
 sure '%s' does not exist and parent directory is writable""" % location)
                sys.exit(1)
    else:
        # this is a standalone package so modules are placed in this directory
        location = os.path.dirname(__file__)
    

    reg = vistrails.core.modules.module_registry.get_module_registry()
    reg.add_module(CLTools, abstract=True)
    for path in os.listdir(location):
        if path.endswith(SUFFIX):
            try:
                add_tool(os.path.join(location, path))
            except Exception as exc:
                import traceback
                debug.critical("Package CLTools failed to create module "
                   "from '%s': %s" % (os.path.join(location, path), exc),
                   traceback.format_exc())
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:30,代码来源:init.py

示例4: save_vistrail

    def save_vistrail(self, locator_class,
                      vistrailView=None,
                      force_choose_locator=False):
        """

        force_choose_locator=True triggers 'save as' behavior
        """
        global bobo

        if not vistrailView:
            vistrailView = self.currentWidget()
        vistrailView.flush_changes()
        if vistrailView:
            gui_get = locator_class.save_from_gui
            # get a locator to write to
            if force_choose_locator:
                locator = gui_get(self, Vistrail.vtType,
                                  vistrailView.controller.locator)
            else:
                locator = (vistrailView.controller.locator or
                           gui_get(self, Vistrail.vtType,
                                   vistrailView.controller.locator))
            if locator == untitled_locator():
                locator = gui_get(self, Vistrail.vtType,
                                  vistrailView.controller.locator)
            # if couldn't get one, ignore the request
            if not locator:
                return False
            # update collection
            vistrailView.controller.flush_delayed_actions()
            try:
                vistrailView.controller.write_vistrail(locator)
            except Exception, e:
                debug.critical('An error has occurred', str(e))
                raise
                return False
            try:
                thumb_cache = ThumbnailCache.getInstance()
                vistrailView.controller.vistrail.thumbnails = \
                    vistrailView.controller.find_thumbnails(
                        tags_only=thumb_cache.conf.tagsOnly)
                vistrailView.controller.vistrail.abstractions = \
                    vistrailView.controller.find_abstractions(
                        vistrailView.controller.vistrail, True)

                collection = Collection.getInstance()
                url = locator.to_url()
                # create index if not exist
                entity = collection.fromUrl(url)
                if entity:
                    # find parent vistrail
                    while entity.parent:
                        entity = entity.parent 
                else:
                    entity = collection.updateVistrail(url, vistrailView.controller.vistrail)
                # add to relevant workspace categories
                collection.add_to_workspace(entity)
                collection.commit()
            except Exception, e:
                debug.critical('Failed to index vistrail', str(e))
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:60,代码来源:view_manager.py

示例5: createPackage

    def createPackage(self):
        reg = vistrails.core.modules.module_registry.get_module_registry()
        if self.signature in reg.packages:
            reg.remove_package(reg.packages[self.signature])

        # create a document hash integer from the cached sax tree
        # "name" is what suds use as the cache key
        name = '%s-%s' % (abs(hash(self.address)), "wsdl")
        wsdl = package_cache.get(name)
        if not wsdl:
            debug.critical("File not found in SUDS cache: '%s'" % name)
            self.wsdlHash = '0'
            return
        self.wsdlHash = str(int(hashlib.md5(str(wsdl.root)).hexdigest(), 16))

        package_id = reg.idScope.getNewId(Package.vtType)
        package = Package(id=package_id,
                          load_configuration=False,
                          name="SUDS#" + self.address,
                          identifier=self.signature,
                          version=self.wsdlHash,
                          )
        suds_package = reg.get_package_by_name(identifier)
        package._module = suds_package.module
        package._init_module = suds_package.init_module
        
        self.package = package
        reg.add_package(package)
        reg.signals.emit_new_package(self.signature)

        self.module = new_module(Module, str(self.signature))
        reg.add_module(self.module, **{'package':self.signature,
                                       'package_version':self.wsdlHash,
                                       'abstract':True})
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:34,代码来源:init.py

示例6: updateContents

 def updateContents(self, conn_id=-1):
     """updateContents(connection_id: int) -> None
     Reloads vistrails from the given connection
     
     """
     self.clear()
     if conn_id != -1:
         parent = self.parent()
         try:
             objs = parent.connectionList.getDBObjectList(int(conn_id),
                                                          self.obj_type)
             
             for (id,obj,date) in objs:
                 item = QDBObjectListItem(CurrentTheme.FILE_ICON,
                                          int(id),
                                          str(obj),
                                          str(date))
                 self.addItem(item)
         except VistrailsDBException, e:
             #show connection setup
             error = str(e)
             if "Couldn't get list of vistrails objects" in error:
                 debug.critical('An error has occurred', error)
                 raise e
             config = parent.connectionList.getConnectionInfo(int(conn_id))
             if config != None:
                 config["create"] = False
                 if not parent.showConnConfig(**config):
                     raise e
             else:
                 raise e
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:31,代码来源:open_db_window.py

示例7: import_user_packages_module

    def import_user_packages_module(self):
        """Imports the 'userspackages' package.

        This will need to manipulate the Python path to find it.
        """
        if self._userpackages is not None:
            return self._userpackages
        # Imports user packages directory
        old_sys_path = copy.copy(sys.path)
        userPackageDir = system.get_vistrails_directory('userPackageDir')
        if userPackageDir is not None:
            sys.path.insert(0, os.path.join(userPackageDir, os.path.pardir))
            try:
                import userpackages
            except ImportError:
                debug.critical('ImportError: "userpackages" sys.path: %s' %
                               sys.path)
                raise
            finally:
                sys.path = old_sys_path
            os.environ['VISTRAILS_USERPACKAGES_DIR'] = userPackageDir
            self._userpackages = userpackages
            return userpackages
        # possible that we don't have userPackageDir set!
        return None
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:25,代码来源:packagemanager.py

示例8: reload_scripts

def reload_scripts(initial=False, name=None):
    reg = vistrails.core.modules.module_registry.get_module_registry()
    if not initial:
        from vistrails.core.interpreter.cached import CachedInterpreter
        CachedInterpreter.clear_package(identifiers.identifier)

        if name is None:
            remove_all_scripts()
        else:
            del cl_tools[name]
            reg.delete_module(identifiers.identifier, name)

    if "CLTools" == identifiers.name:
        # this is the original package
        location = os.path.join(vistrails.core.system.current_dot_vistrails(),
                                "CLTools")
        # make sure dir exist
        if not os.path.isdir(location): # pragma: no cover # pragma: no branch
            try:
                debug.log("Creating CLTools directory...")
                os.mkdir(location)
            except Exception, e:
                debug.critical("Could not create CLTools directory. Make "
                               "sure '%s' does not exist and parent directory "
                               "is writable" % location,
                               e)
                sys.exit(1)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:27,代码来源:init.py

示例9: save_as

 def save_as(self, save_bundle, version=None):
     save_bundle = _DBLocator.save(self, save_bundle, True, version)
     for obj in save_bundle.get_db_objs():
         klass = self.get_convert_klass(obj.vtType)
         klass.convert(obj)
         obj.locator = self
     # Need to copy images into thumbnail cache directory so references
     # won't become invalid if they are in a temp dir that gets destroyed
     # when the previous locator is closed
     import shutil
     thumb_cache = ThumbnailCache.getInstance()
     thumb_cache_dir = thumb_cache.get_directory()
     new_thumbnails = []
     for thumbnail in save_bundle.thumbnails:
         if os.path.dirname(thumbnail) == thumb_cache_dir:
             new_thumbnails.append(thumbnail)
         else:
             cachedir_thumbnail = os.path.join(thumb_cache_dir, os.path.basename(thumbnail))
             try:
                 shutil.copyfile(thumbnail, cachedir_thumbnail)
                 new_thumbnails.append(cachedir_thumbnail)
             except Exception, e:
                 debug.critical("copying %s -> %s failed" % (
                                thumbnail, cachedir_thumbnail),
                                e)
开发者ID:hjanime,项目名称:VisTrails,代码行数:25,代码来源:locator.py

示例10: open_workflow

    def open_workflow(self, locator):
        if isinstance(locator, basestring):
            locator = BaseLocator.from_url(locator)

        new_locator = UntitledLocator()
        controller = self.open_vistrail(new_locator)
        try:
            if locator is None:
                return False
            workflow = locator.load(Pipeline)
            action_list = []
            for module in workflow.module_list:
                action_list.append(('add', module))
            for connection in workflow.connection_list:
                action_list.append(('add', connection))
            action = vistrails.core.db.action.create_action(action_list)
            controller.add_new_action(action)
            controller.perform_action(action)
            controller.vistrail.set_tag(action.id, "Imported workflow")
            controller.change_selected_version(action.id)
        except VistrailsDBException:
            debug.critical("Exception from the database",
                           traceback.format_exc())
            return None

        controller.select_latest_version()
        controller.set_changed(True)
        return controller
开发者ID:sameera2004,项目名称:VisTrails,代码行数:28,代码来源:application.py

示例11: __init__

    def __init__(self, address):
        """ Process WSDL and add all Types and Methods
        """
        self.address = address
        self.signature = toSignature(self.address)
        self.wsdlHash = '-1'
        self.modules = []
        self.package = None
        debug.log("Installing Web Service from WSDL: %s"% address)

        options = dict(cachingpolicy=1, cache=package_cache)
        
        proxy_types = ['http']
        for t in proxy_types:
            key = 'proxy_%s'%t
            if configuration.check(key):
                proxy = getattr(configuration, key)
                debug.log("Using proxy: %s" % proxy)
                if len(proxy):
                    options['proxy'] = {t:proxy}
        try:
            self.service = suds.client.Client(address, **options)
            self.backUpCache()
        except Exception, e:
            self.service = None
            # We may be offline and the cache may have expired,
            # try to use backup
            if self.restoreFromBackup():
                try:
                    self.service = suds.client.Client(address, **options)
                except Exception, e:
                    self.service = None
                    debug.critical("Could not load WSDL: %s" % address,
                           str(e) + '\n' + str(traceback.format_exc()))
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:34,代码来源:init.py

示例12: create_startupxml_if_needed

    def create_startupxml_if_needed(self):
        needs_create = True
        fname = self.get_startup_xml_fname()
        if os.path.isfile(fname):
            try:
                tree = ElementTree.parse(fname)
                startup_version = \
                    vistrails.db.services.io.get_version_for_xml(tree.getroot())
                version_list = version_string_to_list(startup_version)
                if version_list >= [0,1]:
                    needs_create = False
            except:
                debug.warning("Unable to read startup.xml file, "
                              "creating a new one")

        if needs_create:
            root_dir = system.vistrails_root_directory()
            origin = os.path.join(root_dir, 'core','resources',
                                  'default_vistrails_startup_xml')
            try:
                shutil.copyfile(origin, fname)
                debug.log('Succeeded!')
                self.first_run = True
            except:
                debug.critical("""Failed to copy default configuration
                file to %s. This could be an indication of a
                permissions problem. Please make sure '%s' is writable."""
                               % (fname, self._dot_vistrails))
                raise
开发者ID:alexmavr,项目名称:VisTrails,代码行数:29,代码来源:startup.py

示例13: initialize_packages

    def initialize_packages(self, prefix_dictionary={},
                            report_missing_dependencies=True):
        """initialize_packages(prefix_dictionary={}): None

        Initializes all installed packages. If prefix_dictionary is
        not {}, then it should be a dictionary from package names to
        the prefix such that prefix + package_name is a valid python
        import."""

        failed = []
        # import the modules
        app = get_vistrails_application()
        for package in self._package_list.itervalues():
            # print '+ initializing', package.codepath, id(package)
            if package.initialized():
                # print '- already initialized'
                continue
            try:
                prefix = prefix_dictionary.get(package.codepath)
                if prefix is None:
                    prefix = self._default_prefix_dict.get(package.codepath)
                package.load(prefix)
            except Package.LoadFailed, e:
                debug.critical("Package %s failed to load and will be "
                               "disabled" % package.name, e)
                # We disable the package manually to skip over things
                # we know will not be necessary - the only thing needed is
                # the reference in the package list
                self._startup.set_package_to_disabled(package.codepath)
                failed.append(package)
            except MissingRequirement, e:
                debug.critical("Package <codepath %s> is missing a "
                               "requirement: %s" % (
                                   package.codepath, e.requirement),
                               e)
开发者ID:Nikea,项目名称:VisTrails,代码行数:35,代码来源:packagemanager.py

示例14: import_user_packages_module

    def import_user_packages_module(self):
        """Imports the packages module using path trickery to find it
        in the right place.

        """
        if self._userpackages is not None:
            return self._userpackages
        # Imports user packages directory
        conf = self._startup.temp_configuration
        old_sys_path = copy.copy(sys.path)
        userPackageDir = system.get_vistrails_directory('userPackageDir')
        if userPackageDir is not None:
            sys.path.insert(0, os.path.join(userPackageDir, os.path.pardir))
            try:
                import userpackages
            except ImportError:
                debug.critical('ImportError: "userpackages" sys.path: %s' % 
                               sys.path)
                raise
            finally:
                sys.path = old_sys_path
            os.environ['VISTRAILS_USERPACKAGES_DIR'] = userPackageDir
            self._userpackages = userpackages
            return userpackages
        # possible that we don't have userPackageDir set!
        return None
开发者ID:Nikea,项目名称:VisTrails,代码行数:26,代码来源:packagemanager.py

示例15: open_workflow

    def open_workflow(self, locator, version=None):
        self.close_first_vistrail_if_necessary()
        if self.single_document_mode and self.currentView():
            self.closeVistrail()

        vistrail = Vistrail()
        try:
            if locator is not None:
                workflow = locator.load(Pipeline)
                action_list = []
                for module in workflow.module_list:
                    action_list.append(('add', module))
                for connection in workflow.connection_list:
                    action_list.append(('add', connection))
                action = vistrails.core.db.action.create_action(action_list)
                vistrail.add_action(action, 0L)
                vistrail.update_id_scope()
                vistrail.addTag("Imported workflow", action.id)
                # FIXME might need different locator?
        except ModuleRegistryException, e:
            msg = ('Cannot find module "%s" in package "%s". '
                    'Make sure package is ' 
                   'enabled in the Preferences dialog.' % \
                       (e._name, e._identifier))
            debug.critical(msg)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:25,代码来源:view_manager.py


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