本文整理汇总了Python中pydevd.settrace函数的典型用法代码示例。如果您正苦于以下问题:Python settrace函数的具体用法?Python settrace怎么用?Python settrace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了settrace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: attachPyDev
def attachPyDev(self):
import pydevd
if not pydevd.connected:
pydevd.settrace('localhost',
port=9999,
stdoutToServer=True,
stderrToServer=True)
示例2: startDebug
def startDebug(self,**kargs):
"""Starts remote debugging for PyDev.
"""
for k,v in kargs.items():
if k == 'debug':
self._dbg_self = v
elif k == 'verbose':
self._dbg_self = v
if self._dbg_self or self._verbose:
print >>sys.stderr,"RDBG:debug starting "
# already loaded
if self.runningInPyDevDbg:
if self._dbg_self or self._verbose:
print >>sys.stderr,"RDBG:dbgargs="+str(self.dbgargs)
try:
pydevd.settrace(
host=self.dbgargs['host'],
port=self.dbgargs['port'],
stdoutToServer=self.dbgargs['stdoutToServer'],
stderrToServer=self.dbgargs['stderrToServer'],
suspend=self.dbgargs['suspend'],
trace_only_current_thread=self.dbgargs['trace_only_current_thread']
)
#OK-ref: pydevd.settrace(host=None,port=5678,stdoutToServer=False,stderrToServer=False,suspend=False,trace_only_current_thread=True)
except Exception as e:
raise PyDevRDCException(e)
else:
raise PyDevRDCException("ERROR:Requires init:self.runningInPyDevDbg="+str(self.runningInPyDevDbg))
if _dbg_self or _dbg_unit:
print >>sys.stderr,"RDBG:debug started"
示例3: pca_agg_task_cv
def pca_agg_task_cv(exp, block,
train_es, test_es, gene_sets,
base_filename,
):
"""
@type train_es, test_es: ExpressionSet
@type gene_sets: GeneSets
"""
df_train = train_es.get_assay_data_frame()
df_test = test_es.get_assay_data_frame()
src_gs = gene_sets.get_gs()
if settings.CELERY_DEBUG:
import sys
sys.path.append('/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg')
import pydevd
pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
df_train, src_gs_train = preprocess_df_gs(df_train, src_gs)
df_test, src_gs_test = preprocess_df_gs(df_test, src_gs)
result_df_train, result_df_test = pca_agg_cv(df_train, df_test, src_gs_train.genes)
result_train = train_es.clone(base_filename + "_train")
result_train.store_assay_data_frame(result_df_train)
result_train.store_pheno_data_frame(train_es.get_pheno_data_frame())
result_test = test_es.clone(base_filename + "_test")
result_test.store_assay_data_frame(result_df_test)
result_test.store_pheno_data_frame(test_es.get_pheno_data_frame())
return [result_train, result_test], {}
示例4: slot_stop
def slot_stop(self):
try:
pydevd.settrace(suspend=False)
except:
pass
self._set_state(ConStates.STATE_STOPPED)
self.sigStopped.emit()
示例5: main
def main(argv=None):
log.info('started application')
log.warning('This script is obsolete. It will not be updated anymore and ' +
'will be deleted in the future. Use use_model.py instead.')
if argv is None:
argv = sys.argv[1:]
args = parser.parse_args()
log.info('start parameters: ' + str(args))
if args.debug_host:
import pydevd
pydevd.settrace(host=args.debug_host, stdoutToServer=True,
stderrToServer=True)
if log.level == logging.DEBUG:
sys.excepthook = debug
log.info('creating predictor')
predictor = vLblNCEPredictor()
predictor.prepare_usage(args)
log.info('starting prediction')
predictor.run()
log.info('finished')
示例6: aggregation_task
def aggregation_task(exp, block,
mode, c,
m_rna_es, mi_rna_es, interaction_matrix,
base_filename,
):
"""
@type m_rna_es: ExpressionSet
@type mi_rna_es: ExpressionSet
@type interaction_matrix: BinaryInteraction
"""
if settings.CELERY_DEBUG:
import sys
sys.path.append('/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg')
import pydevd
pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
agg_func = svd_agg
if mode == "SVD":
agg_func = svd_agg
elif mode == "SUB":
agg_func = sub_agg
inter_units = None
m_rna = None
if interaction_matrix.x1_unit == 'RefSeq':
inter_units = interaction_matrix.load_pairs().iloc[:, 0].tolist()
if inter_units:
m_rna = m_rna_es.get_assay_data_frame_for_platform(exp, inter_units)
else:
m_rna = m_rna_es.get_assay_data_frame()
mi_rna = mi_rna_es.get_assay_data_frame()
gene_platform = list(m_rna.columns)
mi_rna_platform = list(mi_rna)
AllUpdated(
exp.pk,
comment=u"Transforming interaction matrix",
silent=False,
mode=NotifyMode.INFO
).send()
targets_matrix = interaction_matrix.get_matrix_for_platform(exp, gene_platform, mi_rna_platform, symmetrize=False, identifiers=True)
AllUpdated(
exp.pk,
comment=u"Transforming interaction matrix done",
silent=False,
mode=NotifyMode.INFO
).send()
# targets_matrix = interaction_matrix.load_matrix()
result_df = agg_func(m_rna, mi_rna, targets_matrix, c)
result = m_rna_es.clone(base_filename)
result.store_assay_data_frame(result_df)
result.store_pheno_data_frame(mi_rna_es.get_pheno_data_frame())
return [result], {}
示例7: connect
def connect(self):
self.updatePydevdPath()
import pydevd
# Return if already connected
if pydevd.connected:
qt.QMessageBox.warning(slicer.util.mainWindow(),
"Connect to PyDev remote debug server", 'You are already connected to the remote debugger. If the connection is broken (e.g., because the server terminated the connection) then you need to restart Slicer to be able to connect again.')
return
# Show a dialog that explains that Slicer will hang
self.info = qt.QDialog()
self.info.setModal(False)
self.infoLayout = qt.QVBoxLayout()
self.info.setLayout(self.infoLayout)
self.label = qt.QLabel("Connecting to remote debug server at port {0}...\nSlicer is paused until {1} accepts the connection.".format(self.portNumber,self.getDebugger()),self.info)
self.infoLayout.addWidget(self.label)
self.info.show()
self.info.repaint()
qt.QTimer.singleShot(2000, self.onConnectionComplete)
# Connect to the debugger
try:
pydevd.settrace('localhost', port=self.portNumber, stdoutToServer=True, stderrToServer=True, suspend=False)
except Exception, e:
self.info.hide()
import traceback
traceback.print_exc()
qt.QMessageBox.warning(slicer.util.mainWindow(),
"Connect to PyDev remote debug server", 'An error occurred while trying to connect to PyDev remote debugger. Make sure he pydev server is started.\n\n' + str(e))
if self.connectionCompleteCallback:
self.connectionCompleteCallback(False)
return
示例8: create_app
def create_app(db_url):
"""This is a test
:param db_url: connection url to the database being used
:returns: the initialized and created app instance
"""
app = Flask(__name__)
(app.db_session, app.db_metadata, app.db_engine) = init_db(db_url)
@app.teardown_request
def shutdown_session(exception=None):
app.db_session.remove()
create_api(app, API_VERSION)
# support for remote debugging in Intellij and pycharm
#
# Set IDEA_ORGANISATIONS_REMOTE_DEBUG_ON to True in your environment
# prior to starting the application to get remote debugging.
#
# Set IDEA_REMOTE_DEBUG_SERVER to the ip/hostname of the machine running the
# debug server.
#
# Set IDEA_ORGANISATIONS_REMOTE_DEBUG_SERVER to the port of the debug server prosess
#
# For the remote debugging to work you will also have to make sure
# the pycharm-debug.egg is on your path (check your environment file).
if os.environ.get('IDEA_ORGANISATIONS_REMOTE_DEBUG_ON') == 'True':
server = os.environ.get('IDEA_REMOTE_DEBUG_SERVER')
port = os.environ.get('IDEA_ORGANISATIONS_REMOTE_DEBUG_PORT')
app.logger.info("Idea remote debugging is on! Will connect to debug server running on %s:%s" % (server, port))
import pydevd
pydevd.settrace(server, port=int(port), stdoutToServer=True, stderrToServer=True)
return app
示例9: threshold_task
def threshold_task(exp, block,
es,
T,
base_filename,
):
# def removeTemporaryNegativeFeatures(S, indicator_string = 'negative_feature___'):
# """Remove elements starting with the indicator_string and remove possible duplicates."""
# return S.apply(lambda list_element: set([s.replace(indicator_string, '') for s in list_element]))
"""Computes co-comodules from matrix H by given threshold T."""
if settings.CELERY_DEBUG:
import sys
sys.path.append('/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg')
import pydevd
pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
H = es.get_assay_data_frame()
print(H)
# mu = np.mean(H, axis = 1)
# sigma = np.std(H, axis = 1)
# Z = H.apply(lambda z: (z-mu)/sigma, axis = 0)
# S = []
# S.append(removeTemporaryNegativeFeatures(Z.apply(lambda x: Z.columns[x >= T].tolist(), axis = 1)))
# S = pd.DataFrame(S)
# S = S.apply(lambda x: set.union(*x))
# result = pd.DataFrame(S)
from wrappers.snmnmf.evaluation import EnrichmentInGeneSets
z = 1
x = EnrichmentInGeneSets(z)
result = x.getGeneSet(H, T)
cs = ComoduleSet(exp.get_data_folder(), base_filename)
cs.store_set(result)
return [cs], {}
示例10: merge_comodules_task
def merge_comodules_task(exp, block,
cs_1,
cs_2,
cs_1_name,
cs_2_name,
base_filename,
):
if settings.CELERY_DEBUG:
import sys
sys.path.append('/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg')
import pydevd
pydevd.settrace('localhost', port=6901, stdoutToServer=True, stderrToServer=True)
CS1 = cs_1.load_set()
CS2 = cs_2.load_set()
df = merge(CS1, CS2, left_index=True, right_index=True, how='outer')
df.columns = [cs_1_name, cs_2_name]
# df = CS1.join(CS2)
# df = pd.DataFrame({'genes':CS1.values, 'miRNAs':CS2.values}, index=CS1.index)
print(df.info())
cs = ComoduleSet(exp.get_data_folder(), base_filename)
cs.store_set(df)
return [cs], {}
示例11: merge_two_es
def merge_two_es(exp, block, es_1, es_2, con, base_filename):
"""
@type es_1: ExpressionSet
@type es_2: ExpressionSet
"""
if settings.CELERY_DEBUG:
import sys
sys.path.append("/Migration/skola/phd/projects/miXGENE/mixgene_project/wrappers/pycharm-debug.egg")
import pydevd
pydevd.settrace("localhost", port=6901, stdoutToServer=True, stderrToServer=True)
merged_es = es_1.clone(base_filename)
try:
merged_es.store_pheno_data_frame(es_1.get_pheno_data_frame())
except RuntimeError as e:
pass
axis = 0
assay_df_1 = es_1.get_assay_data_frame()
assay_df_2 = es_2.get_assay_data_frame()
if con == "CC":
axis = 1
merged_assay_df = pd.concat([assay_df_1, assay_df_2], axis=axis)
merged_es.store_assay_data_frame(merged_assay_df)
return [merged_es], {}
示例12: run
def run(self):
if has_pydevd and is_debug:
pydevd.settrace('localhost', port=53100, stdoutToServer=True, stderrToServer=True)
self.running = True
# reset all the errors
self.problem_nodes = []
for k, v in self.unlink_errors.iteritems():
self.unlink_errors[k]=[]
datastore = self.unlinks_layer.storageType().lower()
if 'spatialite' in datastore or 'postgresql' in datastore:
# get the relevant layers names
start_time = time.time()
unlinkname = uf.getDBLayerTableName(self.unlinks_layer)
axialname = uf.getDBLayerTableName(self.axial_layer)
if not uf.testSameDatabase([self.unlinks_layer, self.axial_layer]):
self.verificationError.emit("The map layer must be in the same database as the unlinks layer.")
return
connection = uf.getDBLayerConnection(self.unlinks_layer)
# get the geometry column name and other properties
if 'spatialite' in datastore:
unlinkgeom = uf.getSpatialiteGeometryColumn(connection, unlinkname)
axialgeom = uf.getSpatialiteGeometryColumn(connection, axialname)
else:
unlinkinfo = uf.getPostgisLayerInfo(self.unlinks_layer)
unlinkgeom = uf.getPostgisGeometryColumn(connection, unlinkinfo['schema'], unlinkname)
axialinfo = uf.getPostgisLayerInfo(self.axial_layer)
axialgeom = uf.getPostgisGeometryColumn(connection, axialinfo['schema'], axialname)
# todo: ensure that it has a spatial index
#uf.createPostgisSpatialIndex(self.connection, unlinkinfo['schema'], unlinkname, unlinkgeom)
print "Preparing the map: %s" % str(time.time()-start_time)
self.verificationProgress.emit(5)
# update the unlinks
start_time = time.time()
if 'spatialite' in datastore:
added = uf.addSpatialiteColumns(connection, unlinkname, ['line1','line2'], [QVariant.Int,QVariant.Int])
else:
added = uf.addPostgisColumns(connection, unlinkinfo['schema'], unlinkname, ['line1','line2'], [QVariant.Int,QVariant.Int])
print "Updating unlinks: %s" % str(time.time()-start_time)
self.verificationProgress.emit(10)
# analyse the unlinks
start_time = time.time()
if 'spatialite' in datastore:
self.spatialiteTestUnlinks(connection, unlinkname, unlinkgeom, axialname, axialgeom)
else:
self.postgisTestUnlinks(connection, unlinkinfo['schema'], unlinkname, unlinkgeom, axialinfo['schema'], axialname, axialgeom)
print "Analysing unlinks: %s" % str(time.time()-start_time)
self.verificationProgress.emit(100)
connection.close()
else:
# add attributes if necessary
uf.addFields(self.unlinks_layer,['line1','line2'], [QVariant.Int,QVariant.Int])
# analyse the unlinks
start_time = time.time()
self.qgisTestUnlinks()
print "Analysing unlinks: %s" % str(time.time()-start_time)
self.verificationProgress.emit(100)
# return the results
self.problem_nodes = list(set(self.problem_nodes))
self.verificationFinished.emit(self.unlink_errors, self.problem_nodes)
return
示例13: debug
def debug(port=1090):
pycharm_fol = get_link_dir(get_links_dir(), 'pycharm', throw_exception=True)
eggpath = op.join(pycharm_fol, 'debug-eggs', 'pycharm-debug-py3k.egg')
if not any('pycharm-debug' in p for p in sys.path):
sys.path.append(eggpath)
import pydevd
pydevd.settrace('localhost', port=port, stdoutToServer=True, stderrToServer=True)
示例14: run
def run(self, config, year):
"""Running MATSim. A lot of paths are relative; the base path is ${OPUS_HOME}/opus_matsim. As long as ${OPUS_HOME}
is correctly set and the matsim tarfile was unpacked in OPUS_HOME, this should work out of the box. There may eventually
be problems with the java version.
"""
try:
import pydevd
pydevd.settrace()
except: pass
logger.start_block("Starting RunTravelModel.run(...)")
self.setUp( config )
config_obj = MATSimConfigObject(config, year, self.matsim_config_full)
config_obj.marschall()
cmd = """cd %(opus_home)s/opus_matsim ; java %(vmargs)s -cp %(classpath)s %(javaclass)s %(matsim_config_file)s""" % {
'opus_home': os.environ['OPUS_HOME'],
'vmargs': "-Xmx2000m",
'classpath': "libs/log4j/log4j/1.2.15/log4j-1.2.15.jar:libs/jfree/jfreechart/1.0.7/jfreechart-1.0.7.jar:libs/jfree/jcommon/1.0.9/jcommon-1.0.9.jar:classesMATSim:classesToronto:classesTNicolai:classesKai:classesEntry", # 'classpath': "classes:jar/MATSim.jar",
'javaclass': "playground.run.Matsim4Urbansim",
'matsim_config_file': self.matsim_config_full }
logger.log_status('Running command %s' % cmd )
cmd_result = os.system(cmd)
if cmd_result != 0:
error_msg = "Matsim Run failed. Code returned by cmd was %d" % (cmd_result)
logger.log_error(error_msg)
logger.log_error("Note that currently (dec/08), paths in the matsim config files are relative to the opus_matsim root,")
logger.log_error(" which is one level 'down' from OPUS_HOME.")
raise StandardError(error_msg)
logger.end_block()
示例15: ask_for_stop
def ask_for_stop(use_back):
import pydevd
if use_back:
pydevd.settrace(stop_at_frame=sys._getframe().f_back)
else:
pydevd.settrace()
print('Will stop here if use_back==False.')