<commit_before>import com.amazonaws.services.ec2.model.InstanceType
import hudson.model.*
import hudson.plugins.ec2.AmazonEC2Cloud
import hudson.plugins.ec2.EC2Tag
import hudson.plugins.ec2.SlaveTemplate
import hudson.plugins.ec2.SpotConfiguration
import hudson.plugins.ec2.UnixData
import java.util.logging.Logger
import jenkins.model.Jenkins

def logger = Logger.getLogger("")
logger.info("Cloud init started")

// get Jenkins instance
Jenkins jenkins = Jenkins.getInstance()

netMap = [:]
netMap['us-east-2a'] = 'subnet-dd0475b5'
netMap['us-east-2b'] = 'subnet-c0e44aba'
netMap['us-east-2c'] = 'subnet-b7f3e1fa'

imageMap = [:]
imageMap['us-east-2a.docker'] = 'ami-79201c1c'
imageMap['us-east-2a.docker-32gb'] = 'ami-53201c36'
imageMap['us-east-2a.micro-amazon'] = 'ami-2a0f324f'
imageMap['us-east-2a.min-centos-7-x64'] = 'ami-77724e12'

imageMap['us-east-2b.docker'] = imageMap['us-east-2a.docker']
imageMap['us-east-2b.docker-32gb'] = imageMap['us-east-2a.docker-32gb']
imageMap['us-east-2b.micro-amazon'] = imageMap['us-east-2a.micro-amazon']
imageMap['us-east-2b.min-centos-7-x64'] = imageMap['us-east-2a.min-centos-7-x64']

imageMap['us-east-2c.docker'] = imageMap['us-east-2a.docker']
imageMap['us-east-2c.docker-32gb'] = imageMap['us-east-2a.docker-32gb']
imageMap['us-east-2c.micro-amazon'] = imageMap['us-east-2a.micro-amazon']
imageMap['us-east-2c.min-centos-7-x64'] = imageMap['us-east-2a.min-centos-7-x64']

/*
imageMap['min-artful-x64'] = 'ami-db2919be'
imageMap['min-centos-6-x64'] = 'ami-ff48629a'
imageMap['min-jessie-x64'] = 'ami-c5ba9fa0'
imageMap['min-stretch-x64'] = 'ami-79c0f01c'
imageMap['min-trusty-x64'] = 'ami-2ddeee48'
imageMap['min-xenial-x64'] = 'ami-e82a1a8d'
*/

priceMap = [:]
priceMap['t2.small'] = '0.01'
priceMap['c4.xlarge'] = '0.10'
priceMap['m4.xlarge'] = '0.10'
priceMap['m4.2xlarge'] = '0.20'

userMap = [:]
userMap['docker'] = 'ec2-user'
userMap['docker-32gb'] = userMap['docker']
userMap['micro-amazon'] = userMap['docker']
userMap['min-artful-x64'] = 'ubuntu'
userMap['min-centos-6-x64'] = 'centos'
userMap['min-centos-7-x64'] = 'centos'
userMap['min-jessie-x64'] = 'admin'
userMap['min-stretch-x64'] = 'admin'
userMap['min-trusty-x64'] = 'ubuntu'
userMap['min-xenial-x64'] = 'ubuntu'

