Skip to content

Commit

Permalink
update start scripts .in
Browse files Browse the repository at this point in the history
  • Loading branch information
naderzare committed Sep 2, 2024
1 parent 55f6d30 commit 1bd8638
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 70 deletions.
56 changes: 28 additions & 28 deletions src/start-agent.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ coach="${DIR}/sample_coach"
teamname="SSP"
host="localhost"
port=6000
g_ip="localhost"
g_port=50051
diff_g_port="false"
gp20="false"
rpc_host="localhost"
rpc_port=50051
rpc_port_step="false"
rpc_add_20_to_port_for_right="false"
rpc_type="thrift"
coach_port=""
debug_server_host=""
Expand Down Expand Up @@ -82,10 +82,10 @@ usage()
echo " --log-dir DIRECTORY specifies debug log directory (default: /tmp)"
echo " --debug-log-ext EXTENSION specifies debug log file extension (default: .log)"
echo " --fullstate FULLSTATE_TYPE specifies fullstate model handling"
echo " --g-ip GRPC IP specifies grpc IP (default: localhost)"
echo " --g-port GRPC PORT specifies grpc port (default: 50051)"
echo " --diff-g-port specifies different grpc port for each player (default: false)"
echo " --gp20 add 20 to GRPC Port if team run on right side (default: false)"
echo " --rpc-host RPC host specifies rpc host (default: localhost)"
echo " --rpc-port RPC PORT specifies rpc port (default: 50051)"
echo " --rpc-port-step specifies different rpc port for each player (default: false)"
echo " --rpc-add-20-to-port-for-right add 20 to RPC Port if team run on right side (default: false)"
echo " --rpc-type type of rpc framework (default: thrift) or grpc"
echo " --goalie specifies to run as a goalie"
echo " --player specifies to run as a player"
Expand All @@ -101,27 +101,27 @@ do
usage
exit 0
;;
--g-ip)
--rpc-host)
if [ $# -lt 2 ]; then
usage
exit 1
fi
g_ip="${2}"
rpc_host="${2}"
shift 1
;;
--g-port)
--rpc-port)
if [ $# -lt 2 ]; then
usage
exit 1
fi
g_port="${2}"
rpc_port="${2}"
shift 1
;;
--diff-g-port)
diff_g_port="true"
--rpc-port-step)
rpc_port_step="true"
;;
--gp20)
gp20="true"
--rpc-add-20-to-port-for-right)
rpc_add_20_to_port_for_right="true"
;;
--rpc-type)
if [ $# -lt 2 ]; then
Expand Down Expand Up @@ -344,14 +344,14 @@ opt="${opt} --debug_server_host ${debug_server_host}"
opt="${opt} --debug_server_port ${debug_server_port}"
opt="${opt} ${offline_logging}"
opt="${opt} ${debugopt}"
opt="${opt} --g-ip ${g_ip}"
opt="${opt} --g-port ${g_port}"
opt="${opt} --rpc-host ${rpc_host}"
opt="${opt} --rpc-port ${rpc_port}"
opt="${opt} --rpc-type ${rpc_type}"
if [ "${same_g_port}" = "true" ]; then
opt="${opt} --diff-g-port"
if [ "${rpc_port_step}" = "true" ]; then
opt="${opt} --rpc-port-step"
fi
if [ "${gp20}" = "true" ]; then
opt="${opt} --gp20"
if [ "${rpc_add_20_to_port_for_right}" = "true" ]; then
opt="${opt} --rpc-add-20-to-port-for-right"
fi

ping -c 1 $host
Expand All @@ -374,14 +374,14 @@ if [ "${is_coach}" = "true" ]; then
coachopt="${coachopt} --debug_server_port ${debug_server_port}"
coachopt="${coachopt} ${offline_logging}"
coachopt="${coachopt} ${debugopt}"
coachopt="${coachopt} --g-ip ${g_ip}"
coachopt="${coachopt} --g-port ${g_port}"
coachopt="${coachopt} --rpc-host ${rpc_host}"
coachopt="${coachopt} --rpc-port ${rpc_port}"
coachopt="${coachopt} --rpc-type ${rpc_type}"
if [ "${same_g_port}" = "true" ]; then
coachopt="${coachopt} --diff-g-port"
if [ "${rpc_port_step}" = "true" ]; then
coachopt="${coachopt} --rpc-port-step"
fi
if [ "${gp20}" = "true" ]; then
coachopt="${coachopt} --gp20"
if [ "${rpc_add_20_to_port_for_right}" = "true" ]; then
coachopt="${coachopt} --rpc-add-20-to-port-for-right"
fi
$coach ${coachopt} &
fi
40 changes: 20 additions & 20 deletions src/start.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ coach="${DIR}/sample_coach"
teamname="SSP"
host="localhost"
port=6000
g_ip="localhost"
g_port=50051
diff_g_port="false"
gp20="false"
rpc_host="localhost"
rpc_port=50051
rpc_port_step="false"
rpc_add_20_to_port_for_right="false"
rpc_type="thrift"
coach_port=""
debug_server_host=""
Expand Down Expand Up @@ -84,10 +84,10 @@ usage()
echo " --log-dir DIRECTORY specifies debug log directory (default: /tmp)"
echo " --debug-log-ext EXTENSION specifies debug log file extension (default: .log)"
echo " --fullstate FULLSTATE_TYPE specifies fullstate model handling"
echo " --rpc-ip GRPC IP specifies grpc IP (default: localhost)"
echo " --rpc-port GRPC PORT specifies grpc port (default: 50051)"
echo " --rpc-port-step specifies different grpc port for each player (default: false)"
echo " --rpc-add-20-to-port-for-right add 20 to GRPC Port if team run on right side (default: false)"
echo " --rpc-host RPC host specifies rpc host (default: localhost)"
echo " --rpc-port RPC PORT specifies rpc port (default: 50051)"
echo " --rpc-port-step specifies different rpc port for each player (default: false)"
echo " --rpc-add-20-to-port-for-right add 20 to RPC Port if team run on right side (default: false)"
echo " --rpc-type type of rpc framework (default: thrift) or grpc"
echo " FULLSTATE_TYPE is one of [ignore|reference|override].") 1>&2
}
Expand All @@ -105,22 +105,22 @@ do
usage
exit 1
fi
g_ip="${2}"
rpc_host="${2}"
shift 1
;;
--rpc-port)
if [ $# -lt 2 ]; then
usage
exit 1
fi
g_port="${2}"
rpc_port="${2}"
shift 1
;;
--rpc-port-step)
diff_g_port="true"
rpc_port_step="true"
;;
--rpc-add-20-to-port-for-right)
gp20="true"
rpc_add_20_to_port_for_right="true"
;;
--rpc-type)
if [ $# -lt 2 ]; then
Expand Down Expand Up @@ -351,13 +351,13 @@ opt="${opt} --debug_server_host ${debug_server_host}"
opt="${opt} --debug_server_port ${debug_server_port}"
opt="${opt} ${offline_logging}"
opt="${opt} ${debugopt}"
opt="${opt} --rpc-host ${g_ip}"
opt="${opt} --rpc-port ${g_port}"
opt="${opt} --rpc-host ${rpc_host}"
opt="${opt} --rpc-port ${rpc_port}"
opt="${opt} --rpc-type ${rpc_type}"
if [ "${same_g_port}" = "true" ]; then
if [ "${rpc_port_step}" = "true" ]; then
opt="${opt} --rpc-port-step"
fi
if [ "${gp20}" = "true" ]; then
if [ "${rpc_add_20_to_port_for_right}" = "true" ]; then
opt="${opt} --rpc-add-20-to-port-for-right"
fi

Expand Down Expand Up @@ -408,13 +408,13 @@ if [ "${usecoach}" = "true" ]; then
coachopt="${coachopt} --debug_server_port ${debug_server_port}"
coachopt="${coachopt} ${offline_logging}"
coachopt="${coachopt} ${debugopt}"
coachopt="${coachopt} --rpc-host ${g_ip}"
coachopt="${coachopt} --rpc-port ${g_port}"
coachopt="${coachopt} --rpc-host ${rpc_host}"
coachopt="${coachopt} --rpc-port ${rpc_port}"
coachopt="${coachopt} --rpc-type ${rpc_type}"
if [ "${same_g_port}" = "true" ]; then
if [ "${rpc_port_step}" = "true" ]; then
coachopt="${coachopt} --rpc-port-step"
fi
if [ "${gp20}" = "true" ]; then
if [ "${rpc_add_20_to_port_for_right}" = "true" ]; then
coachopt="${coachopt} --rpc-add-20-to-port-for-right"
fi

Expand Down
45 changes: 23 additions & 22 deletions src/train.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ coach="${DIR}/sample_coach"
trainer="${DIR}/sample_trainer"
teamname="TRAINER_MODE"
host="localhost"
g_port=50051
diff_g_port="false"
gp20="false"
rpc_host="localhost"
rpc_port=50051
rpc_port_step="false"
rpc_add_20_to_port_for_right="false"
rpc_type="thrift"
config="${DIR}/player.conf"
config_dir="${DIR}/formations-dt"
Expand All @@ -40,10 +41,10 @@ usage()
echo "Possible options are:"
echo " --help print this"
echo " -h, --host HOST specifies server host"
echo " --rpc-host HOST specifies grpc host (default: localhost)"
echo " --rpc-port GRPC PORT specifies grpc port (default: 50051)"
echo " --rpc-port-step specifies different grpc port for each player (default: false)"
echo " --rpc-add-20-to-port-for-right add 20 to GRPC Port if team run on right side (default: false)"
echo " --rpc-host RPC host specifies rpc host (default: localhost)"
echo " --rpc-port RPC PORT specifies rpc port (default: 50051)"
echo " --rpc-port-step specifies different rpc port for each player (default: false)"
echo " --rpc-add-20-to-port-for-right add 20 to RPC Port if team run on right side (default: false)"
echo " --rpc-type type of rpc framework (default: thrift) or grpc"
echo " -t, --teamname TEAMNAME specifies team name") 1>&2
}
Expand Down Expand Up @@ -74,27 +75,27 @@ do
teamname=$2
shift 1
;;
--rpc-host)
--rpc-host)
if [ $# -lt 2 ]; then
usage
exit 1
fi
g_ip="${2}"
rpc_host="${2}"
shift 1
;;
--rpc-port)
if [ $# -lt 2 ]; then
usage
exit 1
fi
g_port="${2}"
rpc_port="${2}"
shift 1
;;
--rpc-port-step)
diff_g_port="true"
rpc_port_step="true"
;;
--rpc-add-20-to-port-for-right)
gp20="true"
rpc_add_20_to_port_for_right="true"
;;
--rpc-type)
if [ $# -lt 2 ]; then
Expand All @@ -116,14 +117,14 @@ done
OPT="-h ${host} -t ${teamname}"
OPT="${OPT} --player-config ${config} --config_dir ${config_dir}"
OPT="${OPT} ${debugopt}"
OPT="${OPT} --rpc-host ${g_ip}"
opt="${opt} --rpc-port ${g_port}"
opt="${opt} --rpc-host ${rpc_host}"
opt="${opt} --rpc-port ${rpc_port}"
opt="${opt} --rpc-type ${rpc_type}"
if [ "${same_g_port}" = "true" ]; then
OPT="${OPT} --rpc-port-step"
if [ "${rpc_port_step}" = "true" ]; then
opt="${opt} --rpc-port-step"
fi
if [ "${gp20}" = "true" ]; then
OPT="${OPT} --rpc-add-20-to-port-for-right"
if [ "${rpc_add_20_to_port_for_right}" = "true" ]; then
opt="${opt} --rpc-add-20-to-port-for-right"
fi
#if [ $number -gt 0 ]; then
# $player ${OPT} -g &
Expand All @@ -140,13 +141,13 @@ fi
$player ${OPT} -n 1 --rpc-type ${rpc_type} &
$sleepprog $sleeptime
trainer_opt="-h $host -t $teamname"
trainer_opt="${trainer_opt} --rpc-host ${g_ip}"
trainer_opt="${trainer_opt} --rpc-port ${g_port}"
trainer_opt="${trainer_opt} --rpc-host ${rpc_host}"
trainer_opt="${trainer_opt} --rpc-port ${rpc_port}"
trainer_opt="${trainer_opt} --rpc-type ${rpc_type}"
if [ "${same_g_port}" = "true" ]; then
if [ "${rpc_port_step}" = "true" ]; then
trainer_opt="${trainer_opt} --rpc-port-step"
fi
if [ "${gp20}" = "true" ]; then
if [ "${rpc_add_20_to_port_for_right}" = "true" ]; then
trainer_opt="${trainer_opt} --rpc-add-20-to-port-for-right"
fi
$trainer $trainer_opt &

0 comments on commit 1bd8638

Please sign in to comment.