Exemplo n.º 1
0
def execute_create_task():
    base = Resume51job(
        local_setting={
            'TASK_TYPE': 'SEARCH_AWAKE',
            'SOURCE': 'FIVE_ONE',
            'BACK_ENDS': settings.project_settings['BACK_ENDS']
        })

    while True:
        try:
            task_id, param = base.get_task()
            if not task_id:
                continue

            flow_no = param.get('flowNo')

            kwargs = {
                'flow_no': flow_no,
                'status': 300,
            }
            base.update_status(**kwargs)
            base.h_awake_flow_no.hset('FIVE_ONE', flow_no)
            base.logger.info('当前flow_no为: %s' % flow_no.encode('utf-8'))

            creator = CreateTask()
            creator.create_task_from_mysql()
            base.update_task(task_id=task_id)
            base.logger.info('任务生成完毕.')
        except Exception as e:
            base.logger.exception(str(e))
Exemplo n.º 2
0
def execute_create_task():
    base = ResumeZhiLianBase(
        local_setting={
            'TASK_TYPE': 'SEARCH_AWAKE',
            'SOURCE': 'ZHI_LIAN',
            # 'BACK_ENDS': 'http://10.0.4.199:5000/api/autojob'
            'BACK_ENDS': 'http://172.16.25.8:5000/api/autojob'
        })
    # base.init_search_account()

    while True:
        try:
            task_id, param = base.get_task()
            if not task_id:
                continue

            flow_no = param.get('flowNo')
            kwargs = {
                'flow_no': flow_no,
                'status': 300,
            }
            base.update_status(**kwargs)
            base.h_awake_flow_no.hset('ZHI_LIAN', flow_no)
            base.logger.info('当前flow_no为: %s' % flow_no.encode('utf-8'))

            creator = CreateTask()
            creator.create_task_from_mysql(use_keywords=True)
            base.update_task(task_id=task_id)
            base.logger.info('任务生成完毕.')
        except Exception as e:
            base.logger.exception(str(e))
Exemplo n.º 3
0
 def push_task(self):
     global locker
     locker.acquire()
     self.logger.info("开始推送纷简历任务.")
     creator = CreateTask()
     creator.create_task_from_mysql()
     locker.release()
     time.sleep(60)
Exemplo n.º 4
0
 def start_push_task(self):
     if sem_1.locked():
         return
     try:
         sem_1.acquire()
         self.logger.info('开始推送58同城唤醒任务.')
         act = CreateTask()
         act.create_task()
         sem_1.release()
     except Exception as e:
         self.logger.exception(e)
         sem_1.release()
Exemplo n.º 5
0
 def start_push_task(self):
     if sem.locked():
         return
     try:
         sem.acquire()
         self.logger.info('开始推送前程唤醒任务.')
         act = CreateTask()
         act.create_task_from_mysql(use_keywords=True)
         sem.release()
     except Exception as e:
         self.logger.exception(e)
         sem.release()
Exemplo n.º 6
0
def push_task():
    logger = utils.get_logger()
    global push_task_time
    global push_task_lock
    global push_task_keyword_tag
    if push_task_lock.locked():
        return
    # 推送任务时加锁,确保每个时刻只有一个线程在推送任务
    push_task_lock.acquire()
    if not push_task_time or (datetime.datetime.now() -
                              push_task_time).seconds > 28800:
        send_dingding_text(u'开始推送柚子招聘简历任务.')
        runner = CreateTask()
        runner.create_task_from_mysql('1')
        push_task_time = datetime.datetime.now()
    push_task_lock.release()
Exemplo n.º 7
0
def push_task():
    logger = utils.get_logger()
    global push_task_time
    global push_task_lock
    global push_task_keyword_tag
    if push_task_lock.locked():
        return
    push_task_lock.acquire()
    if not push_task_time or (datetime.datetime.now() -
                              push_task_time).seconds > 14400:
        send_dingding_text(u'开始推送柚子招聘简历任务.')
        runner = CreateTask()
        runner.create_task_from_mysql('1')
        # push_task_keyword_tag = '0' if push_task_keyword_tag == '1' else '1'
        push_task_time = datetime.datetime.now()
    push_task_lock.release()