Files
weave-scope/extras/in_parallel.sh
Alban Crequy 0096688415 shfmt: fix shell formatting
Symptoms:
```
extras/dialer/time-scope-probe-cgroup:31:18: arithmetic expressions must consist of names and numbers
extras/dialer/time-scope-probe-cgroup: run shfmt -i 4 -w extras/dialer/time-scope-probe-cgroup
extras/dialer/time-scope-probe-proc:28:18: arithmetic expressions must consist of names and numbers
extras/dialer/time-scope-probe-proc: run shfmt -i 4 -w extras/dialer/time-scope-probe-proc
extras/in_parallel.sh:29:16: arithmetic expressions must consist of names and numbers
extras/in_parallel.sh: run shfmt -i 4 -w extras/in_parallel.sh
```

Visible on https://circleci.com/gh/kinvolk/scope/980
2017-05-22 17:27:35 +02:00

34 lines
748 B
Bash
Executable File

#!/bin/sh
set -e
if [ $# -lt 2 ]; then
echo "Usage: $0 <cmd> [args...]"
echo " Will run cmd arg1, cmd arg2 etc on different circle shared,"
echo " based on what the scheduler says."
exit 2
fi
if [ -z "$CIRCLECI" ]; then
echo "I'm afraid this only works when run on CircleCI"
exit 1
fi
COMMAND=$1
shift 1
INPUTS="$*"
SCHED_NAME=parallel-$CIRCLE_PROJECT_USERNAME-$CIRCLE_PROJECT_REPONAME-$CIRCLE_BUILD_NUM
INPUTS=$(echo "$INPUTS" | python "../tools/sched" sched "$SCHED_NAME" "$CIRCLE_NODE_TOTAL" "$CIRCLE_NODE_INDEX")
echo Doing "$INPUTS"
for INPUT in $INPUTS; do
START=$(date +%s)
$COMMAND "$INPUT"
END=$(date +%s)
RUNTIME=$((END - START))
python "../tools/sched" time "$INPUT" "$RUNTIME"
done