Esempio n. 1
0
def traffic():
    """Main function of Bulkdozer, performs the Bulkdozer job

  """
    global clean_run
    if project.verbose:
        print 'traffic'

    try:
        setup()

        if config.mode in ['ALWAYS', 'ONCE']:
            try:
                logger.clear()
                logger.log('Bulkdozer traffic job starting')
                logger.log('Execution config is %s' % config.mode)
                logger.flush()

                if config.mode == 'ONCE':
                    config.mode = 'OFF'
                    config.update()

                init_daos()
                assets()
                landing_pages()
                campaigns()
                event_tags()
                placement_groups()
                placements()
                creatives()
                ads()
                dynamic_targeting_keys()

                if clean_run:
                    store.clear()

            finally:
                logger.log('Bulkdozer traffic job ended')
                logger.flush()
                store.save_id_map()

    except Exception as error:
        stack = traceback.format_exc()
        print stack

        logger.log(str(error))
        logger.flush()

    if clean_run:
        print 'Done: Clean run.'
    else:
        raise Exception("Done: Errors happened.")
Esempio n. 2
0
def traffic():
    """Main function of Bulkdozer, performs the Bulkdozer job

  """
    global clean_run
    if project.verbose: print('traffic')

    try:
        setup()

        logger.clear()
        logger.log('Bulkdozer traffic job starting')
        logger.flush()

        init_daos()
        assets()
        landing_pages()
        campaigns()
        event_tags()
        placement_groups()
        placements()
        creatives()
        ads()
        dynamic_targeting_keys()

        #if clean_run:
        #  store.clear()

    except Exception as error:
        stack = traceback.format_exc()
        print(stack)

        logger.log(str(error))

    finally:
        logger.log('Bulkdozer traffic job ended')
        logger.flush()
        #store.save_id_map()

    if clean_run:
        print('Done: Clean run.')
    else:
        raise Exception(
            "Done: Errors happened with some of the assets, check your sheet log."
        )