<commit_before>'use strict';
const AWS = require('aws-sdk');
const promise = require('promise');
const rp = require('request-promise');

const USERDATA_URI = 'https://raw.githubusercontent.com/hhvm/packaging/master/ng/aws/userdata/update-repos.sh';

exports.handler = (event, context, callback) => {
  rp(USERDATA_URI)
  .then(userdata => {
    const params = {
      ImageId: /* ubuntu 16.04 */ 'ami-6e1a0117',
      MaxCount: 1,
      MinCount: 1,
      InstanceType: 't2.micro',
      SecurityGroups: [ 'hhvm-binary-package-builders' ],
      InstanceInitiatedShutdownBehavior: 'terminate',
      IamInstanceProfile: { Arn: 'arn:aws:iam::223121549624:instance-profile/hhvm-repo-builders' },
      KeyName: "hhvm-package-builders",
      TagSpecifications: [
        {
          ResourceType: 'instance',
          Tags: [{
            Key: 'Name',
            Value: 'hhvm-update-repos',
          }]
        }
      ],
      BlockDeviceMappings: [{
        DeviceName: '/dev/sda1',
        Ebs: {
          DeleteOnTermination: true,
          VolumeSize: 100 /*gb*/,
          VolumeType: 'gp2'
        }
      }],
      UserData: (new Buffer(userdata)).toString('base64')
    };

    const ec2 = new AWS.EC2();
    return ec2.runInstances(params).promise();
  })
  .then(ec2_response => {
    event.instances = ec2_response.Instances.map(
      instance => instance.InstanceId
    );
    callback(null, event);
  })
  .done();
}
<commit_msg>Make sure that update-repo job starts in the same AZ as the EBS volume<commit_after>'use strict';
const AWS = require('aws-sdk');
const promise = require('promise');
const rp = require('request-promise');

const USERDATA_URI = 'https://raw.githubusercontent.com/hhvm/packaging/master/ng/aws/userdata/update-repos.sh';

exports.handler = (event, context, callback) => {
  rp(USERDATA_URI)
  .then(userdata => {
    const params = {
      ImageId: /* ubuntu 16.04 */ 'ami-6e1a0117',
      Placement: {
        // This is required as we have a persistent EBS volume containing
        // the repositories, and the instance must be in the same
        // availability zone as an EBS volume to attach it.
        AvailabilityZone: 'us-west-2a'
      },
      MaxCount: 1,
      MinCount: 1,
      InstanceType: 't2.micro',
      SecurityGroups: [ 'hhvm-binary-package-builders' ],
      InstanceInitiatedShutdownBehavior: 'terminate',
      IamInstanceProfile: { Arn: 'arn:aws:iam::223121549624:instance-profile/hhvm-repo-builders' },
      KeyName: "hhvm-package-builders",
      TagSpecifications: [
        {
          ResourceType: 'instance',
          Tags: [{
            Key: 'Name',
            Value: 'hhvm-update-repos',
          }]
        }
      ],
      BlockDeviceMappings: [{
        DeviceName: '/dev/sda1',
        Ebs: {
          DeleteOnTermination: true,
          VolumeSize: 100 /*gb*/,
          VolumeType: 'gp2'
        }
      }],
      UserData: (new Buffer(userdata)).toString('base64')
    };

    const ec2 = new AWS.EC2();
    return ec2.runInstances(params).promise();
  })
  .then(ec2_response => {
    event.instances = ec2_response.Instances.map(
      instance => instance.InstanceId
    );
    callback(null, event);
  })
  .done();
}

{'fraction_non_alphanumeric': 0.14170292106898694, 'fraction_numerical': 0.023306401491609695, 'mean_word_length': 2.4612903225806453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4433924', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1019, 'n_words': 200}