Created
October 24, 2011 23:36
-
-
Save gourneau/1310745 to your computer and use it in GitHub Desktop.
Ion Torrent - Recursive plugin call
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
#!/bin/bash | |
VERSION="0.1" | |
#Set the URL for the API requests | |
plugin_url=http://127.0.0.1/rundb/api/v1/results/${RUNINFO__PK}/plugin/ | |
#Set the HTTP Headers | |
api_header="Content-Type: application/json;Accept: application/json" | |
#Count the number of plugins with status of "Started" | |
running=`curl --silent \ | |
--header ${api_header} \ | |
--location ${plugin_url} | | |
jsonpipe | | |
grep pluginState/ | | |
grep -v ${RUNINFO__PLUGIN_NAME} | | |
awk '{print $2}'| | |
grep "Started" | | |
wc -l` | |
#write out the json to rerun the plugin | |
echo {\"plugin\":[\"${RUNINFO__PLUGIN_NAME}\"]} > post.json | |
if [ "$running" -ne "0" ] | |
then | |
#if there are plugins still "started" then call this plugin again | |
echo "There are still plugins running, calling this plugin again." | |
#wait a few seconds first | |
sleep 10 | |
curl --silent --header ${api_header} \ | |
--location ${plugin_url} \ | |
--request POST \ | |
--data "@post.json" | |
else | |
#All of the other plugins have finished -- do your final step here | |
echo "Done!" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment