コード例 #1
0
    def handle(self, pillow_name, **options):
        confirm(
            "Are you sure you want to reset the checkpoint for the '{}' pillow?"
            .format(pillow_name))
        confirm("Have you stopped the pillow?")

        pillow = get_pillow_by_name(pillow_name)
        if not pillow:
            raise CommandError(
                "No pillow found with name: {}".format(pillow_name))

        checkpoint = pillow.checkpoint
        store = HistoricalPillowCheckpoint.get_historical_max(
            checkpoint.checkpoint_id)

        if not store:
            print(
                "No new sequence exists for that pillow. You'll have to do it manually."
            )
            exit()

        old_seq = pillow.get_last_checkpoint_sequence()
        new_seq = store.seq
        confirm(
            "\nReset checkpoint for '{}' pillow from:\n\n{}\n\nto\n\n{}\n\n".
            format(pillow_name, old_seq, new_seq))
        checkpoint.update_to(new_seq)
        print("Checkpoint updated")
コード例 #2
0
ファイル: utils.py プロジェクト: kkrampa/commcare-hq
def check_for_rewind(checkpoint):
    historical_checkpoint = HistoricalPillowCheckpoint.get_historical_max(checkpoint.checkpoint_id)
    if not historical_checkpoint:
        return False
    db_seq = checkpoint.get_current_sequence_id()
    store_seq = historical_checkpoint.seq_int
    has_rewound = force_seq_int(db_seq) < store_seq - EPSILON
    return has_rewound, historical_checkpoint.seq
コード例 #3
0
def check_for_rewind(checkpoint):
    historical_checkpoint = HistoricalPillowCheckpoint.get_historical_max(checkpoint.checkpoint_id)
    if not historical_checkpoint:
        return False
    db_seq = checkpoint.get_current_sequence_id()
    store_seq = historical_checkpoint.seq_int
    has_rewound = force_seq_int(db_seq) < store_seq - EPSILON
    return has_rewound, historical_checkpoint.seq
コード例 #4
0
    def handle(self, pillow_name, **options):
        confirm("Are you sure you want to reset the checkpoint for the '{}' pillow?".format(pillow_name))
        confirm("Have you stopped the pillow?")

        pillow = get_pillow_by_name(pillow_name)
        if not pillow:
            raise CommandError("No pillow found with name: {}".format(pillow_name))

        checkpoint = pillow.checkpoint
        store = HistoricalPillowCheckpoint.get_historical_max(checkpoint.checkpoint_id)

        if not store:
            print("No new sequence exists for that pillow. You'll have to do it manually.")
            exit()

        old_seq = pillow.get_last_checkpoint_sequence()
        new_seq = store.seq
        confirm("\nReset checkpoint for '{}' pillow from:\n\n{}\n\nto\n\n{}\n\n".format(
            pillow_name, old_seq, new_seq
        ))
        checkpoint.update_to(new_seq)
        print("Checkpoint updated")