本文整理汇总了Python中vistrails.core.debug.unexpected_exception函数的典型用法代码示例。如果您正苦于以下问题:Python unexpected_exception函数的具体用法?Python unexpected_exception怎么用?Python unexpected_exception使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unexpected_exception函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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 as e:
debug.unexpected_exception(e)
debug.critical("Exception from the database: %s" % e,
debug.format_exc())
return None
controller.select_latest_version()
controller.set_changed(True)
return controller
示例2: get_wsdl_from_namespace
def get_wsdl_from_namespace(m_namespace):
try:
wsdl = m_namespace.split("|")
return wsdl[0]
except Exception, e:
debug.unexpected_exception(e)
return None
示例3: compute
def compute(self):
# create dict of inputs
cacheable = False
if self.has_input('cacheable'):
cacheable = self.get_input('cacheable')
self.is_cacheable = lambda *args, **kwargs: cacheable
params = {}
mname = self.wsmethod.qname[0]
for name in self.wsmethod.inputs:
name = str(name)
if self.has_input(name):
params[name] = self.get_input(name)
if params[name].__class__.__name__ == 'UberClass':
params[name] = params[name].value
params[name] = self.service.makeDictType(params[name])
try:
#import logging
#logging.basicConfig(level=logging.INFO)
#logging.getLogger('suds.client').setLevel(logging.DEBUG)
#print "params:", str(params)[:400]
#self.service.service.set_options(retxml = True)
#result = getattr(self.service.service.service, mname)(**params)
#print "result:", str(result)[:400]
#self.service.service.set_options(retxml = False)
result = getattr(self.service.service.service, mname)(**params)
except Exception, e:
debug.unexpected_exception(e)
raise ModuleError(self, "Error invoking method %s: %s" % (
mname, debug.format_exception(e)))
示例4: _convert_version
def _convert_version(self, version):
if isinstance(version, basestring):
try:
version = \
self.controller.vistrail.get_version_number(version)
except Exception, e:
debug.unexpected_exception(e)
raise ValueError('Cannot locate version "%s"' % version)
示例5: convert_version
def convert_version(self, version):
if isinstance(version, basestring):
try:
version = \
self.get_controller().vistrail.get_version_number(version)
except Exception, e:
debug.unexpected_exception(e)
version = None
示例6: get_used_packages
def get_used_packages(self):
package_list = {}
for action in self.actions:
for op in action.operations:
try:
if isinstance(op, AddOp) and op.what == 'module':
package_list[op.data.package] = op.data.package
except AttributeError, e:
debug.unexpected_exception(e)
示例7: evaluate
def evaluate(i):
try:
v = d['value'](i)
if v is None:
return module.default_value
return v
except Exception, e:
debug.unexpected_exception(e)
return debug.format_exception(e)
示例8: saveVistrailFileHook
def saveVistrailFileHook(self, vistrail, tmp_dir):
if hasattr(self._init_module, 'saveVistrailFileHook'):
try:
self._init_module.saveVistrailFileHook(vistrail, tmp_dir)
except Exception, e:
debug.unexpected_exception(e)
debug.critical("Got exception in %s's saveVistrailFileHook(): "
"%s\n%s" % (self.name,
debug.format_exception(e),
traceback.format_exc()))
示例9: send_notification
def send_notification(self, notification_id, *args):
# do global notifications
if notification_id in self.notifications:
# print 'global notification ', notification_id
for m in self.notifications[notification_id]:
try:
#print " m: ", m
m(*args)
except Exception, e:
debug.unexpected_exception(e)
traceback.print_exc()
示例10: runAndGetCellEvents
def runAndGetCellEvents(self, useDefaultValues=False):
spreadsheetController.setEchoMode(True)
# will run to get Spreadsheet Cell events
cellEvents = []
errors = []
try:
(res, errors) = self.run(useDefaultValues)
if res:
cellEvents = spreadsheetController.getEchoCellEvents()
except Exception, e:
debug.unexpected_exception(e)
print "Executing pipeline failed:", debug.format_exc()
示例11: menu_items
def menu_items(self):
try:
callable_ = self._module.menu_items
except AttributeError:
return None
else:
try:
return callable_()
except Exception, e:
debug.unexpected_exception(e)
debug.critical("Couldn't load menu items for %s: %s\n%s" % (
self.name, debug.format_exception(e),
traceback.format_exc()))
示例12: can_handle_vt_file
def can_handle_vt_file(self, name):
""" Asks package if it can handle a file inside a zipped vt file
"""
try:
return (hasattr(self.init_module, 'can_handle_vt_file') and
self.init_module.can_handle_vt_file(name))
except Exception, e:
debug.unexpected_exception(e)
debug.critical("Got exception calling %s's can_handle_vt_file: "
"%s\n%s" % (self.name,
debug.format_exception(e),
traceback.format_exc()))
return False
示例13: can_handle_identifier
def can_handle_identifier(self, identifier):
""" Asks package if it can handle this package
"""
try:
return (hasattr(self.init_module, 'can_handle_identifier') and
self.init_module.can_handle_identifier(identifier))
except Exception, e:
debug.unexpected_exception(e)
debug.critical("Got exception calling %s's can_handle_identifier: "
"%s\n%s" % (self.name,
debug.format_exception(e),
traceback.format_exc()))
return False
示例14: menu_items
def menu_items():
"""menu_items() -> tuple of (str,function)
It returns a list of pairs containing text for the menu and a
callback function that will be executed when that menu item is selected.
"""
try:
from wizard import QCLToolsWizardWindow
except Exception, e: # pragma: no cover
if "CLTools" == identifiers.name:
debug.unexpected_exception(e)
raise
else:
return
示例15: reload
def reload(self, vistrail):
if vistrail is not None:
self.set_vistrail(vistrail)
for version_id in self.vistrail.get_tagMap():
self.add_workflow_entity(version_id)
#mashups
if hasattr(self.vistrail, 'mashups'):
self._mshp_tag_map = {}
for mashuptrail in self.vistrail.mashups:
self._mshp_tag_map[mashuptrail.id] = \
self.add_mashup_entities_from_mashuptrail(mashuptrail)
#parameter explorations
if hasattr(self.vistrail, 'parameter_explorations'):
self.pe_entity_map = {}
# find named pe's
#max_pe = {}
for pe in self.vistrail.parameter_explorations:
if pe.name:
self.pe_entity_map[pe.name] = \
self.add_parameter_exploration_entity(pe)
# if pe.action_id not in max_pe or max_pe[pe.action_id]<pe.id:
# max_pe[pe.action_id] = pe
#for pe in max_pe.values():
# if pe.id not in self.pe_entity_map:
# self.pe_entity_map[pe.id] = \
# self.add_parameter_exploration_entity(pe)
# read persisted log entries
log = None
try:
log = vistrail.get_persisted_log()
except Exception, e:
debug.unexpected_exception(e)
import traceback
debug.critical("Failed to read log", traceback.format_exc())
if log is not None:
for wf_exec in log.workflow_execs:
self.add_wf_exec_entity(wf_exec, False)
# read unpersisted log entries
if vistrail.log is not None:
for wf_exec in self.vistrail.log.workflow_execs:
self.add_wf_exec_entity(wf_exec, True)
self._vt_tag_map = copy.copy(self.vistrail.get_tagMap())