forked from subquery/subql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update benchmark message (subquery#1898)
* Update benchmark message * add calculation for bps --------- Co-authored-by: JQQQ <[email protected]>
- Loading branch information
1 parent
382af1a
commit 4ad25e0
Showing
3 changed files
with
16 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# Query the database and store the result in variables | ||
input_duration=$1 | ||
|
||
# Function to convert time string to seconds | ||
t2s() { | ||
sed 's/d/*24*3600 +/g; s/h/*3600 +/g; s/m/*60 +/g; s/s/\+/g; s/+[ ]*$//g' <<< "$1" | bc | ||
} | ||
|
||
# Query the database and store the result in variables | ||
runner_node=$(psql -h postgres -d postgres -U postgres -c "SELECT value FROM app._metadata WHERE key = 'runnerNode';" | awk 'NR == 3 {print $1}' | tr -d '"') | ||
indexer_version=$(psql -h postgres -d postgres -U postgres -c "SELECT value FROM app._metadata WHERE key = 'indexerNodeVersion';" | awk 'NR == 3 {print $1}' | tr -d '"') | ||
start_height=$(psql -h postgres -d postgres -U postgres -c "SELECT value::integer FROM app._metadata WHERE key = 'startHeight';" | awk 'NR == 3 {print $1}') | ||
last_processed_height=$(psql -h postgres -d postgres -U postgres -c "SELECT value::integer FROM app._metadata WHERE key = 'lastProcessedHeight';" | awk 'NR == 3 {print $1}') | ||
total_height=$((last_processed_height-start_height+1)) | ||
time_in_seconds=$(t2s "$input_duration") | ||
bps=$(awk "BEGIN {printf \"%.2f\", $total_height / $time_in_seconds}") | ||
# Set outputs for subsequent steps | ||
echo "::set-output name=runner_node::$runner_node" | ||
echo "::set-output name=indexer_version::$indexer_version" | ||
echo "::set-output name=start_height::$start_height" | ||
echo "::set-output name=last_processed_height::$last_processed_height" | ||
echo "::set-output name=total_height::$total_height" | ||
echo "::set-output name=bps::$bps" |