本文整理汇总了Python中pgq.cascade.admin.CascadeAdmin类的典型用法代码示例。如果您正苦于以下问题:Python CascadeAdmin类的具体用法?Python CascadeAdmin怎么用?Python CascadeAdmin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CascadeAdmin类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: install_code
def install_code(self, db):
fn = skytools.installer_find_file('londiste.sql')
main_sql = open(fn, 'r').read()
noschema_sql = main_sql.replace('create schema', '-- create schema')
self.extra_objs = [
skytools.DBSchema("londiste", sql_file = 'londiste.sql'),
skytools.DBFunction("londiste.global_add_table", 2, sql = noschema_sql),
]
CascadeAdmin.install_code(self, db)
示例2: __init__
def __init__(self, args):
"""Londiste setup init."""
CascadeAdmin.__init__(self, 'londiste3', 'db', args, worker_setup = True)
# compat
self.queue_name = self.cf.get('pgq_queue_name', '')
# real
if not self.queue_name:
self.queue_name = self.cf.get('queue_name')
self.set_name = self.queue_name
示例3: load_extra_status
def load_extra_status(self, curs, node):
"""Fetch extra info."""
CascadeAdmin.load_extra_status(self, curs, node)
curs.execute("select * from londiste.get_table_list(%s)", [self.queue_name])
n_ok = n_half = n_ign = 0
for tbl in curs.fetchall():
if not tbl['local']:
n_ign += 1
elif tbl['merge_state'] == 'ok':
n_ok += 1
else:
n_half += 1
node.add_info_line('Tables: %d/%d/%d' % (n_ok, n_half, n_ign))
示例4: __init__
def __init__(self, args):
"""Londiste setup init."""
CascadeAdmin.__init__(self, "londiste3", "db", args, worker_setup=True)
# compat
self.queue_name = self.cf.get("pgq_queue_name", "")
# real
if not self.queue_name:
self.queue_name = self.cf.get("queue_name")
self.set_name = self.queue_name
londiste.handler.load_handler_modules(self.cf)
示例5: __init__
def __init__(self, args):
"""Londiste setup init."""
CascadeAdmin.__init__(self, 'londiste3', 'db', args, worker_setup = True)
# compat
self.queue_name = self.cf.get('pgq_queue_name', '')
# real
if not self.queue_name:
self.queue_name = self.cf.get('queue_name')
self.set_name = self.queue_name
self.lock_timeout = self.cf.getfloat('lock_timeout', 10)
londiste.handler.load_handler_modules(self.cf)
示例6: init_optparse
def init_optparse(self, parser=None):
"""Add londiste switches to cascadeadmin ones."""
p = CascadeAdmin.init_optparse(self, parser)
p.add_option("--expect-sync", action="store_true", dest="expect_sync",
help = "no copy needed", default=False)
p.add_option("--skip-truncate", action="store_true", dest="skip_truncate",
help = "dont delete old data", default=False)
p.add_option("--copy-condition", dest="copy_condition",
help = "copy: where expression")
p.add_option("--force", action="store_true",
help="force", default=False)
p.add_option("--all", action="store_true",
help="include all tables", default=False)
p.add_option("--create", action="store_true",
help="include all tables", default=False)
p.add_option("--create-only",
help="pkey,fkeys,indexes")
p.add_option("--trigger-flags",
help="Set trigger flags (BAIUDLQ)")
p.add_option("--trigger-arg", action="append",
help="Custom trigger arg")
p.add_option("--no-triggers", action="store_true",
help="Custom trigger arg")
p.add_option("--handler", action="append",
help="add: Custom handler for table")
return p
示例7: init_optparse
def init_optparse(self, parser=None):
"""Add londiste switches to cascadeadmin ones."""
p = CascadeAdmin.init_optparse(self, parser)
p.add_option("--expect-sync", action="store_true", dest="expect_sync",
help = "no copy needed", default=False)
p.add_option("--skip-truncate", action="store_true", dest="skip_truncate",
help = "dont delete old data", default=False)
p.add_option("--copy-condition", dest="copy_condition",
help = "copy: where expression")
p.add_option("--force", action="store_true",
help="force", default=False)
p.add_option("--all", action="store_true",
help="include all tables", default=False)
p.add_option("--create", action="store_true",
help="create, minimal", default=False)
p.add_option("--create-full", action="store_true",
help="create, full")
p.add_option("--trigger-flags",
help="Set trigger flags (BAIUDLQ)")
p.add_option("--trigger-arg", action="append",
help="Custom trigger arg")
p.add_option("--no-triggers", action="store_true",
help="Custom trigger arg")
p.add_option("--handler", action="store",
help="add: Custom handler for table")
p.add_option("--handler-arg", action="append",
help="add: Argument to custom handler")
p.add_option("--merge-all", action="store_true",
help="merge tables from all source queues", default=False)
p.add_option("--no-merge", action="store_true",
help="don't merge tables from source queues", default=False)
return p
示例8: init_optparse
def init_optparse(self, parser=None):
"""Add londiste switches to cascadeadmin ones."""
p = CascadeAdmin.init_optparse(self, parser)
p.add_option("--expect-sync", action="store_true", dest="expect_sync",
help = "no copy needed", default=False)
p.add_option("--skip-truncate", action="store_true", dest="skip_truncate",
help = "dont delete old data", default=False)
p.add_option("--force", action="store_true",
help="force", default=False)
p.add_option("--all", action="store_true",
help="include all tables", default=False)
p.add_option("--create", action="store_true",
help="include all tables", default=False)
p.add_option("--create-only",
help="pkey,fkeys,indexes")
return p
示例9: init_optparse
def init_optparse(self, parser=None):
"""Add londiste switches to cascadeadmin ones."""
p = CascadeAdmin.init_optparse(self, parser)
p.add_option("--expect-sync", action="store_true", dest="expect_sync",
help = "no copy needed", default=False)
p.add_option("--skip-truncate", action="store_true", dest="skip_truncate",
help = "do not delete old data", default=False)
p.add_option("--find-copy-node", action="store_true", dest="find_copy_node",
help = "add: find table source for copy by walking upwards")
p.add_option("--copy-node", metavar = "NODE", dest="copy_node",
help = "add: use NODE as source for initial copy")
p.add_option("--force", action="store_true",
help="force", default=False)
p.add_option("--all", action="store_true",
help="include all tables", default=False)
p.add_option("--wait-sync", action="store_true",
help = "add: wait until all tables are in sync"),
p.add_option("--create", action="store_true",
help="create, minimal", default=False)
p.add_option("--create-full", action="store_true",
help="create, full")
p.add_option("--trigger-flags",
help="set trigger flags (BAIUDLQ)")
p.add_option("--trigger-arg", action="append",
help="custom trigger arg")
p.add_option("--no-triggers", action="store_true",
help="no triggers on table")
p.add_option("--handler", action="store",
help="add: custom handler for table")
p.add_option("--handler-arg", action="append",
help="add: argument to custom handler")
p.add_option("--merge-all", action="store_true",
help="merge tables from all source queues", default=False)
p.add_option("--no-merge", action="store_true",
help="do not merge tables from source queues", default=False)
p.add_option("--max-parallel-copy", metavar = "NUM", type = "int",
help="max number of parallel copy processes")
p.add_option("--dest-table", metavar = "NAME",
help="add: name for actual table")
p.add_option("--skip-non-existing", action="store_true",
help="add: skip object that does not exist")
return p
示例10: install_code
def install_code(self, db):
self.extra_objs = [
skytools.DBSchema("londiste", sql_file = 'londiste.sql'),
skytools.DBFunction("londiste.global_add_table", 2, sql_file = 'londiste.upgrade.2to3.sql'),
]
CascadeAdmin.install_code(self, db)