Skip to content

Commit

Permalink
add script to print dist status table [skip-vdc] [skip-docs] [skip-ra…
Browse files Browse the repository at this point in the history
…pids]
  • Loading branch information
trxcllnt committed Jan 14, 2025
1 parent 501b259 commit 6529947
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
19 changes: 1 addition & 18 deletions .github/actions/workflow-run-job-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,7 @@ runs:
set -eo pipefail
echo -e "\e[1;34mRunning as '$(whoami)' user in $(pwd):\e[0m"
# Print current dist status to verify we're connected
echo -e "\e[1;34mBuild cluster:\n$(sccache --dist-status | jq -r -f <(cat <<"EOF"
.SchedulerStatus as [$x, $y] | [
($y | {type: "scheduler", id: $x, servers: (.servers | length), cpus: .info.occupancy, util: ((.info.cpu_usage // 0) * 100 | round | . / 100 | tostring | . + "%"), jobs: (.jobs.fetched + .jobs.running), fetched: .jobs.fetched, running: .jobs.running, u_time: ($y.servers // {} | map(.u_time) | min | . // 0 | tostring | . + "s")}),
($y.servers // {}
| to_entries
| sort_by(.key)
| map(
.key as $k
| .value
| {type: "server", id: .id, servers: 1, cpus: .info.occupancy, util: ((.info.cpu_usage // 0) * 100 | round | . / 100 | tostring | . + "%"), jobs: (.jobs.fetched + .jobs.running), fetched: .jobs.fetched, running: .jobs.running, u_time: ((.u_time // 0) | tostring | . + "s")}
)[]
)
] as $rows
| ($rows[0] | keys_unsorted) as $cols
| ($rows | map(. as $row | $cols | map($row[.]))) as $rows
| $cols, $rows[] | @csv | gsub("\""; "")
EOF
) | column -t -s, -R 1-7)\e[0m"
echo -e "\e[1;34mBuild cluster:\n$(./ci/sccache_dist_status.sh)\e[0m"
echo -e "\e[1;34m${COMMAND}\e[0m"
eval "${COMMAND}" || exit_code=$?
if [ ! -z "$exit_code" ]; then
Expand Down
23 changes: 23 additions & 0 deletions ci/sccache_dist_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euo pipefail

# Print current dist status to verify we're connected
sccache --dist-status | jq -r -f <(cat <<"EOF"
.SchedulerStatus as [$x, $y] | [
($y | {type: "scheduler", id: $x, servers: (.servers | length), cpus: .info.occupancy, util: ((.info.cpu_usage // 0) * 100 | round | . / 100 | tostring | . + "%"), jobs: (.jobs.fetched + .jobs.running), fetched: .jobs.fetched, running: .jobs.running, u_time: ($y.servers // {} | map(.u_time) | min | . // 0 | tostring | . + "s")}),
($y.servers // {}
| to_entries
| sort_by(.key)
| map(
.key as $k
| .value
| {type: "server", id: .id, servers: 1, cpus: .info.occupancy, util: ((.info.cpu_usage // 0) * 100 | round | . / 100 | tostring | . + "%"), jobs: (.jobs.fetched + .jobs.running), fetched: .jobs.fetched, running: .jobs.running, u_time: ((.u_time // 0) | tostring | . + "s")}
)[]
)
] as $rows
| ($rows[0] | keys_unsorted) as $cols
| ($rows | map(. as $row | $cols | map($row[.]))) as $rows
| $cols, $rows[] | @csv | gsub("\""; "")
EOF
) | column -t -s, -R 1-7

0 comments on commit 6529947

Please sign in to comment.