Esempio n. 1
0
    def run_group(self, priority):
        '''Run TaskGroup of priority'''

        group = self._get_group(priority)

        if group.waiting:

            signals.send('group.before', group)
            group.push()
            group.set_status(RUNNING)

            try:

                self._run_once()

            finally:

                if not group.failed:
                    group.set_status(SUCCESS)

                signals.send('group.after', group)

        else:

            raise Exception(f('Task Group already ran: {priority}'))
Esempio n. 2
0
    def set_status(self, status):

        if self._status == status:
            return

        self.push()
        try:
            last_status = status
            self._status = status
            signals.send('request.status.changed', self, last_status, status)
        finally:
            self.pop()
Esempio n. 3
0
    def run(self):
        '''Run all TaskGroups of the action sequentially'''

        self._logger.connect()
        signals.send('action.before', self.ctx)

        try:

            for priority in self.ctx.priorities:
                self.run_group(priority)

        finally:

            signals.send('action.after', self.ctx)
            self._logger.disconnect()
Esempio n. 4
0
 def set_status(self, status):
     if self._status == status:
         return
     last_status = self._status
     self._status = status
     signals.send('group.status.changed', self, last_status, status)
Esempio n. 5
0
 def set_enabled(self, value):
     self._enabled = value
     signals.send('request.enabled', self, self._enabled)