Skip to content

Instantly share code, notes, and snippets.

@gergo-dryrun
Last active March 10, 2021 12:36
Show Gist options
  • Save gergo-dryrun/63a9c23be8bddc9026c6c3ce9e532e49 to your computer and use it in GitHub Desktop.
Save gergo-dryrun/63a9c23be8bddc9026c6c3ce9e532e49 to your computer and use it in GitHub Desktop.
# download codebuild output artifacts, unzip and CD to the processing_time directory
activity_types_str=$(ls | cut -d '-' -f1 | uniq)
activity_types=($activity_types_str)
for activity_type in "${activity_types[@]}"
do
echo ""
nr_tasks=$(ls ${activity_type}* | wc -l)
echo "Total${activity_type} tasks executed ${nr_tasks}"
echo "Aggregated time taken for the short ${activity_type} tasks (In seconds)";
ls ${activity_type}* | xargs cat | jq -s | jq ' [.[] |( if .duration < 10 then .duration else 0 end)] | add'
echo "Aggregated time taken for the extended ${activity_type} tasks (In seconds)";
ls ${activity_type}* | xargs cat | jq -s | jq ' [.[] |( if .duration > 10 then .duration else 0 end)] | add'
done
nr_tasks=$(ls * | wc -l)
echo ""
echo ""
echo "Summary: Total tasks executed ${nr_tasks}"
echo "Aggregated time taken for the short tasks (In seconds)"
ls * | xargs cat | jq -s | jq ' [.[] |( if .duration < 10 then .duration else 0 end)] | add'
echo "Aggregated time taken for the extended tasks (In seconds)"
ls * | xargs cat | jq -s | jq ' [.[] |( if .duration > 10 then .duration else 0 end)] | add'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment