def handle(self, *args, **options):
        """
        generate a salary pool with a default config

        :param args:
        :param options:
        :return:
        """

        values = []
        for x in options['values']:
            values.append(x)

        # sport1 = values[0]
        # sport2 = values[1]

        rp = ReplayManager()

        #
        # flag_cache() flags the system and indicates if it should
        # record live updates or not!
        #
        # a flagged cache will expire after 24 hours however.
        rp.flag_cache(True)

        msg = 'ReplayManager recording_in_progress: %s' % str(
            rp.recording_in_progress())
        self.stdout.write(msg)
 def handle(self, *args, **options):
     """
     """
     replay_manager = ReplayManager()
     replay_manager.set_time_before_replay_start()
     self.stdout.write('[%s] is now the current time!' %
                       str(timezone.now()))
    def post(self, request, speed, *args, **kwargs):
        # note the speed value passed in may be adjusted later on if its out of range.
        # print('speed:', str(speed))
        if isinstance(speed, str):
            speed = int(speed)

        # set the cache value that tells the replayer to fast forward
        replay_manager = ReplayManager()
        replay_manager.fast_forward(speed)

        #
        return Response(status=200)
    def handle(self, *args, **options):
        """
        generate a salary pool with a default config

        :param args:
        :param options:
        :return:
        """

        rp = ReplayManager()
        rp.play_all( async=False )
    def handle(self, *args, **options):
        """
        use the replayer

        :param args:
        :param options:
        :return:
        """

        cmd = options['cmd']
        if cmd == 'play':
            pass # TODO
            self.stdout.write('play unimplemented')

        elif cmd == 'record':
            pass # TODO
            self.stdout.write('record unimplemented')

        elif cmd == 'list':
            ReplayManager.list()
    def handle(self, *args, **options):
        """
        generate a salary pool with a default config

        :param args:
        :param options:
        :return:
        """

        rp = ReplayManager()
        for update_pk in options['pk']:
            rp.play_single_update(update_pk, async=True)
Example #7
0
    def handle(self, *args, **options):
        """
        generate a salary pool with a default config

        :param args:
        :param options:
        :return:
        """

        update_pks = []
        for update_pk in options['pk']:
            update_pks.append( update_pk )

        # if there is only one update pk, run it:
        size = len(update_pks)

        # play single Update by its pk
        if len(update_pks) == 1:
            rp = ReplayManager()
            rp.play_single_update( update_pks[0], async=False )

        # play range of Updates by pk
        elif len(update_pks) == 2:

            rp = ReplayManager()
            # truncate chars is how many characters of each object to print out.
            # TODO try using the async mode with multiple tasks to test concurrency
            # TODO if you can get it working in non concurrent mode
            rp.play_range( update_pks[0], update_pks[1], async=False, truncate_chars=99999 )

        # if length is 3 and the first value in the list is
        # the max number of objects to play thru, and
        # assume the next two values are unix timestamps that form a range!
        # Note: if the end timestamp is less than or equal to the start timestamp
        # we will only play objects with the start timestamp
        # so you might use the command $> ./manage.py playupdate 0 1467338190681 0
        elif size == 3:
            max_objects = update_pks[0]
            ts_start = update_pks[1]
            ts_end = update_pks[2]

            if ts_end <= ts_start:
                ts_end = ts_start

            rp = ReplayManager()
            print('ts_start:', ts_start, 'ts_end:', ts_end, 'max_objects:', max_objects)
            rp.play_range_by_ts(ts_start, ts_end, max=max_objects, async=False, truncate_chars=99999)

        else:
            self.stdout.write('you must specify at least one update pk, or two update pks to specify a range')
    def handle(self, *args, **options):
        """
        adjust time for local replayer
        """

        cmd = options['cmd']

        if cmd == 'get':
            print(timezone.now())

        elif cmd == 'reset':
            reset_system_time()
            print('Time reset.')
            print(timezone.now())

        elif cmd == 'set' and options['when']:
            dt = parser.parse(options['when'])
            rp = ReplayManager()
            rp.set_system_time(dt)

            print('Time travel worked!')
            print(timezone.now())
 def post(self, request, *args, **kwargs):
     replay_manager = ReplayManager()
     replay_manager.flag_paused(False)
     return Response(status=200)