本文整理汇总了Python中collector.Collector.schedule_jobs方法的典型用法代码示例。如果您正苦于以下问题:Python Collector.schedule_jobs方法的具体用法?Python Collector.schedule_jobs怎么用?Python Collector.schedule_jobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collector.Collector
的用法示例。
在下文中一共展示了Collector.schedule_jobs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import schedule_jobs [as 别名]
class Collection:
def __init__(self, collection_name, query_name, queue_name, table_name):
self.collection_name = collection_name
self.redis_conn = get_rc()
self.table_name = table_name
self.queue = Queue('collections',connection = self.redis_conn)
self.query_name = query_name
self.collector = Collector(query_name, collection_name, queue_name)
def schedule(self, job_parameters, input_type):
self.collector.schedule_jobs(job_parameters, input_type)
finishings = map(self.add_finisher, self.collector.jobs)
return finishings
def add_finisher(self, job):
return self.queue.enqueue(
consume_data,
kwargs = {'job_id':job.id,'table_name':self.table_name},
depends_on = job
)
示例2: run_collector
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import schedule_jobs [as 别名]
def run_collector(self):
'''instigates a collector, adds the specified jobs to it,
then returns the job uuids & queue name'''
details = request.json or {}
_input = details.pop('Input')
input_type = details.pop('InputType')
collector = Collector(**details)
jobs = collector.schedule_jobs(_input, input_type)
res = {
'data':{
'jobs':jobs,
'log':collector.log_data,
},
'message':'collector initiated successfully',
}
return Response(
response = dumps(res),
status = 200,
mimetype = 'application/json'
)