Skip to content

Instantly share code, notes, and snippets.

@gourneau
Created October 24, 2011 23:36
Show Gist options
  • Save gourneau/1310745 to your computer and use it in GitHub Desktop.
Save gourneau/1310745 to your computer and use it in GitHub Desktop.
Ion Torrent - Recursive plugin call
#!/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