Пример #1
0
 def post(self):
     username = self.get_current_user()
     self.session = self.application.session
     self.session = validate_session(self.session)
     self.sched = self.application.scheduler
     jobname = None
     try:
         jobname = self.get_argument('jobname')
     except Exception as e:
         self.write("Wrong arguement passed"+
         " %s, the argument needed is jobname" % (e))
     result = remove_job(self.sched, jobname, username=username)
     self.session.close()
     self.set_header('Content-Type', 'application/json')
     self.write(json.dumps(result, indent=4))
Пример #2
0
        )
        if not job_exist:
            sched.add_cron_job(
                job['job'], hour=job['hour'],
                minute=job['minute'], name=job['name'],
                jobstore=jobstore_name,
                max_instances=job['max_instances'],
                coalesce=job['coalesce']
            )
            logger.info('job %s added' % (job['name']))

        else:
            logger.info('job %s exists' % (job['name']))
            logger.info('removing job %s' % (job['name']))
            remove_job(
                sched, job['name'], 
                jobstore_name,
                username
            )
            sched.add_cron_job(
                job['job'], hour=job['hour'],
                minute=job['minute'], name=job['name'],
                jobstore=jobstore_name,
                max_instances=job['max_instances'],
                coalesce=job['coalesce']
            )
            logger.info('job %s added' % (job['name']))

    while True:
        sleep(60)