本文整理汇总了Python中vistrails.core.db.locator.BaseLocator类的典型用法代码示例。如果您正苦于以下问题:Python BaseLocator类的具体用法?Python BaseLocator怎么用?Python BaseLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseLocator类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: updateVistrail
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
开发者ID:Nikea,项目名称:VisTrails,代码行数:30,代码来源:__init__.py
示例3: 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
示例4: load_running_jobs
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
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:29,代码来源:job_monitor.py
示例5: create_wf_exec_entity
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
开发者ID:cjh1,项目名称:VisTrails,代码行数:8,代码来源:vistrail.py
示例6: close_vistrail
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)
开发者ID:sameera2004,项目名称:VisTrails,代码行数:13,代码来源:application.py
示例7: __init__
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()
开发者ID:cjh1,项目名称:VisTrails,代码行数:13,代码来源:job_monitor.py
示例8: create_parameter_exploration_entity
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
开发者ID:cjh1,项目名称:VisTrails,代码行数:15,代码来源:vistrail.py
示例9: create_workflow_entity
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
开发者ID:cjh1,项目名称:VisTrails,代码行数:16,代码来源:vistrail.py
示例10: create_mashup_entity
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
开发者ID:cjh1,项目名称:VisTrails,代码行数:18,代码来源:vistrail.py
示例11: open_vistrail
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
开发者ID:anukat2015,项目名称:VisTrails,代码行数:41,代码来源:application.py
示例12: save_vistrail
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
开发者ID:sameera2004,项目名称:VisTrails,代码行数:21,代码来源:application.py
示例13: save_vistrail
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
开发者ID:cjh1,项目名称:VisTrails,代码行数:21,代码来源:application.py
示例14: open_vistrail
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
开发者ID:tacaswell,项目名称:VisTrails,代码行数:38,代码来源:application.py
示例15: locator
def locator(self):
locator = BaseLocator.from_url(self.url)
return locator
开发者ID:cjh1,项目名称:VisTrails,代码行数:3,代码来源:entity.py
示例16: urlExists
def urlExists(self, url):
""" Check if entity with this url exist """
locator = BaseLocator.from_url(url)
if locator.is_valid():
return True
return False
开发者ID:Nikea,项目名称:VisTrails,代码行数:6,代码来源:__init__.py
注:本文中的vistrails.core.db.locator.BaseLocator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论