initMap = [:]
initMap['docker'] = '''
    set -o xtrace

    if ! mountpoint -q /mnt; then
        DEVICE=$(ls /dev/xvdd /dev/nvme1n1 | head -1)
        sudo mkfs.ext4 ${DEVICE}
        sudo mount -o noatime ${DEVICE} /mnt
    fi
    sudo ethtool -K eth0 sg off
    until sudo yum makecache; do
        sleep 1
        echo try again
    done
    sudo yum -y install java-1.8.0-openjdk git aws-cli docker
    sudo yum -y remove java-1.7.0-openjdk
    sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

    sudo sysctl net.ipv4.tcp_fin_timeout=15
    sudo sysctl net.ipv4.tcp_tw_reuse=1
    sudo sysctl net.ipv6.conf.all.disable_ipv6=1
    sudo sysctl net.ipv6.conf.default.disable_ipv6=1
    sudo sysctl -w fs.inotify.max_user_watches=10000000 || true
    sudo sysctl -w fs.aio-max-nr=1048576 || true
    sudo sysctl -w fs.file-max=6815744 || true
    sudo sed -i.bak -e 's/nofile=1024:4096/nofile=900000:900000/; s/DAEMON_MAXFILES=.*/DAEMON_MAXFILES=990000/' /etc/sysconfig/docker
    echo 'DOCKER_STORAGE_OPTIONS="--data-root=/mnt/docker"' | sudo tee -a /etc/sysconfig/docker-storage
    sudo sed -i.bak -e 's^ExecStart=.*^ExecStart=/usr/bin/dockerd --data-root=/mnt/docker --default-ulimit nofile=900000:900000^' /usr/lib/systemd/system/docker.service
    sudo systemctl daemon-reload
    sudo install -o root -g root -d /mnt/docker
    sudo usermod -aG docker $(id -u -n)<commit_msg>enable coredump by default<commit_after>import com.amazonaws.services.ec2.model.InstanceType
import hudson.model.*
import hudson.plugins.ec2.AmazonEC2Cloud
import hudson.plugins.ec2.EC2Tag
import hudson.plugins.ec2.SlaveTemplate
import hudson.plugins.ec2.SpotConfiguration
import hudson.plugins.ec2.UnixData
import java.util.logging.Logger
import jenkins.model.Jenkins

def logger = Logger.getLogger("")
logger.info("Cloud init started")

// get Jenkins instance
Jenkins jenkins = Jenkins.getInstance()

netMap = [:]
netMap['us-east-2a'] = 'subnet-dd0475b5'
netMap['us-east-2b'] = 'subnet-c0e44aba'
netMap['us-east-2c'] = 'subnet-b7f3e1fa'

imageMap = [:]
imageMap['us-east-2a.docker'] = 'ami-79201c1c'
imageMap['us-east-2a.docker-32gb'] = 'ami-53201c36'
imageMap['us-east-2a.micro-amazon'] = 'ami-2a0f324f'
imageMap['us-east-2a.min-centos-7-x64'] = 'ami-77724e12'

imageMap['us-east-2b.docker'] = imageMap['us-east-2a.docker']
imageMap['us-east-2b.docker-32gb'] = imageMap['us-east-2a.docker-32gb']
imageMap['us-east-2b.micro-amazon'] = imageMap['us-east-2a.micro-amazon']
imageMap['us-east-2b.min-centos-7-x64'] = imageMap['us-east-2a.min-centos-7-x64']

imageMap['us-east-2c.docker'] = imageMap['us-east-2a.docker']
imageMap['us-east-2c.docker-32gb'] = imageMap['us-east-2a.docker-32gb']
imageMap['us-east-2c.micro-amazon'] = imageMap['us-east-2a.micro-amazon']
imageMap['us-east-2c.min-centos-7-x64'] = imageMap['us-east-2a.min-centos-7-x64']

/*
imageMap['min-artful-x64'] = 'ami-db2919be'
imageMap['min-centos-6-x64'] = 'ami-ff48629a'
imageMap['min-jessie-x64'] = 'ami-c5ba9fa0'
imageMap['min-stretch-x64'] = 'ami-79c0f01c'
imageMap['min-trusty-x64'] = 'ami-2ddeee48'
imageMap['min-xenial-x64'] = 'ami-e82a1a8d'
*/

priceMap = [:]
priceMap['t2.small'] = '0.01'
priceMap['c4.xlarge'] = '0.10'
priceMap['m4.xlarge'] = '0.10'
priceMap['m4.2xlarge'] = '0.20'

userMap = [:]
userMap['docker'] = 'ec2-user'
userMap['docker-32gb'] = userMap['docker']
userMap['micro-amazon'] = userMap['docker']
userMap['min-artful-x64'] = 'ubuntu'
userMap['min-centos-6-x64'] = 'centos'
userMap['min-centos-7-x64'] = 'centos'
userMap['min-jessie-x64'] = 'admin'
userMap['min-stretch-x64'] = 'admin'
userMap['min-trusty-x64'] = 'ubuntu'
userMap['min-xenial-x64'] = 'ubuntu'

initMap = [:]
initMap['docker'] = '''
    set -o xtrace

    if ! mountpoint -q /mnt; then
        DEVICE=$(ls /dev/xvdd /dev/nvme1n1 | head -1)
        sudo mkfs.ext4 ${DEVICE}
        sudo mount -o noatime ${DEVICE} /mnt
    fi
    sudo ethtool -K eth0 sg off
    until sudo yum makecache; do
        sleep 1
        echo try again
    done
    sudo yum -y install java-1.8.0-openjdk git aws-cli docker
    sudo yum -y remove java-1.7.0-openjdk
    sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

    sudo sysctl net.ipv4.tcp_fin_timeout=15
    sudo sysctl net.ipv4.tcp_tw_reuse=1
    sudo sysctl net.ipv6.conf.all.disable_ipv6=1
    sudo sysctl net.ipv6.conf.default.disable_ipv6=1
    sudo sysctl -w fs.inotify.max_user_watches=10000000 || true
    sudo sysctl -w fs.aio-max-nr=1048576 || true
    sudo sysctl -w fs.file-max=6815744 || true
    echo "*  soft  core  unlimited" | sudo tee -a /etc/security/limits.conf
    sudo sed -i.bak -e 's/nofile=1024:4096/nofile=900000:900000/; s/DAEMON_MAXFILES=.*/DAEMON_MAXFILES=990000/' /etc/sysconfig/docker
    echo 'DOCKER_STORAGE_OPTIONS="--data-root=/mnt/docker"' | sudo tee -a /etc/sysconfig/docker-storage
    sudo sed -i.bak -e 's^ExecStart=.*^ExecStart=/usr/bin/dockerd --data-root=/mnt/docker --default-ulimit nofile=900000:900000^' /usr/lib/systemd/system/docker.service
    sudo systemctl daemon-reload
    sudo install -o root -g root -d /mnt/docker
    sudo usermod -aG docker $(id -u -n)
{'fraction_non_alphanumeric': 0.18093941456773316, 'fraction_numerical': 0.06752893124574541, 'mean_word_length': 4.0109140518417465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '6319222', 'n_tokens_mistral': 3439, 'n_tokens_neox': 3093, 'n_words': 486}