本文整理匯總了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'
)