Commit 55331da0 authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

Add scripts to fetch 1 swarming log and all swarming sub-task logs.

TBR=altimin@chromium.org, scottmg@chromium.org

Change-Id: Ia91b1aacb0e761042630822acc72f86b96c1752c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2239738Reviewed-by: default avatarFergal Daly <fergal@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776906}
parent 1032246d
# Caveat Usor
This is just a quick script that I wrote and am checking in.
Feel free to send patches and ping me if it doesn't work.
#!/bin/bash -e
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Downloads all logs from a CQ run. You can find the task ID by e.g. clicking
# through to the CQ run from gerrit and finding, e.g. the line
#
# Swarming Task: 4cb6401085894f10
#
# This will create a .txt for the main log and create subdir for the ID and put
# one .txt file in there for each subtask's log.
#
# Usage:
# get_all.sh <output_dir> <task ID>
base_dir=$1
shift
id=$1
shift
bindir=$bindir
function get_ids() {
perl -lne 'print $1 if m#shard \#0\]\(https://chromium-swarm.appspot.com/user/task/([0-9a-f]*)#;' "$1" | sort | uniq
}
log=$("$bindir"/get_one_log.sh "$base_dir" "$id")
dir="$base_dir/$id"
running=0
for id in $(get_ids "$log" ); do
if [ "$running" -gt 32 ]; then
echo >&2 waiting $running
wait -n
running=$(($running - 1))
fi
echo >&2 getting $id
"$bindir"/get_one.sh "$dir" "$id" &
running=$(($running + 1))
done
while [ "$running" -gt 0 ]; do
echo >&2 waiting $running
wait -n
running=$(($running - 1))
done
#!/bin/bash -ex
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Downloads all the log from a CQ run. You can find the task ID by e.g. clicking
# through to the CQ run from gerrit and finding, e.g. the line
#
# Swarming Task: 4cb6401085894f10
#
# This will create a .txt for this log in the output dir. If you want all the
# logs of subtasks, see get_all.sh
#
# Usage:
# get_one.sh <output_dir> <task ID>
base_dir=$1
shift
id=$1
shift
out="$base_dir/$id.txt"
mkdir -p "$base_dir"
python tools/swarming_client/swarming.py \
collect -S chromium-swarm.appspot.com "$id" > "$out" \
|| true
echo "$out"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment