Last active
April 28, 2016 17:09
-
-
Save sgnn7/c09049a642da5e27a6729e30b791a418 to your computer and use it in GitHub Desktop.
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
APP_NAME=foobar | |
TASK_INDEX=0 | |
LOG_TYPE=stderr # or stdout | |
MARATHON_HOST="marathon.host.local" | |
SCHEME=https | |
MARATHON_TASK_URI="$SCHEME://$MARATHON_HOST/v2/apps/$APP_NAME?embed=app.tasks" | |
app_info=$(curl "$MARATHON_TASK_URI") | |
app_task=$(echo ${app_info} | jq -r ".app.tasks[$TASK_INDEX]") | |
app_task_id=$(echo ${app_task} | jq -r '.id') | |
app_task_slave_host=$(echo ${app_task} | jq -r '.host') | |
full_slave_status=$(curl -s $SCHEME://${app_task_slave_host}:5051/state) | |
app_log_dir=$(echo ${full_slave_status} | jq -r '.frameworks[0].executors[].directory' | grep "${app_task_id}") | |
path_param="${app_log_dir}/${LOG_TYPE}" | |
encoded_path=${path_param//\//%2F} | |
echo | |
echo "================= ${LOG_TYPE} =================" | |
echo "=================LOG BELOW=================" | |
curl $SCHEME://${app_task_slave_host}:5051/files/download?path=${encoded_path} | |
echo "==================END LOG==================" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment