the keywords in the comma separated keyword
string specified.
--archive-upload RSYNC_DEST Rsync destination to upload archives.
+ --throttle SLEEP When scheduling, wait SLEEP seconds between jobs.
+ Useful to avoid bursts that may be too hard on
+ the underlying infrastructure or exceed OpenStack API
+ limits (server creation per minute for instance).
""".format(default_machine_type=config.default_machine_type,
default_results_timeout=config.results_timeout)
import smtplib
import socket
import sys
+from time import sleep
import yaml
import math
from email.mime.text import MIMEText
timeout = args['--timeout']
filter_in = args['--filter']
filter_out = args['--filter-out']
+ throttle = args['--throttle']
subset = None
if args['--subset']:
filter_in=filter_in,
filter_out=filter_out,
subset=subset,
+ throttle=throttle,
)
os.remove(base_yaml_path)
num, timeout, dry_run, verbose,
filter_in,
filter_out,
- subset):
+ subset,
+ throttle):
"""
Puts together some "base arguments" with which to execute
teuthology-schedule for each job, then passes them and other parameters to
verbose=verbose,
filter_in=filter_in,
filter_out=filter_out,
- subset=subset
+ subset=subset,
+ throttle=throttle
)
if job_config.email and num_jobs:
verbose=1,
filter_in=None,
filter_out=None,
- subset=None
+ subset=None,
+ throttle=None,
):
"""
schedule one suite.
verbose=verbose,
log_prefix=log_prefix,
)
+ if not dry_run and throttle:
+ log.info("pause between jobs : --throttle " + str(throttle))
+ sleep(int(throttle))
count = len(jobs_to_schedule)
missing_count = len(jobs_missing_packages)
from copy import deepcopy
from datetime import datetime
-from mock import patch, Mock
+from mock import patch, Mock, DEFAULT
from teuthology import suite
+from scripts.suite import main
from teuthology.config import config
assert fragments[0] == 'thrash/ceph/base.yaml'
assert fragments[1] == 'thrash/ceph-thrash/default.yaml'
+
+class TestSuiteMain(object):
+
+ def test_main(self):
+ suite_name = 'SUITE'
+ throttle = '3'
+ machine_type = 'burnupi'
+ def prepare_and_schedule(**kwargs):
+ assert kwargs['job_config']['suite'] == suite_name
+ assert kwargs['throttle'] == throttle
+
+ with patch.multiple(
+ suite,
+ fetch_repos=DEFAULT,
+ prepare_and_schedule=prepare_and_schedule,
+ ):
+ main(['--suite', suite_name,
+ '--throttle', throttle,
+ '--machine-type', machine_type])
+
+ def test_schedule_suite(self):
+ suite_name = 'noop'
+ throttle = '3'
+ machine_type = 'burnupi'
+
+ with patch.multiple(
+ suite,
+ fetch_repos=DEFAULT,
+ teuthology_schedule=DEFAULT,
+ sleep=DEFAULT,
+ ) as m:
+ main(['--suite', suite_name,
+ '--suite-dir', 'teuthology/test',
+ '--throttle', throttle,
+ '--machine-type', machine_type])
+ m['sleep'].assert_called_with(int(throttle))