本文整理汇总了Python中pydev.pydevd.settrace函数的典型用法代码示例。如果您正苦于以下问题:Python settrace函数的具体用法?Python settrace怎么用?Python settrace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了settrace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generateMoleculeHierarchyTask
def generateMoleculeHierarchyTask(structure, debug=False):
if debug:
pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
molecule = structure.molecule
if not molecule.moleculeHierarchy:
hierarchy = MoleculeHierarchy(molecule=molecule)
else:
hierarchy = molecule.moleculeHierarchy
saltRemover = SaltRemover()
mol = Chem.MolFromMolBlock(str(structure.molfile))
base = saltRemover.StripMol(mol)
if mol.GetNumAtoms() == base.GetNumAtoms():
hierarchy.parent_molecule = molecule
else:
hierarchy.parent_molecule = getParentMolregnoFromBase(MolToMolBlock(base))
hierarchy.active_molecule = hierarchy.parent_molecule
try:
hierarchy.save()
except IntegrityError as e:
if debug:
print e.message
else:
raise e
示例2: init
def init():
from oslo.config import cfg
CONF = cfg.CONF
if 'remote_debug' not in CONF:
return
if not(CONF.remote_debug.host and CONF.remote_debug.port):
return
from mvpn.openstack.common.gettextutils import _
from mvpn.openstack.common import log as logging
LOG = logging.getLogger(__name__)
LOG.debug(_('Listening on %(host)s:%(port)s for debug connection'),
{'host': CONF.remote_debug.host,
'port': CONF.remote_debug.port})
from pydev import pydevd
pydevd.settrace(host=CONF.remote_debug.host,
port=CONF.remote_debug.port,
stdoutToServer=True,
stderrToServer=True)
LOG.warn(_('WARNING: Using the remote debug option changes how '
'Nova uses the eventlet library to support async IO. This '
'could result in failures that do not occur under normal '
'operation. Use at your own risk.'))
示例3: generateCompoundImageTask
def generateCompoundImageTask(structure, debug=False):
if debug:
from pydev import pydevd
pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
molecule = structure.molecule
if not molecule.compoundImage:
img = CompoundImages(molecule=molecule)
else:
img = molecule.compoundImage
mol = Chem.MolFromMolBlock(str(structure.molfile))
raw = Draw.MolToImage(mol, size=(500, 500))
raw_thumb = Draw.MolToImage(mol, size=(128, 128))
output = StringIO.StringIO()
raw.save(output, 'PNG')
img.png_500 = output.getvalue()
output.close()
output = StringIO.StringIO()
raw_thumb.save(output, 'PNG')
img.png = output.getvalue()
output.close()
try:
img.save()
except IntegrityError as e:
if debug:
print e.message
else:
raise e
示例4: generateCompoundPropertiesTask
def generateCompoundPropertiesTask(structure, debug=False):
if debug:
pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
molecule = structure.molecule
if not molecule.compoundProperty:
prop = CompoundProperties(molecule=molecule)
else:
prop = molecule.compoundProperty
saltRemover = SaltRemover()
mol = Chem.MolFromMolBlock(str(structure.molfile))
base = saltRemover.StripMol(mol)
prop.hbd = Descriptors.CalcNumHBD(mol)
prop.hba = Descriptors.CalcNumHBA(mol)
prop.rtb = Descriptors.CalcNumRotatableBonds(mol)
prop.alogp = Crippen.MolLogP(mol)
prop.psa = Descriptors.CalcTPSA(mol)
prop.full_mwt = NewDescriptors.MolWt(mol)
# prop.exact_mass = Descriptors.CalcExactMolWt(mol)
if base.GetNumAtoms():
prop.mw_freebase = NewDescriptors.MolWt(base)
prop.full_molformula = Descriptors.CalcMolFormula(mol)
try:
prop.save()
except IntegrityError as e:
if debug:
print e.message
else:
raise e
示例5: generateMoleculeHierarchyFromPipelinePilot
def generateMoleculeHierarchyFromPipelinePilot(structure, debug=False):
if debug:
pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
molecule = structure.molecule
if not molecule.moleculeHierarchy:
hierarchy = MoleculeHierarchy(molecule=molecule)
else:
hierarchy = molecule.moleculeHierarchy
data = cleanup(structure.molfile, 'stripsalts')
if not data['UPDATED']:
hierarchy.parent_molecule = molecule
else:
hierarchy.parent_molecule = getParentMolregnoFromBase(data['UPDATEDCTAB'])
hierarchy.active_molecule = hierarchy.parent_molecule
try:
hierarchy.save()
except IntegrityError as e:
if debug:
print e.message
else:
raise e
示例6: init
def init():
from oslo.config import cfg
CONF = cfg.CONF
# NOTE(markmc): gracefully handle the CLI options not being registered
if 'remote_debug' not in CONF:
return
if not (CONF.remote_debug.host and CONF.remote_debug.port):
return
from nova.i18n import _
from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
LOG.debug('Listening on %(host)s:%(port)s for debug connection',
{'host': CONF.remote_debug.host,
'port': CONF.remote_debug.port})
try:
from pydev import pydevd
except ImportError:
import pydevd
pydevd.settrace(host=CONF.remote_debug.host,
port=CONF.remote_debug.port,
stdoutToServer=False,
stderrToServer=False)
LOG.warn(_('WARNING: Using the remote debug option changes how '
'Nova uses the eventlet library to support async IO. This '
'could result in failures that do not occur under normal '
'operation. Use at your own risk.'))
示例7: pytest_configure
def pytest_configure(config):
socket = config.getvalue('pydevd')
if socket is not None:
addr, port = socket.split(':')
# prepend path to sys.path
path = config.getvalue('pydev_lib')
if path:
sys.path.insert(0, os.path.expandvars(os.path.expanduser(path)))
redirect = config.getvalue('pydevd_io')
stdout = redirect in ('both', 'stdout')
stderr = redirect in ('both', 'stderr')
from pydev import pydevd
# salvaged from pydev's source:
# - host: the user may specify another host, if the debug server is not
# in the same machine
# - stdoutToServer: when this is true, the stdout is passed to the debug
# server
# - stderrToServer: when this is true, the stderr is passed to the debug
# server so that they are printed in its console and not in this
# process console.
# - port: specifies which port to use for communicating with the server
# (note that the server must be started in the same port). @note:
# currently it's hard-coded at 5678 in the client
# - suspend: whether a breakpoint should be emulated as soon as this
# function is called.
# - trace_only_current_thread: determines if only the current thread
# will be traced or all future threads will also have the tracing
# enabled.
pydevd.settrace(host=addr, port=int(port), suspend=False,
stdoutToServer=stdout, stderrToServer=stderr,
trace_only_current_thread=False, overwrite_prev_trace=False)
示例8: test_remote_debug
def test_remote_debug(self):
import sys
sys.path.append('/home/api-dependencies/pycharm-debug.egg')
from pydev import pydevd
pydevd.settrace('192.168.1.11', port=51234, stdoutToServer=True, stderrToServer=True)
print "foo"
print "step 1"
print "step 2"
示例9: _enable_pydev
def _enable_pydev(debugger_host, debugger_port):
try:
from pydev import pydevd
except ImportError:
import pydevd
pydevd.settrace(debugger_host,
port=int(debugger_port),
stdoutToServer=True,
stderrToServer=True)
示例10: create
def create(cls, host=None, binary=None, topic=None, manager=None,
report_interval=None, periodic_enable=None,
periodic_fuzzy_delay=None, periodic_interval_max=None,
db_allowed=True):
"""Instantiates class and passes back application object.
:param host: defaults to CONF.host
:param binary: defaults to basename of executable
:param topic: defaults to bin_name - 'nova-' part
:param manager: defaults to CONF.<topic>_manager
:param report_interval: defaults to CONF.report_interval
:param periodic_enable: defaults to CONF.periodic_enable
:param periodic_fuzzy_delay: defaults to CONF.periodic_fuzzy_delay
:param periodic_interval_max: if set, the max time to wait between runs
"""
if not host:
host = CONF.host
if not binary:
binary = os.path.basename(sys.argv[0])
if not topic:
topic = binary.rpartition('nova-')[2]
if not manager:
manager_cls = ('%s_manager' %
binary.rpartition('nova-')[2])
manager = CONF.get(manager_cls, None)
if report_interval is None:
report_interval = CONF.report_interval
if periodic_enable is None:
periodic_enable = CONF.periodic_enable
if periodic_fuzzy_delay is None:
periodic_fuzzy_delay = CONF.periodic_fuzzy_delay
if CONF.remote_debug.host and CONF.remote_debug.port:
from pydev import pydevd
LOG = logging.getLogger('nova')
LOG.debug(_('Listening on %(host)s:%(port)s for debug connection'),
{'host': CONF.remote_debug.host,
'port': CONF.remote_debug.port})
pydevd.settrace(host=CONF.remote_debug.host,
port=CONF.remote_debug.port,
stdoutToServer=False,
stderrToServer=False)
LOG.warn(_('WARNING: Using the remote debug option changes how '
'Nova uses the eventlet library to support async IO. This '
'could result in failures that do not occur under normal '
'operation. Use at your own risk.'))
service_obj = cls(host, binary, topic, manager,
report_interval=report_interval,
periodic_enable=periodic_enable,
periodic_fuzzy_delay=periodic_fuzzy_delay,
periodic_interval_max=periodic_interval_max,
db_allowed=db_allowed)
return service_obj
示例11: debug_here
def debug_here():
# append pydev remote debugger
if REMOTE_DBG:
# Make pydev debugger works for auto reload.
# Note pydevd module need to be copied in XBMC\system\python\Lib\pysrc
try:
from pydev import pydevd
pydevd.settrace('localhost', port=5678, stdoutToServer=True, stderrToServer=True)
except ImportError:
sys.stderr.write("Error: " +
"You must add org.python.pydev.debug.pysrc to your PYTHONPATH.")
sys.exit(1)
示例12: breakpoint
def breakpoint():
try:
pydevd.settrace(
"localhost",
port=10000,
stdoutToServer=True,
stderrToServer=True,
suspend=True,
trace_only_current_thread=True,
overwrite_prev_trace=True,
)
except Exception:
pass
示例13: ConnectDebugger
def ConnectDebugger(host_ovr=None, port_ovr=None):
"""
Connect a listening Eclipse debugger
"""
from pydev import pydevd
if pydevd.connected:
GEUtil.Warning("In order to run another debug session you MUST restart the game.\n")
return
if port_ovr:
pydevd.settrace(host=host_ovr, port=port_ovr, suspend=False)
else:
pydevd.settrace(host=host_ovr, suspend=False)
GEUtil.Msg("Python debugger successfully connected!\n")
示例14: setup_remote_pydev_debug
def setup_remote_pydev_debug():
if CONF.pydev_debug_host and CONF.pydev_debug_port:
error_msg = ('Error setting up the debug environment. Verify that the'
' option --debug-url has the format <host>:<port> and '
'that a debugger processes is listening on that port.')
try:
from pydev import pydevd
pydevd.settrace(CONF.pydev_debug_host,
port=CONF.pydev_debug_port,
stdoutToServer=True,
stderrToServer=True)
return True
except:
LOG.exception(_(error_msg))
raise
示例15: setup_remote_pydev_debug
def setup_remote_pydev_debug(host, port):
error_msg = ('Error setting up the debug environment. Verify that the'
' option pydev_worker_debug_port is pointing to a valid '
'hostname or IP on which a pydev server is listening on'
' the port indicated by pydev_worker_debug_port.')
try:
from pydev import pydevd
pydevd.settrace(host,
port=port,
stdoutToServer=True,
stderrToServer=True)
return True
except:
LOG.exception(error_msg)
raise