#!/usr/bin/env bash

# Extract config file from json with Python inline code
FN_CONFIG=$(python -c 'import json; print(json.load(open("kwargs.json"))["config"])')
PAUSE=$(python -c 'import json; print(json.load(open("kwargs.json"))["pause"])')
# Alternative tools doing the same, which need to be installed:
# FN_CONFIG=$(jq -r .config kwargs.json)
# FN_CONFIG=$(gojq -r .config kwargs.json)
# FN_CONFIG=$(jql -r '."config"' kwargs.json)

echo "Computing some result"
echo "Did something with ${FN_CONFIG}" > computation.out
sleep ${PAUSE}
echo '"computation.out"' > result.json
