from __future__ import absolute_import from scheduler.Scheduler import Scheduler from common.models import * from utils.JDManipulator import * from utils.Logger import setupLogger log = setupLogger("TaskSched", "TaskSched") #class scheduling(Task): class scheduling(): #TODO Remove first parameter (useless) -> maybe both ? def run(self, first_schedule=False, alert=False): print("In scheduling.run()") # AttributeError: 'scheduling' object has no attribute 'request' ##task = TaskId.objects.create(task_id=self.request.id, task="scheduling") Log.objects.create(agent='Scheduler', message='Start schedule : ' + str(datetime.datetime.now())) # This creates a Scheduler (in memory) which creates a Schedule (in DB) self.scheduler = Scheduler() self.scheduler.setNightLimits(secondsToJulianDate(getNightStart()), secondsToJulianDate(getNightEnd())) print("****sched-task: NEW SCHEDULE", self.scheduler.schedule, "*****") self.scheduler.makeSchedule() print("****sched-task: NEW SCHEDULE", self.scheduler.schedule, "*****") Log.objects.create(agent='Scheduler', message='Scheduling finished : ' + str(datetime.datetime.now())) ##task.delete()