예제 #1
0
파일: taskbase.py 프로젝트: xlliu/ct
 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
파일: taskbase.py 프로젝트: xlliu/ct
 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
파일: scheduler.py 프로젝트: xlliu/ct
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
파일: indexdao.py 프로젝트: xlliu/ct
 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
파일: taskbase.py 프로젝트: xlliu/ct
 def updateTaskRun(self, id, update_status):
     s = Job.select().where(Job.id == id)
     return addJob(s[0], reschedule=update_status)
예제 #7
0
파일: taskbase.py 프로젝트: xlliu/ct
 def updateTaskRun(self, id, update_status):
     s = Job.select().where(Job.id == id)
     return addJob(s[0], reschedule=update_status)