Skip to content

Instantly share code, notes, and snippets.

@matthewrmshin
Created July 30, 2015 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewrmshin/8d73ccc405dfedfcd18c to your computer and use it in GitHub Desktop.
Save matthewrmshin/8d73ccc405dfedfcd18c to your computer and use it in GitHub Desktop.
Test cylc scan
#!/bin/bash
set -eu
begin() {
for I in $(seq -w 1 30); do
mkdir -p "${HOME}/cylc-run/scan-test-${I}"
cat >"${HOME}/cylc-run/scan-test-${I}/suite.rc" <<'__SUITERC__'
[scheduling]
[[dependencies]]
graph = t1
[runtime]
[[t1]]
script = false
__SUITERC__
cylc register "scan-test-${I}" "${HOME}/cylc-run/scan-test-${I}"
cylc run "scan-test-${I}"
done 1>'/dev/null' 2>&1
}
finish() {
for I in $(seq -w 1 30); do
cylc shutdown '--interval=5' '--max-polls=12' "scan-test-${I}" &
done 1>'/dev/null' 2>&1
wait
cylc unregister 'scan-test-\d\d' 1>'/dev/null' 2>&1
rm -fr "${HOME}/cylc-run/scan-test-"*
}
timeit() {
python -m timeit -n "${1:-10}" -r 1 '
from subprocess import Popen, PIPE
Popen(["cylc", "scan", "localhost"], stdout=PIPE).wait()
'
}
FUNC="${1:-'timeit'}"
shift 1
${FUNC} "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment