コード例 #1
0
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:
        LOG.exception('Failed to copy the log file')


LOG.INFO('All done')
コード例 #2
0
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:
        LOG.exception('Failed to copy the log file')

    ec2_helper = EC2Helper()
    ec2_helper.release_public_ip()

LOG.INFO('All done')
コード例 #3
0
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:
        LOG.exception('Failed to copy the log file')

LOG.INFO('All done')