__author__ = '@jotegui' today = datetime.now() file_name = '/home/jotegui/VertNet/PublisherStats/pubs_{0}.pk'.format(format(today, '%Y_%m_%d')) logging.basicConfig(filename='/home/jotegui/VertNet/PublisherStats/logs/with_local_{0}.log'.format(format(today, '%Y_%m_%d')), format='%(levelname)s:%(asctime)s %(message)s', level=logging.DEBUG) lapse = 'month' testing = False beta = False pubs = extractStats.main(today=today, lapse=lapse, testing=testing) # Piece of code to store pubs in disk (to avoid 1h+ of downloads) logging.info('Writing to local file {0}'.format(file_name)) with open(file_name, 'wb') as output: pickle.dump(pubs, output, pickle.HIGHEST_PROTOCOL) # After saving output, continue monthlyStatReports.main(today=today, lapse=lapse, testing=testing, beta=beta, local=True, local_file=file_name) end = datetime.now() dif = end - today logging.info('elapsed {0}'.format(dif)) logging.info('done')
#!/usr/bin/python import logging import monthlyStatReports from datetime import datetime __author__ = '@jotegui' ini = datetime.now() logging.basicConfig(filename='logs/test_{0}.log'.format(format(ini, '%Y_%m_%d')), format='%(levelname)s:%(asctime)s %(message)s', level=logging.DEBUG) logging.info('Initiated at {0}'.format(ini)) monthlyStatReports.main(today=ini, lapse='month', testing=True, beta=True, github=True) end = datetime.now() dif = end - ini logging.info('elapsed {0}'.format(dif)) logging.info('done')
#!/usr/bin/python import logging import monthlyStatReports from datetime import datetime __author__ = '@jotegui' file_name = '/home/jotegui/VertNet/PublisherStats/pubs_2014_12_23.pk' y, m, d = file_name[:-3].split("_")[1:4] ini = datetime(int(y), int(m), int(d)) # ini = datetime.today() logging.basicConfig(filename='/home/jotegui/VertNet/PublisherStats/logs/local_{0}.log'.format(format(ini, '%Y_%m_%d')), format='%(levelname)s:%(asctime)s %(message)s', level=logging.DEBUG) logging.info('Initiated at {0}'.format(ini)) monthlyStatReports.main(today=ini, lapse='month', testing=False, beta=False, local=True, local_file=file_name) end = datetime.now() dif = end - ini logging.info('elapsed {0}'.format(dif)) logging.info('done')
import monthlyStatReports from datetime import datetime __author__ = '@jotegui' # Get start time ini = datetime.now() # Configure logging logging.basicConfig(filename='logs/statReports_{0}.log'.format(format(ini, '%Y_%m_%d')), format='%(levelname)s:%(asctime)s %(message)s', level=logging.DEBUG) logging.info('Initiated at {0}'.format(ini)) # Configure run variables lapse = 'month' # Monthly usage ('month') or complete usage ('full')? testing = False # Testing? If True, all reports and issues will go to the testing repository beta = False # Beta-testing? If True, limit to beta-tester institutions, found in TestingInsts.txt # Launch main process, no testing and no beta-testers monthlyStatReports.main(today=ini, lapse=lapse, testing=testing, beta=beta) # Calculate elapsed time end = datetime.now() dif = end - ini logging.info('elapsed {0}'.format(dif)) # The end logging.info('done')