<commit_before>#!/bin/sh -e

suite=$1
ceph=$2
kernel=$3
email=$4
flavor=$5
teuthology_branch=$6
mtype=$7
template=$8

if [ -z "$email" ]; then
    echo "usage: $0 <suite> <ceph branch> <kernel branch> <email> [flavor] [teuthology-branch] [machinetype] [template]"
    echo "  flavor can be 'basic', 'gcov', 'notcmalloc'."
    exit 1
fi

[ -z "$flavor" ] && flavor='basic'


##
test ! -d ~/src/ceph-qa-suite && echo "error: expects to find ~/src/ceph-qa-suite" && exit 1
test ! -d ~/src/teuthology/virtualenv/bin && echo "error: expects to find ~/src/teuthology/virtualenv/bin" && exit 1

## get sha1
KERNEL_SHA1=`wget http://gitbuilder.ceph.com/kernel-deb-precise-x86_64-basic/ref/$kernel/sha1 -O- 2>/dev/null`
CEPH_SHA1=`wget http://gitbuilder.ceph.com/ceph-deb-precise-x86_64-$flavor/ref/$ceph/sha1 -O- 2>/dev/null`

[ -z "$KERNEL_SHA1" ] && echo "kernel branch $kernel dne" && exit 1
[ -z "$CEPH_SHA1" ] && echo "ceph branch $ceph dne" && exit 1


if [ -n "$teuthology_branch" ] && wget http://github.com/ceph/s3-tests/tree/$teuthology_branch -O- 2>/dev/null >/dev/null ; then
    s3branch=$teuthology_branch
elif wget http://github.com/ceph/s3-tests/tree/$ceph -O- 2>/dev/null >/dev/null ; then
    s3branch=$ceph
else
    echo "branch $ceph not in s3-tests.git; will use master for s3tests"
    s3branch='master'
fi
echo "s3branch $s3branch"

if [ -z "$teuthology_branch" ]; then
    if wget http://github.com/ceph/teuthology/tree/$ceph -O- 2>/dev/null >/dev/null ; then
        teuthology_branch=$ceph
    else
        echo "branch $ceph not in teuthology.git; will use master for teuthology"
        teuthology_branch='master'
    fi
fi
echo "teuthology branch $teuthology_branch"

[ -z "$mtype" ] && mtype="plana"

## always include this
fn="/tmp/schedule.suite.$$"
trap "rm $fn" EXIT
cat <<EOF > $fn
kernel:
  kdb: true
  sha1: $KERNEL_SHA1
nuke-on-error: true
machine_type: $mtype
tasks:
- chef:
- clock.check:
overrides:
  workunit:
    sha1: $CEPH_SHA1
  s3tests:
    branch: $s3branch
  install:
    ceph:
      sha1: $CEPH_SHA1
  ceph:
    sha1: $CEPH_SHA1
    conf:
      mon:
        debug ms: 20
        debug mon: 20
        debug paxos: 20
    log-whitelist:
    - slow request
EOF

if [ "$flavor" = "gcov" ]; then
    cat <<EOF >> $fn
    coverage: yes
EOF
fi

## template, too?
if [ -n "$template" ]; then
    sed s/CEPH_SHA1/$CEPH_SHA1/ $template | sed s/KERNEL_SHA1/$KERNEL_SHA1/ >> $fn
fi

##
stamp=`date +%Y-%m-%d_%H:%M:%S`
name=`whoami`"-$stamp-$suite-$ceph-$kernel-$flavor"

echo "name $name"

