Пример #1
0
def incremental(location, id, threads):
    db.init_db_engine(config.SQLALCHEMY_DATABASE_URI)
    dump_id, start_t, end_t = dump.prepare_incremental_dump(int(id) if id else None)
    print("Creating incremental dumps with data between %s and %s:\n" % (start_t, end_t))
    _incremental_db(location, dump_id, threads)
    _incremental_json_lowlevel(location, dump_id)
    _incremental_json_highlevel(location, dump_id)
Пример #2
0
def incremental(location, id, threads):
    dump_id, start_t, end_t = dump.prepare_incremental_dump(
        int(id) if id else None)
    print("Creating incremental dumps with data between %s and %s:\n" %
          (start_t, end_t))
    _incremental_db(location, dump_id, threads)
    _incremental_json_lowlevel(location, dump_id)
    _incremental_json_highlevel(location, dump_id)
Пример #3
0
    def test_prepare_incremental_dump(self):
        self.reset_db()

        dump_id_first, start_t_first, end_t_first = dump.prepare_incremental_dump()
        self.assertIsNone(start_t_first)
        self.assertIsNotNone(end_t_first)

        dump_id_same, start_t_same, end_t_same = dump.prepare_incremental_dump(dump_id_first)
        self.assertEqual(dump_id_same, dump_id_first)
        self.assertEqual(start_t_same, start_t_first)
        self.assertEqual(end_t_same, end_t_first)

        with self.assertRaises(dump.NoNewData):
            dump.prepare_incremental_dump()

        self.load_low_level_data("0dad432b-16cc-4bf0-8961-fd31d124b01b")

        dump_id_last, start_t_last, end_t_last = dump.prepare_incremental_dump()
        self.assertNotEqual(dump_id_last, dump_id_first)
        self.assertNotEqual(start_t_last, start_t_first)
        self.assertNotEqual(end_t_last, end_t_first)
Пример #4
0
    def test_prepare_incremental_dump(self):
        self.reset_db()

        dump_id_first, start_t_first, end_t_first = dump.prepare_incremental_dump()
        self.assertIsNone(start_t_first)
        self.assertIsNotNone(end_t_first)

        dump_id_same, start_t_same, end_t_same = dump.prepare_incremental_dump(dump_id_first)
        self.assertEqual(dump_id_same, dump_id_first)
        self.assertEqual(start_t_same, start_t_first)
        self.assertEqual(end_t_same, end_t_first)

        with self.assertRaises(dump.NoNewData):
            dump.prepare_incremental_dump()

        self.load_low_level_data("0dad432b-16cc-4bf0-8961-fd31d124b01b")

        dump_id_last, start_t_last, end_t_last = dump.prepare_incremental_dump()
        self.assertNotEqual(dump_id_last, dump_id_first)
        self.assertNotEqual(start_t_last, start_t_first)
        self.assertNotEqual(end_t_last, end_t_first)
def full(ctx, location, threads, rotate):
    """This command creates:
    1. New incremental dump record (+ incremental dumps unless it's the first record)
    2. Full database dump
    3. Full JSON dump

    Archive rotation is enabled by default for full dumps.
    """
    try:
        start_t = dump.prepare_incremental_dump()[1]
        if start_t:  # not the first incremental dump
            incremental(location, id=None, threads=None)
        else:
            print("Skipping incremental dump creation since it's the first one.\n")
    except dump.NoNewData:
        print("Skipping incremental dump creation. No new data.\n")

    ctx.invoke(full_db, location=location, threads=threads, rotate=rotate)
    ctx.invoke(json, location=location, rotate=rotate)
Пример #6
0
def full(ctx, location, threads, rotate):
    """This command creates:
    1. New incremental dump record (+ incremental dumps unless it's the first record)
    2. Full database dump
    3. Full JSON dump

    Archive rotation is enabled by default for full dumps.
    """
    db.init_db_engine(config.SQLALCHEMY_DATABASE_URI)
    try:
        start_t = dump.prepare_incremental_dump()[1]
        if start_t:  # not the first incremental dump
            incremental(location, id=None, threads=None)
        else:
            print("Skipping incremental dump creation since it's the first one.\n")
    except dump.NoNewData:
        print("Skipping incremental dump creation. No new data.\n")

    ctx.invoke(full_db, location=location, threads=threads, rotate=rotate)
    ctx.invoke(json, location=location, rotate=rotate)
def full(ctx, location, threads, rotate):
    """This command creates:
    1. New incremental dump record (+ incremental dumps unless it's the first record)
    2. Full database dump
    3. Full JSON dump

    Archive rotation is enabled by default for full dumps.
    """
    try:
        start_t = dump.prepare_incremental_dump()[1]
        if start_t:  # not the first incremental dump
            incremental(location, id=None, threads=None)
        else:
            current_app.logger.info(
                "Skipping incremental dump creation since it's the first one.\n"
            )
    except dump.NoNewData:
        current_app.logger.info(
            "Skipping incremental dump creation. No new data.\n")

    ctx.invoke(full_db, location=location, threads=threads, rotate=rotate)
    ctx.invoke(json, location=location, rotate=rotate)
def incremental(location, id, threads):
    dump_id, start_t, end_t = dump.prepare_incremental_dump(int(id) if id else None)
    print("Creating incremental dumps with data between %s and %s:\n" % (start_t, end_t))
    _incremental_db(location, dump_id, threads)
    _incremental_json_lowlevel(location, dump_id)
    _incremental_json_highlevel(location, dump_id)