本文整理汇总了Python中vistrails.core.configuration.get_vistrails_configuration函数的典型用法代码示例。如果您正苦于以下问题:Python get_vistrails_configuration函数的具体用法?Python get_vistrails_configuration怎么用?Python get_vistrails_configuration使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_vistrails_configuration函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: sendError
def sendError(self):
data = {}
data['platform'] = platform.uname()[0]
data['platform_version'] = platform.uname()[2]
data['hashed_hostname'] = hashlib.sha1(platform.uname()[1]).hexdigest()
data['hashed_username'] = hashlib.sha1(os.getlogin()).hexdigest()
data['source'] = 'UV-CDAT'
data['source_version'] = '1.2.1'
data['description'] = self.getDescription()
data['stack_trace'] = self.errorDetails.toPlainText()
data['severity'] = 'FATAL'
data['comments'] = self.userComments.toPlainText()
if get_vistrails_configuration().output != '':
fname = get_vistrails_configuration().output
# read at most last 5000 chars from output log
with open(fname, "r") as f:
f.seek (0, 2) # Seek @ EOF
fsize = f.tell() # Get Size
f.seek (max (fsize-5000, 0), 0) # Set pos @ last n chars
data['execution_log'] = f.read()
print urlencode(data)
print "http://uvcdat.llnl.gov/UVCDATUsage/log/add/error/"
result = urlopen("http://uvcdat.llnl.gov/UVCDATUsage/log/add/error/",
urlencode(data))
开发者ID:benbu,项目名称:uvcdat-gui,代码行数:25,代码来源:reportErrorDialog.py
示例2: py_import
def py_import(module_name, dependency_dictionary, store_in_config=False):
"""Tries to import a python module, installing if necessary.
If the import doesn't succeed, we guess which system we are running on and
install the corresponding package from the dictionary. We then run the
import again.
If the installation fails, we won't try to install that same module again
for the session.
"""
try:
result = _vanilla_import(module_name)
return result
except ImportError:
if not getattr(get_vistrails_configuration(), 'installBundles'):
raise
if module_name in _previously_failed_pkgs:
raise PyImportException("Import of Python module '%s' failed again, "
"not triggering installation" % module_name)
if store_in_config:
ignored_packages_list = getattr(get_vistrails_configuration(),
'bundleDeclinedList',
None)
if ignored_packages_list:
ignored_packages = set(ignored_packages_list.split(';'))
else:
ignored_packages = set()
if module_name in ignored_packages:
raise PyImportException("Import of Python module '%s' failed "
"again, installation disabled by "
"configuration" % module_name)
debug.warning("Import of python module '%s' failed. "
"Will try to install bundle." % module_name)
success = vistrails.core.bundles.installbundle.install(
dependency_dictionary)
if store_in_config:
if bool(success):
ignored_packages.discard(module_name)
else:
ignored_packages.add(module_name)
setattr(get_vistrails_configuration(),
'bundleDeclinedList',
';'.join(sorted(ignored_packages)))
setattr(get_vistrails_persistent_configuration(),
'bundleDeclinedList',
';'.join(sorted(ignored_packages)))
if not success:
_previously_failed_pkgs.add(module_name)
raise PyImportException("Installation of Python module '%s' failed." %
module_name)
try:
result = _vanilla_import(module_name)
return result
except ImportError, e:
_previously_failed_pkgs.add(module_name)
raise PyImportBug("Installation of package '%s' succeeded, but import "
"still fails." % module_name)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:60,代码来源:pyimport.py
示例3: __init__
def __init__(self):
d = {"prefix": "vt_tmp"}
if get_vistrails_configuration().check("temporaryDirectory"):
dir = get_vistrails_configuration().temporaryDirectory
if os.path.exists(dir):
d["dir"] = dir
else:
debug.critical("Temporary directory does not exist: %s" % dir)
self.directory = tempfile.mkdtemp(**d)
self.files = {}
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:11,代码来源:module_utils.py
示例4: __init__
def __init__(self):
d = {'prefix':'vt_tmp'}
if get_vistrails_configuration().check('temporaryDir'):
dir = get_vistrails_configuration().temporaryDir
if os.path.exists(dir):
d['dir'] = dir
else:
debug.critical("Temporary directory does not exist: %s" % dir)
self.directory = tempfile.mkdtemp(**d)
self.files = {}
开发者ID:danielballan,项目名称:VisTrails,代码行数:11,代码来源:module_utils.py
示例5: tab_changed
def tab_changed(self, index):
""" tab_changed(index: int) -> None
Keep general and advanced configurations in sync
"""
self._configuration_tab.configuration_changed(
get_vistrails_persistent_configuration(),
get_vistrails_configuration())
self._general_tab.update_state(
get_vistrails_persistent_configuration(),
get_vistrails_configuration())
开发者ID:tacaswell,项目名称:VisTrails,代码行数:11,代码来源:preferences.py
示例6: __init__
def __init__(self, parent):
QtGui.QDialog.__init__(self, parent)
self.setWindowTitle('VisTrails Preferences')
layout = QtGui.QHBoxLayout(self)
layout.setMargin(0)
layout.setSpacing(0)
self.setLayout(layout)
f = QtGui.QFrame()
layout.addWidget(f)
l = QtGui.QVBoxLayout(f)
f.setLayout(l)
self._tab_widget = QtGui.QTabWidget(f)
l.addWidget(self._tab_widget)
self._tab_widget.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
tabs = [("General", ["General", "Packages"]),
("Interface", ["Interface", "Startup"]),
("Paths && URLs", ["Paths", "Web Sharing"]),
("Advanced", ["Upgrades", "Thumbnails", "Advanced"]),
]
for (tab_name, categories) in tabs:
tab = QConfigurationPane(self,
get_vistrails_persistent_configuration(),
get_vistrails_configuration(),
[(c, base_config[c]) for c in categories])
self._tab_widget.addTab(tab, tab_name)
output_tab = QOutputConfigurationPane(self,
get_vistrails_persistent_configuration(),
get_vistrails_configuration())
self._tab_widget.addTab(output_tab, "Output")
self._packages_tab = self.create_packages_tab()
self._tab_widget.addTab(self._packages_tab, 'Packages')
self._configuration_tab = self.create_configuration_tab()
self._tab_widget.addTab(self._configuration_tab, 'Expert')
self.connect(self._tab_widget,
QtCore.SIGNAL('currentChanged(int)'),
self.tab_changed)
self.connect(self._configuration_tab._tree.treeWidget,
QtCore.SIGNAL('configuration_changed'),
self.configuration_changed)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:49,代码来源:preferences.py
示例7: compute
def compute(self):
vt_configuration = get_vistrails_configuration()
if not getattr(vt_configuration, 'interactiveMode', False):
self.set_output('result', True)
return
cell = self.get_input('cell')
label = self.force_get_input('label', None)
# FIXME : This should be done via the spreadsheet, removing it properly
# and then sending a new DisplayCellEvent
# However, there is currently no facility to remove the widget from
# wherever it is
oldparent = cell.parent()
assert isinstance(oldparent, QCellContainer)
ncell = oldparent.takeWidget()
assert ncell == cell
dialog = PromptWindow(cell, label)
result = dialog.exec_() == QtGui.QDialog.Accepted
oldparent.setWidget(cell)
self.set_output('result', result)
if not result and not self.get_input('carry_on'):
raise ModuleError(self, "Execution aborted")
开发者ID:hjanime,项目名称:VisTrails,代码行数:25,代码来源:continue_prompt.py
示例8: write
def write(self, s):
"""write(s) -> None
adds the string s to the message list and displays it
"""
# adds the string s to the list and
s = s.strip()
msgs = s.split("\n")
if len(msgs) <= 3:
msgs.append("Error logging message: invalid log format")
s += "\n" + msgs[3]
if not len(msgs[3].strip()):
msgs[3] = "Unknown Error"
s = "\n".join(msgs)
text = msgs[3]
item = QtGui.QListWidgetItem(text)
item.setData(32, s)
item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEditable)
self.list.addItem(item)
item.setForeground(CurrentTheme.DEBUG_COLORS[msgs[0]])
self.list.setItemHidden(item, not self.levels[msgs[0]].isChecked())
alwaysShowDebugPopup = getattr(get_vistrails_configuration(), "alwaysShowDebugPopup", False)
if msgs[0] == "CRITICAL":
if self.isVisible() and not alwaysShowDebugPopup:
self.raise_()
self.activateWindow()
modal = get_vistrails_application().activeModalWidget()
if modal:
# need to beat modal window
self.showMessageBox(item)
else:
self.showMessageBox(item)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:32,代码来源:debug.py
示例9: addButtonsToToolbar
def addButtonsToToolbar(self):
# button for toggling executions
eye_open_icon = \
QtGui.QIcon(os.path.join(vistrails_root_directory(),
'gui/resources/images/eye.png'))
self.portVisibilityAction = QtGui.QAction(eye_open_icon,
"Show/hide port visibility toggle buttons",
None,
triggered=self.showPortVisibility)
self.portVisibilityAction.setCheckable(True)
self.portVisibilityAction.setChecked(True)
self.toolWindow().toolbar.insertAction(self.toolWindow().pinAction,
self.portVisibilityAction)
self.showTypesAction = QtGui.QAction(letterIcon('T'),
"Show/hide type information",
None,
triggered=self.showTypes)
self.showTypesAction.setCheckable(True)
self.showTypesAction.setChecked(True)
self.toolWindow().toolbar.insertAction(self.toolWindow().pinAction,
self.showTypesAction)
self.showEditsAction = QtGui.QAction(
QtGui.QIcon(os.path.join(vistrails_root_directory(),
'gui/resources/images/pencil.png')),
"Show/hide parameter widgets",
None,
triggered=self.showEdits)
self.showEditsAction.setCheckable(True)
self.showEditsAction.setChecked(
get_vistrails_configuration().check('showInlineParameterWidgets'))
self.toolWindow().toolbar.insertAction(self.toolWindow().pinAction,
self.showEditsAction)
开发者ID:Nikea,项目名称:VisTrails,代码行数:33,代码来源:module_info.py
示例10: 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
示例11: create_thumbs_tab
def create_thumbs_tab(self):
""" create_thumbs_tab() -> QThumbnailConfiguration
"""
return QThumbnailConfiguration(self,
get_vistrails_persistent_configuration(),
get_vistrails_configuration())
开发者ID:tacaswell,项目名称:VisTrails,代码行数:7,代码来源:preferences.py
示例12: create_general_tab
def create_general_tab(self):
""" create_general_tab() -> QGeneralConfiguration
"""
return QGeneralConfiguration(self,
get_vistrails_persistent_configuration(),
get_vistrails_configuration())
开发者ID:tacaswell,项目名称:VisTrails,代码行数:7,代码来源:preferences.py
示例13: getResultEntity
def getResultEntity(self, controller, versions_to_check):
from vistrails.core.collection.vistrail import VistrailEntity
vistrail_entity = None
for version in versions_to_check:
if version in controller.vistrail.actionMap:
action = controller.vistrail.actionMap[version]
if getattr(get_vistrails_configuration(), 'hideUpgrades',
True):
# Use upgraded version to match
action = controller.vistrail.actionMap[
controller.vistrail.get_upgrade(action.id, False)]
if self.match(controller, action):
# have a match, get vistrail entity
if vistrail_entity is None:
vistrail_entity = VistrailEntity()
# don't want to add all workflows, executions
vistrail_entity.set_vistrail(controller.vistrail)
# only tagged versions should be displayed in the workspace
tagged_version = controller.get_tagged_version(version)
vistrail_entity.add_workflow_entity(tagged_version)
# FIXME this is not done at the low level but in
# Collection class, probably should be reworked
vistrail_entity.wf_entity_map[tagged_version].parent = \
vistrail_entity
return vistrail_entity
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:26,代码来源:combined.py
示例14: checkJob
def checkJob(self, module, id, monitor):
""" checkJob(module: VistrailsModule, id: str, monitor: instance) -> None
Starts monitoring the job for the current running workflow
module - the module to suspend
id - the job identifier
monitor - a class instance with a finished method for
checking if the job has completed
"""
if not self.currentWorkflow():
if not monitor or not self.isDone(monitor):
raise ModuleSuspended(module, 'Job is running', queue=monitor,
job_id=id)
job = self.getJob(id)
if self.callback:
self.callback.checkJob(module, id, monitor)
return
conf = get_vistrails_configuration()
interval = conf.jobCheckInterval
if interval and not conf.jobAutorun:
if monitor:
# wait for module to complete
try:
while not self.isDone(monitor):
time.sleep(interval)
print ("Waiting for job: %s,"
"press Ctrl+C to suspend") % job.name
except KeyboardInterrupt, e:
raise ModuleSuspended(module, 'Interrupted by user, job'
' is still running', queue=monitor,
job_id=id)
开发者ID:cjh1,项目名称:VisTrails,代码行数:32,代码来源:job.py
示例15: current_dot_vistrails
def current_dot_vistrails():
""" current_dot_vistrails() -> str
Returns the VisTrails per-user directory.
"""
from vistrails.core.configuration import get_vistrails_configuration
return get_vistrails_configuration().dotVistrails
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:7,代码来源:__init__.py
示例16: checkJob
def checkJob(self, module, id, monitor):
""" checkJob(module: VistrailsModule, id: str, monitor: instance)
Callback, checks if job has completed.
"""
workflow = self.jobMonitor.currentWorkflow()
if not workflow:
if not monitor or not self.jobMonitor.isDone(monitor):
raise ModuleSuspended(module, 'Job is running',
monitor=monitor)
workflow_item = self.workflowItems[workflow.id]
item = workflow_item.jobs.get(id, None)
item.setText(0, item.job.name)
# we should check the status using monitor and show dialog
# get current view progress bar and hijack it
if monitor:
item.monitor = monitor
workflow = self.jobMonitor.currentWorkflow()
workflow_item = self.workflowItems.get(workflow.id, None)
workflow_item.updateJobs()
progress = self.controller.progress
conf = configuration.get_vistrails_configuration()
interval = conf.jobCheckInterval
if interval and not conf.jobAutorun and not progress.suspended:
# we should keep checking the job
if monitor:
# wait for module to complete
labelText = (("Running external job %s\n"
"Started %s\n"
"Press Cancel to suspend")
% (item.job.name,
item.job.start))
progress.setLabelText(labelText)
while not self.jobMonitor.isDone(monitor):
i = 0
while i < interval:
i += 1
time.sleep(1)
QtCore.QCoreApplication.processEvents()
if progress.wasCanceled():
# this does not work, need to create a new progress dialog
#progress.goOn()
new_progress = progress.__class__(progress.parent())
new_progress.setMaximum(progress.maximum())
new_progress.setValue(progress.value())
new_progress.setLabelText(labelText)
new_progress.setMinimumDuration(0)
new_progress.suspended = True
self.controller.progress = new_progress
progress.hide()
progress.deleteLater()
progress = new_progress
progress.show()
QtCore.QCoreApplication.processEvents()
raise ModuleSuspended(module,
'Interrupted by user, job'
' is still running', monitor=monitor)
return
if not monitor or not self.jobMonitor.isDone(monitor):
raise ModuleSuspended(module, 'Job is running', monitor=monitor)
开发者ID:ericdill,项目名称:VisTrails,代码行数:60,代码来源:job_monitor.py
示例17: checkJob
def checkJob(self, module, id, handle):
""" checkJob(module: VistrailsModule, id: str, handle: object) -> None
Starts monitoring the job for the current running workflow
module - the module to suspend
id - the job identifier
handle - an object following the JobHandle interface, i.e. with a
finished method for checking if the job has completed
"""
if not self.currentWorkflow():
if not handle or not self.isDone(handle):
raise ModuleSuspended(module, 'Job is running',
handle=handle)
job = self.getJob(id)
if self.callback:
self.callback.checkJob(module, id, handle)
return
conf = get_vistrails_configuration()
interval = conf.jobCheckInterval
if interval and not conf.jobAutorun:
if handle:
# wait for module to complete
try:
while not self.isDone(handle):
time.sleep(interval)
print ("Waiting for job: %s,"
"press Ctrl+C to suspend") % job.name
except KeyboardInterrupt:
raise ModuleSuspended(module, 'Interrupted by user, job'
' is still running', handle=handle)
else:
if not handle or not self.isDone(handle):
raise ModuleSuspended(module, 'Job is running',
handle=handle)
开发者ID:Nikea,项目名称:VisTrails,代码行数:35,代码来源:job.py
示例18: theFunction
def theFunction(src, dst):
global Variant_desc, InputPort_desc
if Variant_desc is None:
reg = get_module_registry()
Variant_desc = reg.get_descriptor_by_name(
'org.vistrails.vistrails.basic', 'Variant')
InputPort_desc = reg.get_descriptor_by_name(
'org.vistrails.vistrails.basic', 'InputPort')
iport = conn.destination.name
oport = conn.source.name
src.enableOutputPort(oport)
conf = get_vistrails_configuration()
error_on_others = getattr(conf, 'errorOnConnectionTypeerror')
error_on_variant = (error_on_others or
getattr(conf, 'errorOnVariantTypeerror'))
errors = [error_on_others, error_on_variant]
if isinstance(src, InputPort_desc.module):
typecheck = [False]
else:
typecheck = [errors[desc is Variant_desc]
for desc in conn.source.spec.descriptors()]
dst.set_input_port(
iport,
ModuleConnector(src, oport, conn.destination.spec, typecheck))
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:25,代码来源:connection.py
示例19: py_import
def py_import(module_name, dependency_dictionary):
"""Tries to import a python module, installing if necessary.
If the import doesn't succeed, we guess which system we are running on and
install the corresponding package from the dictionary. We then run the
import again.
If the installation fails, we won't try to install that same module again
for the session.
"""
try:
result = _vanilla_import(module_name)
return result
except ImportError:
if not getattr(get_vistrails_configuration(), 'installBundles'):
raise
if module_name in _previously_failed_pkgs:
raise PyImportException("Import of Python module '%s' failed again, "
"not triggering installation" % module_name)
debug.warning("Import of python module '%s' failed. "
"Will try to install bundle." % module_name)
success = vistrails.core.bundles.installbundle.install(dependency_dictionary)
if not success:
_previously_failed_pkgs.add(module_name)
raise PyImportException("Installation of Python module '%s' failed." %
module_name)
try:
result = _vanilla_import(module_name)
return result
except ImportError, e:
_previously_failed_pkgs.add(module_name)
raise PyImportBug("Installation of package '%s' succeeded, but import "
"still fails." % module_name)
开发者ID:cjh1,项目名称:VisTrails,代码行数:35,代码来源:pyimport.py
示例20: __init__
def __init__(self, registry, startup):
"""__init__(configuration: ConfigurationObject) -> PackageManager
configuration is the persistent configuration object of the application.
"""
global _package_manager
if _package_manager:
m = "Package manager can only be constructed once."
raise VistrailsInternalError(m)
_package_manager = self
self._registry = registry
self._startup = startup
# Contains packages that have not yet been enabled, but exist on the
# filesystem
self._available_packages = {} # codepath: str -> Package
# These other lists contain enabled packages
self._package_list = {} # codepath: str -> Package
self._package_versions = {} # identifier: str -> version -> Package
self._old_identifier_map = {} # old_id: str -> new_id: str
self._dependency_graph = vistrails.core.data_structures.graph.Graph()
self._default_prefix_dict = {
"basic_modules": "vistrails.core.modules.",
"abstraction": "vistrails.core.modules.",
}
self._userpackages = None
self._packages = None
self._abstraction_pkg = None
self._currently_importing_package = None
# Setup a global __import__ hook that calls Package#import_override()
# for all imports executed from that package
import __builtin__
self._orig_import = __builtin__.__import__
__builtin__.__import__ = self._import_override
# Compute the list of available packages, _available_packages
self.build_available_package_names_list()
if get_vistrails_configuration().loadPackages:
for pkg in self._startup.enabled_packages.itervalues():
self.add_package(pkg.name, prefix=pkg.prefix)
else:
try:
basic_pkg = self._startup.enabled_packages["basic_modules"]
except KeyError:
pass
else:
self.add_package(basic_pkg.name, prefix=basic_pkg.prefix)
try:
abs_pkg = self._startup.enabled_packages["abstraction"]
except KeyError:
pass
else:
self.add_package(abs_pkg.name, prefix=abs_pkg.prefix)
开发者ID:hjanime,项目名称:VisTrails,代码行数:59,代码来源:packagemanager.py
注:本文中的vistrails.core.configuration.get_vistrails_configuration函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论