LOG = config_logger(__name__) parser = argparse.ArgumentParser('Checking the original images have been created on S3 correctly') parser.add_argument('option', choices=['boinc', 'ami'], help='are we running on the BOINC server or the AMI server') args = vars(parser.parse_args()) if args['option'] == 'boinc': LOG.info('PYTHONPATH = {0}'.format(sys.path)) # We're running from the BOINC server original_image_checked_boinc() else: # We're running from a specially created AMI log_name = 'original_image_checked' filename, full_filename = get_ami_log_file(log_name) add_file_handler_to_root(full_filename) LOG.info('PYTHONPATH = {0}'.format(sys.path)) LOG.info('About to perform sanity checks') if pass_sanity_checks(): original_image_checked_ami() else: LOG.error('Failed to pass sanity tests') # Try copying the log file to S3 try: LOG.info('About to copy the log file') s3helper = S3Helper() s3helper.add_file_to_bucket(get_archive_bucket(), get_log_archive_key(log_name, filename), full_filename, True) os.remove(full_filename) except:
from utils.name_builder import get_archive_bucket, get_log_archive_key, get_ami_log_file from utils.sanity_checks import pass_sanity_checks LOG = config_logger(__name__) parser = argparse.ArgumentParser('Archive BOINC statistics to S3') parser.add_argument('option', choices=['boinc','ami'], help='are we running on the BOINC server or the AMI server') args = vars(parser.parse_args()) if args['option'] == 'boinc': LOG.info('PYTHONPATH = {0}'.format(sys.path)) # We're running from the BOINC server process_boinc() else: # We're running from a specially created AMI filename, full_filename = get_ami_log_file('archive_boinc_stats') add_file_handler_to_root(full_filename) LOG.info('PYTHONPATH = {0}'.format(sys.path)) LOG.info('About to perform sanity checks') if pass_sanity_checks(): process_ami() else: LOG.error('Failed to pass sanity tests') # Try copying the log file to S3 try: LOG.info('About to copy the log file') s3helper = S3Helper() s3helper.add_file_to_bucket(get_archive_bucket(), get_log_archive_key('archive_boinc_stats', filename), full_filename, True) os.remove(full_filename) except:
parser = argparse.ArgumentParser( 'Checking the original images have been created on S3 correctly') parser.add_argument( 'option', choices=['boinc', 'ami'], help='are we running on the BOINC server or the AMI server') args = vars(parser.parse_args()) if args['option'] == 'boinc': LOG.info('PYTHONPATH = {0}'.format(sys.path)) # We're running from the BOINC server original_image_checked_boinc() else: # We're running from a specially created AMI log_name = 'original_image_checked' filename, full_filename = get_ami_log_file(log_name) add_file_handler_to_root(full_filename) LOG.info('PYTHONPATH = {0}'.format(sys.path)) LOG.info('About to perform sanity checks') if pass_sanity_checks(): original_image_checked_ami() else: LOG.error('Failed to pass sanity tests') # Try copying the log file to S3 try: LOG.info('About to copy the log file') s3helper = S3Helper() s3helper.add_file_to_bucket(get_archive_bucket(), get_log_archive_key(log_name, filename), full_filename, True)