mirror of
https://github.com/deepspeedai/DeepSpeed.git
synced 2025-10-20 15:33:51 +08:00
allow passing hostfile to ds_ssh (#1504)
This commit is contained in:
18
bin/ds_ssh
18
bin/ds_ssh
@ -10,11 +10,25 @@ fi
|
|||||||
|
|
||||||
hostfile=/job/hostfile
|
hostfile=/job/hostfile
|
||||||
|
|
||||||
|
while getopts "h?f:" opt; do
|
||||||
|
case "$opt" in
|
||||||
|
h|\?)
|
||||||
|
echo "-f <hostfile>: specify a hostfile, defaults to /job/hostfile"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
f)
|
||||||
|
hostfile=$OPTARG
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "hostfile=$hostfile"
|
||||||
|
|
||||||
if [ -f $hostfile ]; then
|
if [ -f $hostfile ]; then
|
||||||
hosts=`cat $hostfile | awk '{print $1}' | paste -sd "," -`
|
hosts=`cat $hostfile | awk '{print $1}' | paste -sd "," -`
|
||||||
export PDSH_RCMD_TYPE=ssh
|
export PDSH_RCMD_TYPE=ssh
|
||||||
pdsh -w ${hosts} $@
|
pdsh -w ${hosts} $@
|
||||||
else
|
else
|
||||||
echo "Missing hostfile at ${hostfile}, executing command locally"
|
echo "Missing hostfile at ${hostfile}, unable to proceed"
|
||||||
$@
|
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user