Example #1
0
    def _purge_database(self, session):
        from platoon.models import Event, ScheduledTask, SubscribedTask
        platoon = get_unit('platoon.component.Platoon')

        Event.purge(session, platoon.configuration['completed_event_lifetime'])
        ScheduledTask.purge(session, platoon.configuration['completed_task_lifetime'])
        SubscribedTask.purge(session, platoon.configuration['completed_task_lifetime'])

        session.commit()
Example #2
0
    def _purge_database(self, session):
        from platoon.models import Event, ScheduledTask, SubscribedTask
        platoon = get_unit('platoon.component.Platoon')

        Event.purge(session, platoon.configuration['completed_event_lifetime'])
        ScheduledTask.purge(session,
                            platoon.configuration['completed_task_lifetime'])
        SubscribedTask.purge(session,
                             platoon.configuration['completed_task_lifetime'])

        session.commit()
Example #3
0
    def run(self):
        from platoon.models import Event, Process, ScheduledTask

        idler = self.idler
        schema = self.schema
        session = schema.session
        threads = self.threads

        ScheduledTask.retry_executing_tasks(session)

        while True:
            idler.idle()
            try:
                Event.process_events(session)
                Process.process_processes(self, session)
                ScheduledTask.process_tasks(self, session)
            finally:
                session.close()