本文整理汇总了Python中vistrails.core.db.locator.BaseLocator.from_url方法的典型用法代码示例。如果您正苦于以下问题:Python BaseLocator.from_url方法的具体用法?Python BaseLocator.from_url怎么用?Python BaseLocator.from_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vistrails.core.db.locator.BaseLocator
的用法示例。
在下文中一共展示了BaseLocator.from_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open_workflow
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
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
示例2: updateVistrail
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def updateVistrail(self, url, vistrail=None):
""" updateVistrail(self, string:url, Vistrail:vistrail)
Update the specified entity url. Delete or reload as necessary.
Need to make sure workspaces are updated if the entity is changed.
"""
entities = [e for e in self.entities.itervalues() if e.url == url]
entity = entities[0] if len(entities) else None
while entity and entity.parent:
entity = entity.parent
url = entity.url
workspaces = [p for p in self.workspaces if entity in self.workspaces[p]]
if entity:
for p in workspaces:
self.del_from_workspace(entity, p)
self.delete_entity(entity)
locator = BaseLocator.from_url(url)
if locator.is_valid():
if not vistrail:
(vistrail, abstractions, thumbnails, mashups) = load_vistrail(locator)
vistrail.abstractions = abstractions
vistrail.thumbnails = thumbnails
vistrail.mashups = mashups
entity = self.create_vistrail_entity(vistrail)
for p in workspaces:
self.add_to_workspace(entity, p)
return entity
else:
# probably an unsaved vistrail
pass
示例3: open_workflow
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
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
示例4: load_running_jobs
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def load_running_jobs(self):
conf = configuration.get_vistrails_configuration()
if conf.has('runningJobsList') and conf.runningJobsList:
for url in conf.runningJobsList.split(';'):
loc, version = url.split('?')
locator = BaseLocator.from_url(loc)
msgBox = QtGui.QMessageBox(QtGui.QMessageBox.Question,
"Running Job Found",
"Running Job Found:\n %s\n"
"Continue now?" % url)
msgBox.addButton("Later", msgBox.ActionRole)
delete = msgBox.addButton("Delete", msgBox.ActionRole)
yes = msgBox.addButton("Yes", msgBox.ActionRole)
msgBox.exec_()
if msgBox.clickedButton() == yes:
from vistrails.gui.vistrails_window import _app
_app.open_vistrail_without_prompt(locator,
int(version.split('=')[1]))
_app.get_current_view().execute()
if msgBox.clickedButton() == delete:
conf_jobs = conf.runningJobsList.split(';')
conf_jobs.remove(url)
conf.runningJobsList = ';'.join(conf_jobs)
configuration.get_vistrails_persistent_configuration(
).runningJobsList = conf.runningJobsList
else:
conf.runningJobsList = ''
configuration.get_vistrails_persistent_configuration(
).runningJobsList = conf.runningJobsList
示例5: create_wf_exec_entity
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def create_wf_exec_entity(self, wf_exec, wf_entity):
entity = WorkflowExecEntity(wf_exec)
wf_entity.children.append(entity)
entity.parent = wf_entity
locator = BaseLocator.from_url(self.url)
locator.kwargs['workflow_exec'] = entity.name
entity.url = locator.to_url()
return entity
示例6: close_vistrail
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def close_vistrail(self, locator=None, controller=None):
if controller is None:
controller = self.get_current_controller()
if controller is None:
return False
if locator is None and controller is not None:
locator = controller.locator
elif isinstance(locator, basestring):
locator = BaseLocator.from_url(locator)
controller.close_vistrail(locator)
controller.cleanup()
self.remove_vistrail(locator)
示例7: __init__
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def __init__(self, workflow, parent):
self.locator = BaseLocator.from_url(workflow.vistrail)
QtGui.QTreeWidgetItem.__init__(self, parent, ['', ''])
self.setToolTip(0, "Double-Click to View Pipeline")
self.setToolTip(1, workflow.id)
self.workflow = workflow
self.has_queue = True
self.setIcon(0, theme.get_current_theme().JOB_CHECKING)
self.setExpanded(True)
self.workflowFinished = False
self.jobs = {}
self.intermediates = {}
self.updateJobs()
示例8: create_parameter_exploration_entity
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def create_parameter_exploration_entity(self, pe):
entity = ParameterExplorationEntity(pe)
self.children.append(entity)
entity.parent = self
entity.name = pe.name
if pe.name:
entity.name = pe.name
else:
# find logical name using vistrail tag
entity.name = "Latest for " + \
self.vistrail.get_pipeline_name(pe.action_id)
locator = BaseLocator.from_url(self.url)
locator.kwargs['parameterExploration'] = pe.id
entity.url = locator.to_url()
return entity
示例9: create_workflow_entity
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def create_workflow_entity(self, workflow, action):
entity = WorkflowEntity(workflow)
self.children.append(entity)
entity.parent = self
if self.vistrail.has_notes(action.id):
plain_notes = extract_text(self.vistrail.get_notes(action.id))
entity.description = plain_notes
else:
entity.description = ''
entity.user = action.user
entity.mod_time = action.date
entity.create_time = action.date
locator = BaseLocator.from_url(self.url)
locator.kwargs['version_node'] = action.id
entity.url = locator.to_url()
return entity
示例10: create_mashup_entity
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def create_mashup_entity(self, trail_id, mashup, action):
entity = MashupEntity(mashup)
self.children.append(entity)
entity.parent = self
vt_version = mashup.version
if self.vistrail.has_notes(vt_version):
plain_notes = extract_text(self.vistrail.get_notes(vt_version))
entity.description = plain_notes
else:
entity.description = ''
entity.user = action.user
entity.mod_time = action.date
entity.create_time = action.date
locator = BaseLocator.from_url(self.url)
locator.kwargs['mashuptrail'] = trail_id
locator.kwargs['mashup'] = action.id
entity.url = locator.to_url()
return entity
示例11: open_vistrail
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def open_vistrail(self, locator=None, version=None, is_abstraction=False):
if isinstance(locator, basestring):
locator = BaseLocator.from_url(locator)
elif locator is None:
locator = UntitledLocator()
controller = self.ensure_vistrail(locator)
if controller is None:
# vistrail is not already open
try:
loaded_objs = vistrails.core.db.io.load_vistrail(locator, is_abstraction)
controller = self.add_vistrail(loaded_objs[0], locator,
*loaded_objs[1:])
if locator.is_untitled():
return controller
controller.is_abstraction = is_abstraction
thumb_cache = ThumbnailCache.getInstance()
controller.vistrail.thumbnails = controller.find_thumbnails(
tags_only=thumb_cache.conf.tagsOnly)
controller.vistrail.abstractions = controller.find_abstractions(
controller.vistrail, True)
controller.vistrail.mashups = controller._mashups
collection = Collection.getInstance()
url = locator.to_url()
entity = collection.updateVistrail(url, controller.vistrail)
# add to relevant workspace categories
if not controller.is_abstraction:
collection.add_to_workspace(entity)
collection.commit()
except VistrailsDBException as e:
debug.unexpected_exception(e)
debug.critical("Exception from the database: %s" % e,
debug.format_exc())
return None
version = self.convert_version(version)
if version is None:
controller.select_latest_version()
version = controller.current_version
self.select_version(version)
return controller
示例12: save_vistrail
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def save_vistrail(self, locator=None, controller=None, export=False):
if controller is None:
controller = self.get_current_controller()
if controller is None:
return False
if locator is None and controller is not None:
locator = controller.locator
elif isinstance(locator, basestring):
locator = BaseLocator.from_url(locator)
if not locator:
return False
old_locator = controller.locator
controller.flush_delayed_actions()
try:
controller.write_vistrail(locator, export=export)
except Exception, e:
debug.unexpected_exception(e)
debug.critical("Failed to save vistrail", traceback.format_exc())
raise
示例13: save_vistrail
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def save_vistrail(self, locator=None, controller=None, export=False):
if controller is None:
controller = self.get_current_controller()
if controller is None:
return False
if locator is None and controller is not None:
locator = controller.locator
elif isinstance(locator, basestring):
locator = BaseLocator.from_url(locator)
if not locator:
return False
old_locator = controller.locator
try:
controller.write_vistrail(locator, export=export)
except Exception, e:
import traceback
debug.critical('Failed to save vistrail: %s' % str(e),
traceback.format_exc())
raise
示例14: open_vistrail
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def open_vistrail(self, locator=None, version=None, is_abstraction=False):
if isinstance(locator, basestring):
locator = BaseLocator.from_url(locator)
elif locator is None:
locator = UntitledLocator()
controller = self.ensure_vistrail(locator)
if controller is None:
# vistrail is not already open
try:
loaded_objs = vistrails.core.db.io.load_vistrail(locator, False)
controller = self.add_vistrail(loaded_objs[0], locator,
*loaded_objs[1:])
if locator.is_untitled():
return True
controller.is_abstraction = is_abstraction
thumb_cache = ThumbnailCache.getInstance()
controller.vistrail.thumbnails = controller.find_thumbnails(
tags_only=thumb_cache.conf.tagsOnly)
controller.vistrail.abstractions = controller.find_abstractions(
controller.vistrail, True)
controller.vistrail.mashups = controller._mashups
collection = Collection.getInstance()
url = locator.to_url()
entity = collection.updateVistrail(url, controller.vistrail)
# add to relevant workspace categories
if not controller.is_abstraction:
collection.add_to_workspace(entity)
collection.commit()
except VistrailsDBException, e:
import traceback
debug.critical("Exception from the database",
traceback.format_exc())
return None
except Exception, e:
#debug.critical('An error has occurred', e)
#print "An error has occurred", str(e)
raise
示例15: locator
# 需要导入模块: from vistrails.core.db.locator import BaseLocator [as 别名]
# 或者: from vistrails.core.db.locator.BaseLocator import from_url [as 别名]
def locator(self):
locator = BaseLocator.from_url(self.url)
return locator