Пример #1
0
 def scheduler_stop_sub(self, module_name, sub_name):
     try:
         job_id = f'{self.P.package_name}_{module_name}_{sub_name}'
         scheduler.remove_job(job_id)
     except Exception as exception:
         self.P.logger.error('Exception:%s', exception)
         self.P.logger.error(traceback.format_exc())
Пример #2
0
 def plugin_unload():
     try:
         logger.debug('%s plugin_unload', package_name)
         scheduler.remove_job('%s_recent' % package_name)
     except Exception as e:
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
Пример #3
0
 def scheduler_stop(self, sub):
     try:
         job_id = '%s_%s' % (self.P.package_name, sub)
         scheduler.remove_job(job_id)
     except Exception as exception:
         self.P.logger.error('Exception:%s', exception)
         self.P.logger.error(traceback.format_exc())
Пример #4
0
 def scheduler_stop():
     try:
         logger.debug('%s scheduler_stop' % package_name)
         scheduler.remove_job(package_name)
     except Exception as e:
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
Пример #5
0
 def scheduler_stop():
     try:
         scheduler.remove_job('ktv_process')
         #scheduler.remove_job('ktv_file_check')
     except Exception as exception:
         logger.error('Exception:%s', exception)
         logger.error(traceback.format_exc())
Пример #6
0
 def scheduler_stop(sub=None):
     try:
         tmp = '%s_%s' % (package_name, sub)
         logger.debug('%s scheduler_stop' % tmp)
         scheduler.remove_job(tmp)
     except Exception as e: 
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
Пример #7
0
 def scheduler_stop():
     try:
         for ins in Logic.gdrive_instance_list:
             ins.stop()
         scheduler.remove_job(package_name)
     except Exception as exception:
         logger.error('Exception:%s', exception)
         logger.error(traceback.format_exc())
Пример #8
0
 def scheduler_stop():
     try:
         logger.debug('auto scheduler_stop')
         Logic.kill()            
         scheduler.remove_job(package_name)
     except Exception as exception: 
         logger.error('Exception:%s', exception)
         logger.error(traceback.format_exc())
Пример #9
0
 def scheduler_stop(sub):
     try:
         job_id = '%s_%s' % (package_name, sub)
         logger.debug('%s scheduler_stop', job_id)
         scheduler.remove_job(job_id)
     except Exception as e:
         logger.error('[gallery-dl] Exception:%s', e)
         logger.error(traceback.format_exc())
Пример #10
0
    def process_ajax(self, sub, req):
        try:
            if sub == 'web_list':
                return jsonify(ModelPeriodicItem.web_list(request))
            elif sub == 'command':
                ret = {}
                command = req.form['command']
                if command == 'kill':
                    ret = self.kill(req.form['arg1'])
                elif command == 'remove_no_append_data':
                    ret = ModelPeriodicItem.remove_no_append_data()
                elif command == 'get_tasks':
                    section_list = PlexDBHandle.library_sections()
                    #logger.debug(d(section_list))
                    tasks = self.get_jobs()
                    for idx, task in enumerate(tasks):
                        for section in section_list:
                            if str(task['섹션ID']) ==  str(section['id']):
                                task['section_title'] = section['name']
                                break
                    ret = {'data' : tasks}
                elif command == 'task_sched':
                    idx = int(req.form['arg1'])
                    flag = (req.form['arg2'] == 'true')
                    job_id = f'{self.P.package_name}_periodic_{idx}'
                    ret = {'ret':'success'}
                    if flag and scheduler.is_include(job_id):
                        ret['msg'] = '이미 스케쥴러에 등록되어 있습니다.'
                    elif flag and scheduler.is_include(job_id) == False:
                        result = self.sched_add(idx)
                    elif flag == False and scheduler.is_include(job_id):
                        result = scheduler.remove_job(job_id)
                        ret['msg'] = '스케쥴링 취소'
                    elif flag == False and scheduler.is_include(job_id) == False:
                        ret['msg'] = '등록되어 있지 않습니다.'

                elif command == 'all_sched_add':
                    tasks = self.get_jobs()
                    for idx, item in enumerate(tasks):
                        if item.get('스케쥴링', '등록') == '등록':
                            self.sched_add(idx, item=item)
                    ret = {'ret' : 'success', 'msg' : 'Success'}
                elif command == 'all_sched_remove':
                    tasks = self.get_jobs()
                    for idx, item in enumerate(tasks):
                        if scheduler.is_include(item['job_id']):
                            scheduler.remove_job(item['job_id'])
                    ret = {'ret' : 'success', 'msg' : 'Success'}
                elif command == 'task_execute':
                    result = self.one_execute(int(req.form['arg1']))
                    ret = {'ret' : 'success', 'data':result}
                return jsonify(ret)
        except Exception as e: 
            P.logger.error(f'Exception:{str(e)}')
            P.logger.error(traceback.format_exc())
            return jsonify({'ret':'danger', 'msg':str(e)})
Пример #11
0
 def set_restart_scheduler():
     name = '%s_restart' % (package_name)
     if scheduler.is_include(name):
         scheduler.remove_job(name)
     interval = ModelSetting.get('auto_restart_hour')
     if interval != '0':
         if len(interval.split(' ')) == 1:
             interval = '%s' % (int(interval) * 60)
         job_instance = Job(package_name, name, interval,
                            SystemLogic.restart, u"자동 재시작", True)
         scheduler.add_job_instance(job_instance, run=False)
Пример #12
0
 def scheduler_stop():
     try:
         logger.debug('%s scheduler_stop', package_name)
         scheduler.remove_job(package_name)
         import ktv
         ktv.Logic.remove_listener(Logic.listener)
         import gdrive_scan
         gdrive_scan.Logic.remove_listener(Logic.listener)
         Logic.flag_thread_run = False
     except Exception as e: 
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
Пример #13
0
    def set_scheduler_check_scheduler():
        try:
            name = 'scheduler_check'
            if scheduler.is_include(name):
                scheduler.remove_job(name)

            job_instance = Job(package_name, name, 2,
                               scheduler.first_run_check_thread_function,
                               u"Scheduler Check", True)
            scheduler.add_job_instance(job_instance, run=False)
        except Exception as exception:
            logger.error('Exception:%s', exception)
            logger.error(traceback.format_exc())
            return False
Пример #14
0
 def scheduler_switch(id, switch):
     try:
         job = ModelCommand.get_job_by_id(id)
         s_id = 'command_%s' % id
         if switch:
             job_instance = Job(package_name, s_id, job.schedule_info, LogicNormal.execute_thread_function_by_scheduler, u"%s %s : %s" % (package_name, job.id, job.description), True, args=job.id)
             scheduler.add_job_instance(job_instance)
         else:
             if scheduler.is_include(s_id):
                 scheduler.remove_job(s_id)
         return 'success'
     except Exception as exception:
         logger.error('Exception:%s', exception)
         logger.error(traceback.format_exc())
         return 'fail'
Пример #15
0
 def scheduler_stop():
     try:
         scheduler.remove_job(package_name)
     except Exception as exception: 
         logger.error('Exception:%s', exception)
         logger.error(traceback.format_exc())
Пример #16
0
 def scheduler_stop():
     try:
         scheduler.remove_job("rclone_expand_gsheet")
     except Exception as e: 
         logger.error('Exception:%s', e)
         logger.error(traceback.format_exc())
Пример #17
0
 def scheduler_stop():
     scheduler.remove_job('%s_site' % package_name)