#!/bin/bash # wut-worker # # Starts worker client. # # Usage: # wut-worker # Example: # wut-worker # # Note: # Each node needs a unique index number. # # NOTE! # This generates the node number based off the hostname. # The hosts are ml1 through ml5. The index starts at zero, # so the index is hostname minus one (without alpha). HOSTNUM=`hostname | sed -e 's/ml//g'` let HOSTNUM=$HOSTNUM-1 export TF_CONFIG='{"cluster": {"worker": [ "ml1-int:2222", "ml2-int:2222", "ml3-int:2222", "ml4-int:2222", "ml5-int:2222"]}, "task": {"index": '$HOSTNUM', "type": "worker"}}' echo $TF_CONFIG python3 wut-worker.py