~/src/teuthology/virtualenv/bin/teuthology-suite -v $fn \
    --collections ~/src/ceph-qa-suite/suites/$suite/* \
    --email $email \
    --timeout 36000 \
    --name $name \
    --branch $teuthology_branch
<commit_msg>schedule_suite.sh: specify admin_socket branch in overrides yaml<commit_after>#!/bin/sh -e

suite=$1
ceph=$2
kernel=$3
email=$4
flavor=$5
teuthology_branch=$6
mtype=$7
template=$8

if [ -z "$email" ]; then
    echo "usage: $0 <suite> <ceph branch> <kernel branch> <email> [flavor] [teuthology-branch] [machinetype] [template]"
    echo "  flavor can be 'basic', 'gcov', 'notcmalloc'."
    exit 1
fi

[ -z "$flavor" ] && flavor='basic'


##
test ! -d ~/src/ceph-qa-suite && echo "error: expects to find ~/src/ceph-qa-suite" && exit 1
test ! -d ~/src/teuthology/virtualenv/bin && echo "error: expects to find ~/src/teuthology/virtualenv/bin" && exit 1

## get sha1
KERNEL_SHA1=`wget http://gitbuilder.ceph.com/kernel-deb-precise-x86_64-basic/ref/$kernel/sha1 -O- 2>/dev/null`
CEPH_SHA1=`wget http://gitbuilder.ceph.com/ceph-deb-precise-x86_64-$flavor/ref/$ceph/sha1 -O- 2>/dev/null`

[ -z "$KERNEL_SHA1" ] && echo "kernel branch $kernel dne" && exit 1
[ -z "$CEPH_SHA1" ] && echo "ceph branch $ceph dne" && exit 1


if [ -n "$teuthology_branch" ] && wget http://github.com/ceph/s3-tests/tree/$teuthology_branch -O- 2>/dev/null >/dev/null ; then
    s3branch=$teuthology_branch
elif wget http://github.com/ceph/s3-tests/tree/$ceph -O- 2>/dev/null >/dev/null ; then
    s3branch=$ceph
else
    echo "branch $ceph not in s3-tests.git; will use master for s3tests"
    s3branch='master'
fi
echo "s3branch $s3branch"

if [ -z "$teuthology_branch" ]; then
    if wget http://github.com/ceph/teuthology/tree/$ceph -O- 2>/dev/null >/dev/null ; then
        teuthology_branch=$ceph
    else
        echo "branch $ceph not in teuthology.git; will use master for teuthology"
        teuthology_branch='master'
    fi
fi
echo "teuthology branch $teuthology_branch"

[ -z "$mtype" ] && mtype="plana"

## always include this
fn="/tmp/schedule.suite.$$"
trap "rm $fn" EXIT
cat <<EOF > $fn
kernel:
  kdb: true
  sha1: $KERNEL_SHA1
nuke-on-error: true
machine_type: $mtype
tasks:
- chef:
- clock.check:
overrides:
  workunit:
    sha1: $CEPH_SHA1
  s3tests:
    branch: $s3branch
  install:
    ceph:
      sha1: $CEPH_SHA1
  ceph:
    sha1: $CEPH_SHA1
    conf:
      mon:
        debug ms: 20
        debug mon: 20
        debug paxos: 20
    log-whitelist:
    - slow request
  admin_socket:
    branch: $ceph
EOF

if [ "$flavor" = "gcov" ]; then
    cat <<EOF >> $fn
    coverage: yes
EOF
fi

## template, too?
if [ -n "$template" ]; then
    sed s/CEPH_SHA1/$CEPH_SHA1/ $template | sed s/KERNEL_SHA1/$KERNEL_SHA1/ >> $fn
fi

##
stamp=`date +%Y-%m-%d_%H:%M:%S`
name=`whoami`"-$stamp-$suite-$ceph-$kernel-$flavor"

echo "name $name"

~/src/teuthology/virtualenv/bin/teuthology-suite -v $fn \
    --collections ~/src/ceph-qa-suite/suites/$suite/* \
    --email $email \
    --timeout 36000 \
    --name $name \
    --branch $teuthology_branch

{'fraction_non_alphanumeric': 0.16723549488054607, 'fraction_numerical': 0.024429674869768277, 'mean_word_length': 3.183320811419985, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 37, 'https://': 0, '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': '3901831', 'n_tokens_mistral': 2285, 'n_tokens_neox': 2215, 'n_words': 517}