本文整理汇总了Python中vistrails.core.debug.critical函数的典型用法代码示例。如果您正苦于以下问题:Python critical函数的具体用法?Python critical怎么用?Python critical使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了critical函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: open_workflow
def open_workflow(self, locator):
if isinstance(locator, basestring):
locator = BaseLocator.from_url(locator)
vistrail = Vistrail()
try:
if locator is None:
return False
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?
controller = self.add_vistrail(vistrail, locator)
except VistrailsDBException, e:
import traceback
debug.critical("Exception from the database",
traceback.format_exc())
return None
开发者ID:tacaswell,项目名称:VisTrails,代码行数:27,代码来源:application.py
示例17: add_wf_exec_entity
def add_wf_exec_entity(self, wf_exec, add_to_map=False):
version_id = wf_exec.parent_version
is_new = False
if version_id not in self.wf_entity_map:
is_new = True
# FIXME add new workflow entity for this version
if version_id not in self.vistrail.actionMap:
raise LookupError("Version %d does not occur in vistrail." %
version_id)
action = self.vistrail.actionMap[version_id]
try:
workflow = self.vistrail.getPipeline(version_id)
except:
import traceback
if self.vistrail.has_tag(version_id):
tag_str = self.vistrail.get_tag(version_id)
else:
tag_str = str(version_id)
debug.critical("Failed to construct pipeline '%s'" % tag_str,
traceback.format_exc())
workflow = self.vistrail.getPipeline(0)
wf_entity = self.create_workflow_entity(workflow, action)
self.wf_entity_map[version_id] = wf_entity
else:
wf_entity = self.wf_entity_map[version_id]
entity = self.create_wf_exec_entity(wf_exec, wf_entity)
if add_to_map:
self.wf_exec_entity_map[wf_exec.id] = entity
if is_new:
return (entity, wf_entity)
return (entity, None)
开发者ID:cjh1,项目名称:VisTrails,代码行数:32,代码来源:vistrail.py
示例18: install_default_startupxml_if_needed
def install_default_startupxml_if_needed():
fname = os.path.join(self.temp_configuration.dotVistrails,
'startup.xml')
root_dir = system.vistrails_root_directory()
origin = os.path.join(root_dir, 'core','resources',
'default_vistrails_startup_xml')
def skip():
if os.path.isfile(fname):
try:
d = self.startup_dom()
v = str(d.getElementsByTagName('startup')[0].attributes['version'].value)
return LooseVersion('0.1') <= LooseVersion(v)
except Exception:
return False
else:
return False
if skip():
return
try:
shutil.copyfile(origin, fname)
debug.log('Succeeded!')
except Exception, e:
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.temp_configuration.dotVistrails), e)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:27,代码来源:startup.py
示例19: interpolate
def interpolate(self, ranges, stepCount):
""" interpolate(ranges: tuple, stepCount: int) -> list
This function takes a number of (min,max) or (s1,...sn) to
interpolate exact stepCount number of step. The output will be
a list of stepCount elements where each of them is (a1,...,an).
a{i} is either int or string and n is the number of arguments.
"""
params = []
for r in ranges:
interpolatedValues = []
argumentType = type(r[0])
if argumentType in [int, float]:
for i in xrange(stepCount):
if stepCount>1: t = i/float(stepCount-1)
else: t = 0
interpolatedValues.append(argumentType(r[0]+t*(r[1]-r[0])))
elif argumentType==str:
interpolatedValues = list(r)
else:
debug.critical('Cannot interpolate non-cardinal types')
assert False
params.append(interpolatedValues)
return zip(*params)
开发者ID:cjh1,项目名称:VisTrails,代码行数:25,代码来源:param_explore.py
示例20: add_workflow_entity
def add_workflow_entity(self, version_id):
if version_id not in self.vistrail.actionMap:
return
action = self.vistrail.actionMap[version_id]
tag = None
if self.vistrail.has_tag(version_id):
tag = self.vistrail.get_tag(version_id)
try:
workflow = self.vistrail.getPipeline(version_id)
except:
import traceback
debug.critical("Failed to construct pipeline '%s'" %
(tag if tag else version_id),
traceback.format_exc())
workflow = self.vistrail.getPipeline(0)
if tag:
workflow.name = tag
# if workflow already exists, we want to update it...
# spin through self.children and look for matching
# workflow entity?
# self.children.append(WorkflowEntity(workflow))
self.wf_entity_map[version_id] = \
self.create_workflow_entity(workflow, action)
# get thumbnail
thumbnail = self.vistrail.get_thumbnail(version_id)
if thumbnail is not None:
cache = ThumbnailCache.getInstance()
path = cache.get_abs_name_entry(thumbnail)
if path:
entity = ThumbnailEntity(path)
self.wf_entity_map[action.id].children.append(entity)
entity.parent = self.wf_entity_map[action.id]
return self.wf_entity_map[version_id]
开发者ID:cjh1,项目名称:VisTrails,代码行数:34,代码来源:vistrail.py
注:本文中的vistrails.core.debug.critical函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论