agent.py 922 Bytes
from common.agent import Agent
from scheduler.models import Scheduler

class SchedulerAgent(Agent):
    
    MSG_FIRST_SCHEDULE = 'First schedule'
    MSG_RESCHEDULE = 'Re-schedule'
    
    def __init__(self):
        Agent.__init__(self, Agent.SCHEDULER)
        self.actions_by_message[SchedulerAgent.MSG_FIRST_SCHEDULE] = self.first_schedule
        self.actions_by_message[SchedulerAgent.MSG_RESCHEDULE] = self.re_schedule
        

    def work(self):
        '''
            Overriding Agent's method
            Start routine of the new thread.
            
            Called once before starting the communications
        '''
        #sensiblement, le scheduler n'a rien à initialiser
        
        pass
    
    
    def first_schedule(self):
        scheduler = Scheduler()
        scheduler.make_schedule()

    
    def re_schedule(self):
        scheduler = Scheduler()
        scheduler.re_schedule()