Пример #1
0
 def addTaskRun(self, name, status, command, cron, phonenum, email, errerkey):
     try:
         s = Job.select().where(Job.name == name, Job.status == status, Job.command == command,
                                Job.cron == cron, Job.phonenum == phonenum,
                                Job.email == email, Job.errerkey == errerkey)
         addJob(s[0])
     except Exception, e:
         print e
Пример #2
0
 def addTaskRun(self, name, status, command, cron, phonenum, email,
                errerkey):
     try:
         s = Job.select().where(Job.name == name, Job.status == status,
                                Job.command == command, Job.cron == cron,
                                Job.phonenum == phonenum,
                                Job.email == email,
                                Job.errerkey == errerkey)
         addJob(s[0])
     except Exception, e:
         print e
Пример #3
0
def reStart():
    """
    重启整个scheduler
    :return:
    """
    # 重置scheduler
    if scheduler_runing:
        scheduler.shutdown(wait=False)
    # 重新添加各种job
    dbjobs = Job.select().where(Job.status == 1)
    for dbjob in dbjobs:
        addJob(dbjob)
    scheduler.start()
Пример #4
0
 def taskList(self):
     data = Job.select()
     for d in data:
         s = d.status
         r = d.lastresult
         begin = int(d.lastbegin)
         end = int(d.lastend)
         if int(s):
             d.status = '开启'
         else:
             d.status = '关闭'
         if r == '1':
             d.lastresult = '成功'
         if r == '2':
             d.lastresult = '失败'
         if r == '3':
             d.lastresult = '运行中'
         if begin:
             x = time.localtime(begin)
             d.lastbegin = time.strftime('%Y-%m-%d %H:%M:%S', x)
         if end:
             x = time.localtime(end)
             d.lastend = time.strftime('%Y-%m-%d %H:%M:%S', x)
     return data
Пример #5
0
 def taskList(self):
     data = Job.select()
     for d in data:
         s = d.status
         r = d.lastresult
         begin = int(d.lastbegin)
         end = int(d.lastend)
         if int(s):
             d.status = '开启'
         else:
             d.status = '关闭'
         if r == '1':
             d.lastresult = '成功'
         if r == '2':
             d.lastresult = '失败'
         if r == '3':
             d.lastresult = '运行中'
         if begin:
             x = time.localtime(begin)
             d.lastbegin = time.strftime('%Y-%m-%d %H:%M:%S', x)
         if end:
             x = time.localtime(end)
             d.lastend = time.strftime('%Y-%m-%d %H:%M:%S', x)
     return data
Пример #6
0
 def updateTaskRun(self, id, update_status):
     s = Job.select().where(Job.id == id)
     return addJob(s[0], reschedule=update_status)
Пример #7
0
 def updateTaskRun(self, id, update_status):
     s = Job.select().where(Job.id == id)
     return addJob(s[0], reschedule=update_status)