Spikee
Working with spikee results and datasets using jq and coreutils.
Run these from the main spikee workspace folder
Result files are JSONL. For the jq filters used here, see also Select With Key and Select Fields and Filter by Substring.
Find Successes in the Results Folder
cat results/FILENAME-* | jq -c 'select(.success)'Get Result Lines Where an Error Happened
error is null when there was no error.
jq -c 'select(.error)' RESULT-FILESearch Results by Response or Error Text
Matches lines where the response field contains one string, or error
contains another. Useful for searching a results file for particular items.
jq -c 'select(((.response | strings) | test("some string in the response")) or ((.error | strings) | test("a specific error string")))' RESULTS-FILEGet Items to Re-Run
- Find all items with errors.
- Extract their
idfields into an ids file. - Use the ids file to pick those items out of the original dataset.
- Save them as a new dataset.
# one id per line
jq -cr 'select(.error) | .id' RESULT-FILE | sort -uV > FAILED-IDS-FILE
# new dataset of only the failed ids
jq -c --rawfile f FAILED-IDS-FILE \
'($f
| split("\n")
| map(select(length > 0))
| INDEX(.)
) as $ids
| select($ids[.id | tostring] != null)
' ORIGINAL-DATASET-FILE > NEW-DATASET-FILESplit a Dataset into Chunks for Parallel Runs
Splits a dataset into 3 chunks on line boundaries, producing
SPLIT-DATASET-CHUNK00.jsonl, SPLIT-DATASET-CHUNK01.jsonl and
SPLIT-DATASET-CHUNK02.jsonl, so they can be run in parallel.
split -n l/3 -d --additional-suffix=.jsonl datasets/DATASET-TO-SPLIT datasets/SPLIT-DATASET-CHUNK