本文整理汇总了Python中tools.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: decommission_test
def decommission_test(self):
cluster = self.cluster
tokens = cluster.balanced_tokens(4)
cluster.populate(4, tokens=tokens).start()
node1, node2, node3, node4 = cluster.nodelist()
session = self.patient_cql_connection(node1)
self.create_ks(session, 'ks', 2)
self.create_cf(session, 'cf', columns={'c1': 'text', 'c2': 'text'})
insert_c1c2(session, n=30000, consistency=ConsistencyLevel.QUORUM)
cluster.flush()
sizes = [node.data_size() for node in cluster.nodelist() if node.is_running()]
init_size = sizes[0]
assert_almost_equal(*sizes)
time.sleep(.5)
node4.decommission()
node4.stop()
cluster.cleanup()
time.sleep(.5)
# Check we can get all the keys
for n in xrange(0, 30000):
query_c1c2(session, n, ConsistencyLevel.QUORUM)
sizes = [node.data_size() for node in cluster.nodelist() if node.is_running()]
debug(sizes)
assert_almost_equal(sizes[0], sizes[1])
assert_almost_equal((2.0 / 3.0) * sizes[0], sizes[2])
assert_almost_equal(sizes[2], init_size)
开发者ID:radicalbit,项目名称:cassandra-dtest,代码行数:33,代码来源:topology_test.py
示例2: setCustomFields
def setCustomFields(self, key, updates):
"""Set a list of fields for this issue in Jira
The updates parameter is a dictionary of key values where the key is the custom field name
and the value is the new value to set.
/!\ This only works for fields of type text.
"""
issue = self.getIssue(key)
update = {'fields': {}}
for updatename, updatevalue in updates.items():
remotevalue = issue.get('named').get(updatename)
if not remotevalue or remotevalue != updatevalue:
fieldkey = [k for k, v in issue.get('names').iteritems() if v == updatename][0]
update['fields'][fieldkey] = updatevalue
if not update['fields']:
# No fields to update
debug('No updates required')
return True
resp = self.request('issue/%s' % (str(key)), method='PUT', data=json.dumps(update))
if resp['status'] != 204:
raise JiraException('Issue was not updated: %s' % (str(resp['status'])))
return True
开发者ID:danpoltawski,项目名称:mdk,代码行数:29,代码来源:jira.py
示例3: resolveMultiple
def resolveMultiple(self, names = []):
"""Return multiple instances"""
if type(names) != list:
if type(names) == str:
names = list(names)
else:
raise Exception('Unexpected variable type')
# Nothing has been passed, we use resolve()
if len(names) < 1:
M = self.resolve()
if M:
return [ M ]
else:
return [ ]
# Try to resolve each instance
result = []
for name in names:
M = self.resolve(name = name)
if M:
result.append(M)
else:
debug('Could not find instance called %s' % name)
return result
开发者ID:danpoltawski,项目名称:mdk,代码行数:25,代码来源:workplace.py
示例4: enable
def enable():
result = (None, None, None)
try:
debug('Enabling Behat')
result = self.cli('/admin/tool/behat/cli/util.php', args='--enable')
except:
pass
return result
开发者ID:danpoltawski,项目名称:mdk,代码行数:8,代码来源:moodle.py
示例5: install
def install():
result = (None, None, None)
try:
debug('Installing Behat tables')
result = self.cli('/admin/tool/behat/cli/util.php', args='--install', stdout=None, stderr=None)
except:
pass
return result
开发者ID:danpoltawski,项目名称:mdk,代码行数:8,代码来源:moodle.py
示例6: drop
def drop():
result = (None, None, None)
try:
debug('Dropping database')
result = self.cli('/admin/tool/behat/cli/util.php', args='--drop', stdout=None, stderr=None)
except:
pass
return result
开发者ID:danpoltawski,项目名称:mdk,代码行数:8,代码来源:moodle.py
示例7: export_products
def export_products(self, cr, uid, ids, context=None):
if context is None: context = {}
shop_ids = self.pool.get('sale.shop').search(cr, uid, [])
for referential_id in ids:
for shop in self.pool.get('sale.shop').browse(cr, uid, shop_ids, context):
context['conn_obj'] = self.external_connection(cr, uid, referential_id, context=context)
#shop.export_catalog
tools.debug((cr, uid, shop, context,))
shop.export_products(cr, uid, shop, context)
return True
开发者ID:vnc-biz,项目名称:openerp-magento,代码行数:10,代码来源:magerp_core.py
示例8: checkCachedClones
def checkCachedClones(self, stable = True, integration = True):
"""Clone the official repository in a local cache"""
cacheStable = os.path.join(self.cache, 'moodle.git')
cacheIntegration = os.path.join(self.cache, 'integration.git')
if not os.path.isdir(cacheStable) and stable:
debug('Cloning stable repository into cache...')
result = process('%s clone %s %s' % (C.get('git'), C.get('remotes.stable'), cacheStable))
result = process('%s fetch -a' % C.get('git'), cacheStable)
if not os.path.isdir(cacheIntegration) and integration:
debug('Cloning integration repository into cache...')
result = process('%s clone %s %s' % (C.get('git'), C.get('remotes.integration'), cacheIntegration))
result = process('%s fetch -a' % C.get('git'), cacheIntegration)
开发者ID:danpoltawski,项目名称:mdk,代码行数:12,代码来源:workplace.py
示例9: _sale_shop
def _sale_shop(self, cr, uid, callback, context=None):
if context is None:
context = {}
proxy = self.pool.get('sale.shop')
domain = [ ('magento_shop', '=', True), ('auto_import', '=', True) ]
ids = proxy.search(cr, uid, domain, context=context)
if ids:
callback(cr, uid, ids, context=context)
tools.debug(callback)
tools.debug(ids)
return True
开发者ID:Georgeliang,项目名称:magentoerpconnect,代码行数:13,代码来源:sale.py
示例10: crash_during_decommission_test
def crash_during_decommission_test(self):
"""
If a node crashes whilst another node is being decommissioned,
upon restarting the crashed node should not have invalid entries
for the decommissioned node
@jira_ticket CASSANDRA-10231
"""
cluster = self.cluster
cluster.populate(3).start(wait_other_notice=True)
node1, node2 = cluster.nodelist()[0:2]
t = DecommissionInParallel(node1)
t.start()
null_status_pattern = re.compile(".N(?:\s*)127\.0\.0\.1(?:.*)null(?:\s*)rack1")
while t.is_alive():
out = self.show_status(node2)
if null_status_pattern.search(out):
debug("Matched null status entry")
break
debug("Restarting node2")
node2.stop(gently=False)
node2.start(wait_for_binary_proto=True, wait_other_notice=False)
debug("Waiting for decommission to complete")
t.join()
self.show_status(node2)
debug("Sleeping for 30 seconds to allow gossip updates")
time.sleep(30)
out = self.show_status(node2)
self.assertFalse(null_status_pattern.search(out))
开发者ID:radicalbit,项目名称:cassandra-dtest,代码行数:33,代码来源:topology_test.py
示例11: _zoook_sale_shop
def _zoook_sale_shop(self, cr, uid, callback, context=None):
"""
Sale Shop Schedules
"""
if context is None:
context = {}
ids = self.pool.get('sale.shop').search(cr, uid, [('zoook_shop', '=', True),('zoook_automatic_export', '=', True)], context=context)
if ids:
callback(cr, uid, ids, context=context)
tools.debug(callback)
tools.debug(ids)
return True
开发者ID:eoconsulting,项目名称:openerp-esale,代码行数:15,代码来源:sale.py
示例12: index_query_test
def index_query_test(self):
"""
Check that a secondary index query times out
"""
cluster = self.cluster
cluster.set_configuration_options(values={'read_request_timeout_in_ms': 1000})
cluster.populate(1).start(wait_for_binary_proto=True, jvm_args=["-Dcassandra.monitoring_check_interval_ms=50",
"-Dcassandra.test.read_iteration_delay_ms=1500"]) # see above for explanation
node = cluster.nodelist()[0]
session = self.patient_cql_connection(node)
self.create_ks(session, 'ks', 1)
session.execute("""
CREATE TABLE test3 (
id int PRIMARY KEY,
col int,
val text
);
""")
session.execute("CREATE INDEX ON test3 (col)")
for i in xrange(500):
session.execute("INSERT INTO test3 (id, col, val) VALUES ({}, {}, 'foo')".format(i, i // 10))
mark = node.mark_log()
statement = session.prepare("SELECT * from test3 WHERE col < ? ALLOW FILTERING")
statement.consistency_level = ConsistencyLevel.ONE
statement.retry_policy = FallthroughRetryPolicy()
assert_unavailable(lambda c: debug(c.execute(statement, [50])), session)
node.watch_log_for("Some operations timed out", from_mark=mark, timeout=60)
开发者ID:JeremiahDJordan,项目名称:cassandra-dtest,代码行数:32,代码来源:cql_tests.py
示例13: index_query_test
def index_query_test(self):
"""
Check that a secondary index query times out
"""
cluster = self.cluster
cluster.set_configuration_options(values={'read_request_timeout_in_ms': 1000})
cluster.populate(1).start(wait_for_binary_proto=True, jvm_args=["-Dcassandra.test.read_iteration_delay_ms=100"]) # see above for explanation
node = cluster.nodelist()[0]
session = self.patient_cql_connection(node)
self.create_ks(session, 'ks', 1)
session.execute("""
CREATE TABLE test3 (
id int PRIMARY KEY,
col int,
val text
);
""")
session.execute("CREATE INDEX ON test3 (col)")
for i in xrange(500):
session.execute("INSERT INTO test3 (id, col, val) VALUES ({}, {}, 'foo')".format(i, i // 10))
mark = node.mark_log()
assert_unavailable(lambda c: debug(c.execute("SELECT * from test3 WHERE col < 50 ALLOW FILTERING")), session)
node.watch_log_for("<SELECT \* FROM ks.test3 WHERE col < 50 (.*)> timed out", from_mark=mark, timeout=30)
开发者ID:steveandwang,项目名称:cassandra-dtest,代码行数:28,代码来源:cql_tests.py
示例14: materialized_view_test
def materialized_view_test(self):
"""
Check that a materialized view query times out
"""
cluster = self.cluster
cluster.set_configuration_options(values={'read_request_timeout_in_ms': 1000})
cluster.populate(2)
node1, node2 = cluster.nodelist()
node1.start(wait_for_binary_proto=True, join_ring=False) # ensure other node executes queries
node2.start(wait_for_binary_proto=True, jvm_args=["-Dcassandra.monitoring_check_interval_ms=50",
"-Dcassandra.test.read_iteration_delay_ms=1500"]) # see above for explanation
session = self.patient_exclusive_cql_connection(node1)
self.create_ks(session, 'ks', 1)
session.execute("""
CREATE TABLE test4 (
id int PRIMARY KEY,
col int,
val text
);
""")
session.execute(("CREATE MATERIALIZED VIEW mv AS SELECT * FROM test4 "
"WHERE col IS NOT NULL AND id IS NOT NULL PRIMARY KEY (col, id)"))
for i in xrange(50):
session.execute("INSERT INTO test4 (id, col, val) VALUES ({}, {}, 'foo')".format(i, i // 10))
mark = node2.mark_log()
statement = SimpleStatement("SELECT * FROM mv WHERE col = 50", consistency_level=ConsistencyLevel.ONE, retry_policy=FallthroughRetryPolicy())
assert_unavailable(lambda c: debug(c.execute(statement)), session)
node2.watch_log_for("Some operations timed out", from_mark=mark, timeout=60)
开发者ID:JeremiahDJordan,项目名称:cassandra-dtest,代码行数:35,代码来源:cql_tests.py
示例15: local_query_test
def local_query_test(self):
"""
Check that a query running on the local coordinator node times out
"""
cluster = self.cluster
cluster.set_configuration_options(values={'read_request_timeout_in_ms': 1000})
# cassandra.test.read_iteration_delay_ms causes the state tracking read iterators
# introduced by CASSANDRA-7392 to pause by the specified amount of milliseconds during each
# iteration of non system queries, so that these queries take much longer to complete,
# see ReadCommand.withStateTracking()
cluster.populate(1).start(wait_for_binary_proto=True, jvm_args=["-Dcassandra.test.read_iteration_delay_ms=100"])
node = cluster.nodelist()[0]
session = self.patient_cql_connection(node)
self.create_ks(session, 'ks', 1)
session.execute("""
CREATE TABLE test1 (
id int PRIMARY KEY,
val text
);
""")
for i in xrange(500):
session.execute("INSERT INTO test1 (id, val) VALUES ({}, 'foo')".format(i))
mark = node.mark_log()
assert_unavailable(lambda c: debug(c.execute("SELECT * from test1")), session)
node.watch_log_for("<SELECT \* FROM ks.test1 (.*)> timed out", from_mark=mark, timeout=30)
开发者ID:steveandwang,项目名称:cassandra-dtest,代码行数:29,代码来源:cql_tests.py
示例16: remote_query_test
def remote_query_test(self):
"""
Check that a query running on a node other than the coordinator times out
"""
cluster = self.cluster
cluster.set_configuration_options(values={'read_request_timeout_in_ms': 1000})
cluster.populate(2)
node1, node2 = cluster.nodelist()
node1.start(wait_for_binary_proto=True, jvm_args=["-Djoin_ring=false"]) # ensure other node executes queries
node2.start(wait_for_binary_proto=True, jvm_args=["-Dcassandra.test.read_iteration_delay_ms=100"]) # see above for explanation
session = self.patient_exclusive_cql_connection(node1)
self.create_ks(session, 'ks', 1)
session.execute("""
CREATE TABLE test2 (
id int PRIMARY KEY,
val text
);
""")
for i in xrange(500):
session.execute("INSERT INTO test2 (id, val) VALUES ({}, 'foo')".format(i))
mark = node2.mark_log()
assert_unavailable(lambda c: debug(c.execute("SELECT * from test2")), session)
node2.watch_log_for("<SELECT \* FROM ks.test2 (.*)> timed out", from_mark=mark, timeout=30)
开发者ID:steveandwang,项目名称:cassandra-dtest,代码行数:29,代码来源:cql_tests.py
示例17: remote_query_test
def remote_query_test(self):
"""
Check that a query running on a node other than the coordinator times out
"""
cluster = self.cluster
cluster.set_configuration_options(values={'read_request_timeout_in_ms': 1000})
cluster.populate(2)
node1, node2 = cluster.nodelist()
node1.start(wait_for_binary_proto=True, join_ring=False) # ensure other node executes queries
node2.start(wait_for_binary_proto=True, jvm_args=["-Dcassandra.monitoring_check_interval_ms=50",
"-Dcassandra.test.read_iteration_delay_ms=1500"]) # see above for explanation
session = self.patient_exclusive_cql_connection(node1)
self.create_ks(session, 'ks', 1)
session.execute("""
CREATE TABLE test2 (
id int,
col int,
val text,
PRIMARY KEY(id, col)
);
""")
for i in xrange(500):
for j in xrange(10):
session.execute("INSERT INTO test2 (id, col, val) VALUES ({}, {}, 'foo')".format(i, j))
mark = node2.mark_log()
statement = SimpleStatement("SELECT * from test2", consistency_level=ConsistencyLevel.ONE, retry_policy=FallthroughRetryPolicy())
assert_unavailable(lambda c: debug(c.execute(statement)), session)
statement = SimpleStatement("SELECT * from test2 where id = 1", consistency_level=ConsistencyLevel.ONE, retry_policy=FallthroughRetryPolicy())
assert_unavailable(lambda c: debug(c.execute(statement)), session)
statement = SimpleStatement("SELECT * from test2 where id IN (1, 10, 20) AND col < 10", consistency_level=ConsistencyLevel.ONE, retry_policy=FallthroughRetryPolicy())
assert_unavailable(lambda c: debug(c.execute(statement)), session)
statement = SimpleStatement("SELECT * from test2 where col > 5 ALLOW FILTERING", consistency_level=ConsistencyLevel.ONE, retry_policy=FallthroughRetryPolicy())
assert_unavailable(lambda c: debug(c.execute(statement)), session)
node2.watch_log_for("Some operations timed out", from_mark=mark, timeout=60)
开发者ID:JeremiahDJordan,项目名称:cassandra-dtest,代码行数:45,代码来源:cql_tests.py
示例18: execute
def execute(self, cr, uid, ids, context=None):
res = super(WizardMultiChartsAccounts, self).execute(cr, uid, ids, context)
#getting the wizard object
obj_self = self.browse(cr,uid,ids[0])
#getting the id of the company from the wizard
id_companny = obj_self.company_id.id
#getting the char_id from the wizard object
id_char_template = obj_self.chart_template_id
#getting the list of journal_templates
lista = self.pool.get('account.journal.template').search(cr, uid, [('chart_template_id','=',id_char_template)])
for x in lista:
obj = self.pool.get('account.journal.template').browse(cr,uid,x)
vals = {
'name' : obj.name,
'code' : obj.code,
'type' : obj.type,
'currency' : obj.currency,
'allow_date' : obj.allow_date,
'centralisation' : obj.centralisation,
'entry_posted' : obj.entry_posted,
'update_posted' : obj.update_posted,
'group_invoice_lines' : obj.group_invoice_lines,
'sequence_id' : obj.sequence_id.id,
'view_id' : obj.view_id.id,
'default_credit_account_id': obj.default_credit_account_id.id,
'default_debit_account_id' : obj.default_debit_account_id.id,
'company_id': id_companny,
}
debug(obj.view_id.id)
journal = self.pool.get('account.journal')
journal.create(cr,uid,vals, context=context)
return res
开发者ID:3dfxsoftware,项目名称:cbss-addons,代码行数:42,代码来源:account_journal_template.py
示例19: updateCachedClones
def updateCachedClones(self, integration = True, stable = True, verbose = True):
"""Update the cached clone of the repositories"""
caches = []
remote = 'origin'
if integration:
caches.append(os.path.join(self.cache, 'integration.git'))
if stable:
caches.append(os.path.join(self.cache, 'moodle.git'))
for cache in caches:
if not os.path.isdir(cache):
continue
repo = git.Git(cache, C.get('git'))
verbose and debug('Working on %s...' % cache)
verbose and debug('Fetching %s' % remote)
if not repo.fetch(remote):
raise Exception('Could not fetch %s in repository %s' % (remote, cache))
remotebranches = repo.remoteBranches(remote)
for hash, branch in remotebranches:
verbose and debug('Updating branch %s' % branch)
track = '%s/%s' % (remote, branch)
if not repo.hasBranch(branch) and not repo.createBranch(branch, track = track):
raise Exception('Could not create branch %s tracking %s in repository %s' % (branch, track, cache))
if not repo.checkout(branch):
raise Exception('Error while checking out branch %s in repository %s' % (branch, cache))
if not repo.reset(to = track, hard = True):
raise Exception('Could not hard reset to %s in repository %s' % (branch, cache))
verbose and debug('')
return True
开发者ID:danpoltawski,项目名称:mdk,代码行数:38,代码来源:workplace.py
示例20: change_currency
def change_currency(self, cr, uid, ids, context=None):
obj_so = self.pool.get('sale.order')
obj_so_line = self.pool.get('sale.order.line')
obj_currency = self.pool.get('res.currency')
data = self.read(cr, uid, ids)[0]
new_pricelist_id = data['pricelist_id']
sorder = obj_so.browse(cr, uid, context['active_id'], context=context)
#new_pricelist_id = sorder.pricelist_id and sorder.pricelist_id.id or False
new_currency = self.pool.get('product.pricelist').browse(cr,uid,new_pricelist_id).currency_id.id
if sorder.pricelist_id.currency_id.id == new_currency:
return {}
rate = obj_currency.browse(cr, uid, new_currency).rate
debug(sorder.order_line)
for line in sorder.order_line:
new_price = 0
if sorder.company_id.currency_id.id == sorder.pricelist_id.currency_id.id:
new_price = line.price_unit * rate
if new_price <= 0:
raise osv.except_osv(_('Error'), _('New currency is not confirured properly !'))
if sorder.company_id.currency_id.id != sorder.pricelist_id.currency_id.id and sorder.company_id.currency_id.id == new_currency:
old_rate = sorder.pricelist_id.currency_id.rate
if old_rate <= 0:
raise osv.except_osv(_('Error'), _('Currnt currency is not confirured properly !'))
new_price = line.price_unit / old_rate
if sorder.company_id.currency_id.id != sorder.pricelist_id.currency_id.id and sorder.company_id.currency_id.id != new_currency:
old_rate = sorder.pricelist_id.currency_id.rate
if old_rate <= 0:
raise osv.except_osv(_('Error'), _('Current currency is not confirured properly !'))
new_price = (line.price_unit / old_rate ) * rate
obj_so_line.write(cr, uid, [line.id], {'price_unit': new_price})
obj_so.write(cr, uid, [sorder.id], {'pricelist_id': new_pricelist_id})
return {'type': 'ir.actions.act_window_close'}
开发者ID:3dfxsoftware,项目名称:cbss-addons,代码行数:38,代码来源:sale_change_pricelist.py
注:本文中的tools.debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论