Exemplo n.º 1
0
        if "url_slug" in args and args["url_slug"]:
            email_report_to_url_slug(args["url_slug"])
        else:    
            email_report_to_everyone_who_needs_one(args["max_emails"])
    elif function=="dedup":
        deduplicate_everyone()
    elif function=="productdeets":
        add_product_deets_for_everyone(args["url_slug"], args["skip_until_url_slug"])
    elif function=="refsets":
        build_refsets(args["save_after_every_profile"])



if __name__ == "__main__":

    db.create_all()
    
    # get args from the command line:
    parser = argparse.ArgumentParser(description="Run stuff.")
    parser.add_argument('function', type=str, help="one of emailreports, refsets, dedup, productdeets")
    parser.add_argument('--url_slug', default=None, type=str, help="url slug")
    parser.add_argument('--save_after_every_profile', action='store_true', help="use to debug refsets, saves refsets to db after every profile.  slow.")
    parser.add_argument('--skip_until_url_slug', default=None, help="when looping don't process till past this url_slug")
    parser.add_argument('--max_emails', default=None, type=int, help="max number of emails to send")

    args = vars(parser.parse_args())
    print args
    
    print u"daily.py starting."
    main(args["function"], args)
Exemplo n.º 2
0
def setup_db_tables():
    logger.info(u"first request; setting up db tables.")
    db.create_all()
Exemplo n.º 3
0
def main(function, url_slug):
    if function == "email_report":
        if url_slug:
            email_report_to_url_slug(url_slug)
        else:
            email_report_to_everyone_who_needs_one()
    elif function == "dedup":
        deduplicate_everyone()
    elif function == "profile_deets":
        add_profile_deets_for_everyone()


if __name__ == "__main__":

    db.create_all()

    # get args from the command line:
    parser = argparse.ArgumentParser(description="Run stuff")
    parser.add_argument('--url_slug', default=None, type=str, help="url slug")
    # parser.add_argument('--celery', default=True, type=bool, help="celery")
    parser.add_argument('--function',
                        default="email_report",
                        type=str,
                        help="function")
    args = vars(parser.parse_args())
    print args
    print u"daily.py starting."
    main(args["function"], args["url_slug"])

    db.session.remove()
Exemplo n.º 4
0
def setup_db_tables():
    logger.info(u"first request; setting up db tables.")
    db.create_all()