Exemple #1
0
    def _deleteTask(self, taskId):
        task = HelperTaskList.getTaskListInstance().getTaskById(taskId)

        if isinstance(task, Alarm):
            task.conf.removeAlarm(task)
            return
        else:
            if type(task.getObjList()[0]) == PendingSubmitterReminder:
                for obj in task.getObjList():
                    for pend in obj.getPendings():
                        cpqm = pend.getConference().getPendingQueuesMgr()
                        cpqm.removePendingSubmitter(pend)
                    task.removeObj(obj)
                return
            elif type(task.getObjList()[0]) == PendingManagerReminder:
                for obj in task.getObjList():
                    for pend in obj.getPendings():
                        cpqm = pend.getConference().getPendingQueuesMgr()
                        cpqm.removePendingManager(pend)
                    task.removeObj(obj)
                return
            elif type(task.getObjList()[0]) == PendingCoordinatorReminder:
                for obj in task.getObjList():
                    for pend in obj.getPendings():
                        cpqm = pend.getConference().getPendingQueuesMgr()
                        cpqm.removePendingCoordinator(pend)
                    task.removeObj(obj)
                return
Exemple #2
0
def taskMigration(dbi, withRBDB, prevVersion):
    """
    Migrating database tasks from the old format to the new one
    """

    c = Client()

    for t in HelperTaskList().getTaskListInstance().getTasks():
        for obj in t.listObj.values():
            print console.colored("   * %s" % obj.__class__.__name__, 'blue')
            if obj.__class__.__name__ == 'FoundationSync':
                c.enqueue(
                    FoundationSyncTask(rrule.DAILY, byhour=0, byminute=0))
            elif obj.__class__.__name__ == 'StatisticsUpdater':
                c.enqueue(CategoryStatisticsUpdaterTask(
                    CategoryManager().getById('0'),
                    rrule.DAILY,
                    byhour=0, byminute=0))
            elif obj.__class__.__name__ == 'sendMail':
                # they have to be somewhere in the conference
                alarm = t.conf.alarmList[t.id]
                c.enqueue(alarm)
            else:
                raise Exception("Unknown task type!")

    if withRBDB:
        DALManager.commit()
    dbi.commit()
Exemple #3
0
 def _deleteTask(self, taskId):
     task = HelperTaskList.getTaskListInstance().getTaskById(taskId)
     
     if isinstance(task, Alarm):
         task.conf.removeAlarm(task)
         return
     else:
         if type(task.getObjList()[0]) == PendingSubmitterReminder: 
             for obj in task.getObjList():
                 for pend in obj.getPendings():
                     cpqm = pend.getConference().getPendingQueuesMgr()
                     cpqm.removePendingSubmitter(pend)
                 task.removeObj(obj)
             return
         elif type(task.getObjList()[0]) == PendingManagerReminder:
             for obj in task.getObjList():
                 for pend in obj.getPendings():
                     cpqm = pend.getConference().getPendingQueuesMgr()
                     cpqm.removePendingManager(pend)
                 task.removeObj(obj)
             return
         elif type(task.getObjList()[0]) == PendingCoordinatorReminder:
             for obj in task.getObjList():
                 for pend in obj.getPendings():
                     cpqm = pend.getConference().getPendingQueuesMgr()
                     cpqm.removePendingCoordinator(pend)
                 task.removeObj(obj)
             return
Exemple #4
0
    def create(self):
        # Create a wrapper for the RH
        rhw = RHWrapper(self._rh)
        # Instantiate a dvd creator
        if self._wf is None:
            dvdCreator = ConferenceOfflineCreator(rhw, self._conf)
        else:
            dvdCreator = MeetingOfflineCreator(rhw, self._conf)
        dvdCreator.setId("OffLineWebsiteCreator")
        
        # Create a task for the DVD Creator
        dvdTask = task()
        dvdTask.addObj(dvdCreator)

        # Add the track to the track list
        htl = HelperTaskList.getTaskListInstance()
        htl.addTask(dvdTask)
