Last active
February 27, 2025 09:40
-
-
Save pyropy/2d7c3ca02820a756bcd6155e7491831f to your computer and use it in GitHub Desktop.
Spark Spot Check
This file contains hidden or 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
| #!/bin/bash | |
| # Define the JSON file | |
| JSON_FILE="tasks.json" | |
| # Check if jq is installed | |
| if ! command -v jq &> /dev/null; then | |
| echo "jq is required but not installed. Please install jq first." | |
| exit 1 | |
| fi | |
| # Counter for log filenames | |
| INDEX=0 | |
| # Read JSON array and iterate over items | |
| jq -c '.[]' "$JSON_FILE" | while IFS= read -r task; do | |
| # Define config file and log file | |
| CONFIG_FILE="config.js" | |
| LOG_FILE="output_${INDEX}.log" | |
| # Create config.js with JSON content | |
| cat <<EOF > "$CONFIG_FILE" | |
| // Specifies which round to analyze (default: undefined, uses current round) | |
| export const roundId = undefined | |
| // Limits the number of tasks to process (default: undefined, processes all tasks) | |
| export const maxTasks = undefined | |
| // Focuses spot check on a specific storage provider (default: undefined, spot checks all miners) | |
| export const minerId = undefined | |
| // Sets a size limit for single spot check data retrieval (default: undefined, no size limit) | |
| export const maxByteLength = undefined | |
| // Array of tasks to execute retrievals (default: [] - tasks will be loaded from the network) | |
| export const retrievalTasks = [ | |
| $task | |
| ] | |
| EOF | |
| # Call the binary with the generated config file and write output to the log file | |
| XDG_CACHE_HOME=/downloads ./zinnia run main.js > "$LOG_FILE" 2>&1 | |
| # Clean up config file after execution | |
| rm -f "$CONFIG_FILE" | |
| # Increment log index | |
| ((INDEX++)) | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment