ds_ssh 438 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. # Copyright 2020 The Microsoft DeepSpeed Team
  3. command -v pdsh
  4. if [ $? != 0 ]; then
  5. echo "Cannot find pdsh, please install via 'apt-get install -y pdsh'"
  6. exit 1
  7. fi
  8. hostfile=/job/hostfile
  9. if [ -f $hostfile ]; then
  10. hosts=`cat $hostfile | awk '{print $1}' | paste -sd "," -`
  11. export PDSH_RCMD_TYPE=ssh
  12. pdsh -w ${hosts} $@
  13. else
  14. echo "Missing hostfile at ${hostfile}, executing command locally"
  15. $@
  16. fi