Exemple #5
0
    def create(self):
        # Create a wrapper for the RH
        rhw = RHWrapper(self._rh)
        # Instantiate a dvd creator
        if self._wf is None:
            dvdCreator = ConferenceOfflineCreator(rhw, self._conf)
        else:
            dvdCreator = MeetingOfflineCreator(rhw, self._conf)
        dvdCreator.setId("OffLineWebsiteCreator")

        # Create a task for the DVD Creator
        dvdTask = task()
        dvdTask.addObj(dvdCreator)

        # Add the task to the task list
        htl = HelperTaskList.getTaskListInstance()
        htl.addTask(dvdTask)
Exemple #6
0
 def _addTask(self, email):
     """Creating a task in order to send reminder emails periodically.
        It's mandatory to implement this method for the specific pending queues"""
     # ------ Creating a task in order to send reminder emails periodically ------
     if not self._hasTask(email):
         # Create the object which send the email
         pedingReminder=self._reminder(email)
         pedingReminder.setId("ReminderPending%s-%s"%(self._id,email))
         # Create the task
         t=task()
         t.addObj(pedingReminder) 
         t.setInterval(timedelta(7)) # Remind each 7 days
         nw=nowutc()
         t.setLastDate(nw) # start in 7 days cos the first email was already sent
         t.setEndDate(nw+timedelta(15)) # keep trying during 15 days
         self._tasksIdx.indexTask(email, t)
         # Add the track to the track list
         htl = HelperTaskList.getTaskListInstance()
         htl.addTask(t)
Exemple #7
0
 def _removeTask(self, email):
     if self._hasTask(email):
         t=self._getTasksIdx().matchTask(email)[0]
         htl = HelperTaskList.getTaskListInstance()
         htl.removeTask(t)
         self._tasksIdx.unindexTask(email, t)
Exemple #8
0
    from pytz import timezone
    try:
        from MaKaC.conference import CategoryManager
        from MaKaC.common import DBMgr
        from MaKaC.common.timerExec import HelperTaskList, StatisticsUpdater, task
        from MaKaC.common.timezoneUtils import nowutc
    except ImportError, e:
        print "ImportError:%s"%e
        sys.exit(0)


    print "\nTrying to connect with the database...\nIf you don't see any following message, please make sure that you have already started the database because you might have a connection problem with it.\n"
    DBMgr.getInstance().startRequest()
    print "Database connection established."
    # ------------------------ STATISTICS ------------------------
    tl = HelperTaskList.getTaskListInstance()
    catRoot = CategoryManager().getRoot()
    try:
        if catRoot.statsUpdater != None:
            tl.removeTask(catRoot.statsUpdater)
            catRoot.statsUpdater = None
    except:
        catRoot.statsUpdater = None
    su = StatisticsUpdater(catRoot)
    su.setId("StatisticsUpdater")
    ta = task()
    d = nowutc() + timedelta(days=1)
    ta.setStartDate(datetime(d.year, d.month, d.day, 0, 0, tzinfo=timezone('UTC')))
    ta.setInterval(timedelta(days=1))
    ta.addObj(su)
    tl.addTask(ta)
Exemple #9
0
    from datetime import timedelta, datetime
    from pytz import timezone
    try:
        from MaKaC.conference import CategoryManager
        from MaKaC.common import DBMgr
        from MaKaC.common.timerExec import HelperTaskList, StatisticsUpdater, task
        from MaKaC.common.timezoneUtils import nowutc
    except ImportError, e:
        print "ImportError:%s" % e
        sys.exit(0)

    print "\nTrying to connect with the database...\nIf you don't see any following message, please make sure that you have already started the database because you might have a connection problem with it.\n"
    DBMgr.getInstance().startRequest()
    print "Database connection established."
    # ------------------------ STATISTICS ------------------------
    tl = HelperTaskList.getTaskListInstance()
    catRoot = CategoryManager().getRoot()
    try:
        if catRoot.statsUpdater != None:
            tl.removeTask(catRoot.statsUpdater)
            catRoot.statsUpdater = None
    except:
        catRoot.statsUpdater = None
    su = StatisticsUpdater(catRoot)
    su.setId("StatisticsUpdater")
    ta = task()
    d = nowutc() + timedelta(days=1)
    ta.setStartDate(
        datetime(d.year, d.month, d.day, 0, 0, tzinfo=timezone('UTC')))
    ta.setInterval(timedelta(days=1))
    ta.addObj(su)