예제 #1
0
파일: queue_legacy.py 프로젝트: cgorbit/rem
    def convert_to_v2(self):
        dikt = self.__dict__

        self.scheduler = None
        schedulers = self._get_listeners_by_type(Scheduler)
        if schedulers:
            scheduler = schedulers[0]
            self.scheduler = scheduler
            self.DropCallbackListener(scheduler)

        # TODO noninitialized

        self.working_jobs = {}

        self.packets_with_pending_jobs = PackSet.create()

        by_user_state = self.by_user_state = ByUserState()

        # XXX This is wrong, but all packets will be relocated later
        for repl in ['pending',
                    ('working', 'workable'),
                    ('worked', 'successfull'),
                    ('errored', 'error'),
                    'suspended',
                    ('waited', 'waiting')
                ]:
            src, dst = repl if isinstance(repl, tuple) else (repl, repl)
            by_user_state.__dict__[dst] = dikt.pop(src)

        self.is_suspended = dikt.pop('isSuspended')
        self.working_limit = dikt.pop('workingLimit')

        self.successfull_lifetime = dikt.pop('success_lifetime')
        #self.errored_lifetime = dikt.pop('errored_lifetime')

        self.successfull_default_lifetime = dikt.pop('successForgetTm')
        self.errored_default_lifetime = dikt.pop('errorForgetTm')

        dikt.pop('callbacks', None)
        dikt.pop('nonpersistent_callbacks', None)

        self.__class__ = LocalQueue
예제 #2
0
파일: queue_legacy.py 프로젝트: cgorbit/rem
 def convert_to_v3(self):
     super(SandboxQueue, self).convert_to_v3()
     self.pending_packets = PackSet.create(list(self.by_user_state.pending))