本文整理汇总了Python中cola.job.loader.LimitionJobLoader.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python LimitionJobLoader.__init__方法的具体用法?Python LimitionJobLoader.__init__怎么用?Python LimitionJobLoader.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cola.job.loader.LimitionJobLoader
的用法示例。
在下文中一共展示了LimitionJobLoader.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from cola.job.loader import LimitionJobLoader [as 别名]
# 或者: from cola.job.loader.LimitionJobLoader import __init__ [as 别名]
def __init__(self, job, data_dir, nodes, client=None,
context=None, copies=1, force=False):
ctx = context or job.context
master_port = ctx.job.master_port
local = '%s:%s' % (get_ip(), master_port)
JobLoader.__init__(self, job, data_dir, local,
context=ctx, copies=copies, force=force)
LimitionJobLoader.__init__(self, job, context=ctx)
# check
self.check()
self.nodes = nodes
self.not_registered = self.nodes[:]
self.not_finished = self.nodes[:]
# mq
self.mq_client = MessageQueueClient(self.nodes, copies=copies)
# lock
self.ready_lock = threading.Lock()
self.ready_lock.acquire()
self.finish_lock = threading.Lock()
self.finish_lock.acquire()
# logger
self.logger = get_logger(
name='cola_master_%s'%self.job.real_name,
filename=os.path.join(self.root, 'job.log'),
is_master=True)
self.client = client
self.client_handler = None
if self.client is not None:
self.client_handler = add_log_client(self.logger, self.client)
self.init_rpc_server()
self.init_rate_clear()
self.init_logger_server(self.logger)
# register rpc server
self.rpc_server.register_function(self.client_stop, 'client_stop')
self.rpc_server.register_function(self.ready, 'ready')
self.rpc_server.register_function(self.worker_finish, 'worker_finish')
self.rpc_server.register_function(self.complete, 'complete')
self.rpc_server.register_function(self.error, 'error')
self.rpc_server.register_function(self.get_nodes, 'get_nodes')
self.rpc_server.register_function(self.apply, 'apply')
self.rpc_server.register_function(self.require, 'require')
self.rpc_server.register_function(self.stop, 'stop')
self.rpc_server.register_function(self.add_node, 'add_node')
self.rpc_server.register_function(self.remove_node, 'remove_node')
# register signal
signal.signal(signal.SIGINT, self.signal_handler)
signal.signal(signal.SIGTERM, self.signal_handler)
示例2: __init__
# 需要导入模块: from cola.job.loader import LimitionJobLoader [as 别名]
# 或者: from cola.job.loader.LimitionJobLoader import __init__ [as 别名]
def __init__(self, job, data_dir, master=None, local=None, nodes=None,
context=None, logger=None, copies=1, force=False):
BasicWorkerJobLoader.__init__(self, job, data_dir, context=context, logger=logger,
local=local, nodes=nodes, copies=copies, force=force)
LimitionJobLoader.__init__(self, self.job, context=context)
if self.logger is None:
self.logger = get_logger(
name='cola_worker_%s'%self.job.real_name,
filename=os.path.join(self.root, 'job.log'))
self.init_rate_clear()