コード例 #1
0
ファイル: ingest.py プロジェクト: jvehent/splice
                    "PROCESSING FOR COUNTRY:{0} LOCALE:{1} CHANNEL:{2}".format(
                        country_code, locale, channel_id))

                new_tiles_list = []

                for t in tiles:
                    if is_compact and not populate_image_uris(t, assets):
                        continue

                    columns = _create_tile_record(t, channel_id, locale)
                    db_tile_id, ag_id = tile_exists(session, **columns)
                    f_tile_id = t.get("directoryId")

                    if db_tile_id is None or ag_id is None:
                        # Will generate a new id if not found in db
                        db_tile_id, ag_id = insert_tile(session, **columns)
                        t["directoryId"] = db_tile_id
                        log_msg = "INSERT: Creating id:{0}".format(db_tile_id)

                    elif db_tile_id == f_tile_id:
                        log_msg = "NOOP: id:{0} already exists".format(
                            f_tile_id)

                    else:
                        # Either f_tile_id was not provided or the id's provided differ
                        t["directoryId"] = db_tile_id
                        log_msg = "IGNORE: Tile already exists with id: {1}".format(
                            f_tile_id, db_tile_id)

                    command_logger.info(log_msg)
                    new_tiles_list.append(remove_unserializable_data(t))
コード例 #2
0
ファイル: ingest.py プロジェクト: imclab/splice
                        frequency_caps=frequency_caps,
                        adgroup_name=adgroup_name,
                        explanation=explanation,
                        check_inadjacency=check_inadjacency,
                        channel_id=channel_id,
                        conn=conn
                    )

                    db_tile_id, ag_id = tile_exists(**columns)
                    f_tile_id = t.get("directoryId")

                    if db_tile_id is None or ag_id is None:
                        """
                        Will generate a new id if not found in db
                        """
                        db_tile_id, ag_id = insert_tile(**columns)
                        t["directoryId"] = db_tile_id
                        new_tiles_list.append(remove_unserializable_data(t))
                        command_logger.info("INSERT: Creating id:{0}".format(db_tile_id))

                    elif db_tile_id == f_tile_id:
                        new_tiles_list.append(remove_unserializable_data(t))
                        command_logger.info("NOOP: id:{0} already exists".format(f_tile_id))

                    else:
                        """
                        Either f_tile_id was not provided or
                        the id's provided differ
                        """
                        t["directoryId"] = db_tile_id
                        new_tiles_list.append(remove_unserializable_data(t))
コード例 #3
0
ファイル: ingest.py プロジェクト: JaredKerim-Mozilla/splice
                command_logger.info("PROCESSING FOR COUNTRY:{0} LOCALE:{1} CHANNEL:{2}"
                                    .format(country_code, locale, channel_id))

                new_tiles_list = []

                for t in tiles:
                    if is_compact and not populate_image_uris(t, assets):
                        continue

                    columns = _create_tile_record(t, channel_id, locale)
                    db_tile_id, ag_id = tile_exists(session, **columns)
                    f_tile_id = t.get("directoryId")

                    if db_tile_id is None or ag_id is None:
                        # Will generate a new id if not found in db
                        db_tile_id, ag_id = insert_tile(session, **columns)
                        t["directoryId"] = db_tile_id
                        log_msg = "INSERT: Creating id:{0}".format(db_tile_id)

                    elif db_tile_id == f_tile_id:
                        log_msg = "NOOP: id:{0} already exists".format(f_tile_id)

                    else:
                        # Either f_tile_id was not provided or the id's provided differ
                        t["directoryId"] = db_tile_id
                        log_msg = "IGNORE: Tile already exists with id: {1}".format(f_tile_id, db_tile_id)

                    command_logger.info(log_msg)
                    new_tiles_list.append(remove_unserializable_data(t))

                ingested_data[country_locale_str] = new_tiles_list