YU_Xinjie
07-12-2016, 05:54 PM
The src of the sage program is cod://sage/src/service/bin/sage
goal
1. the script can be used on sage_user@sage_portal to start/stop/status sage.
2. the script should not couple GLAD.
The script would replace the current start.sh/stop.sh/status.sh.
sage main logiccommon var import
sage start
Start a sage_screen to run script start_sage.
start_sage script looks like this:
Use auntie/ps to check whether sage is started correctly.
If start successfully, wake_sage script is executed in a screen. wake_sage would periodically output the tasks graph info into $sage_base/stdout/tasks_graph.tmp.<timestamp>.
sage stop
Use 'dt slay' to stop DT.
Kill the sage_screen.
Use ps to check whether sage is stopped correctly.
sage status
"dexer auntie" to check the status of sage.
sage ps
Use "screen -ls" to get the sage_service screens info.
Use "dexer 'ps aux' | grep -E 'vpc|nrc|scheduler|mem_home|atpd|ncat|xfer|sgl|: ps aux'" to get the processes info.
sage tasks
sage tasks invokes function tasks_sage():
---------
20191123/lingu: move tasks out.
20190511/cwt: Add auntie call.
20190510/lingu: timeout default 3.
20190509/cwt: Add common var import. Add timeout, IP count etc.
20190508/lingu: add src location.
20160927/yxj: decouple sage service script with glad.
goal
1. the script can be used on sage_user@sage_portal to start/stop/status sage.
2. the script should not couple GLAD.
The script would replace the current start.sh/stop.sh/status.sh.
sage main logic
Code:
modname = sage
base=current dir
LearnPcf /thinker/etc/soft/$modname/mic.pcf
LearnPcf $base/config.pcf
ips=$base/hosts.ips
set timeout to be half of the number of lines in $ips or 3 if $ips does not exist
parse options
run command
start
status
ps
tasks
help
sage start
Start a sage_screen to run script start_sage.
start_sage script looks like this:
Code:
trap ctrl_c
if type ctrl_c; then
echo "You type ctrl_c to terminate program"
kill DT
clean all object files and exit
do_start() {
./detect_listen.sh &
make run, which would calls `dt run sage-svc $sage_base/config.pcf`
}
if the 1st parameter == 'nohup'; then
nohup do_start() > $sage_stdout 2>&1 &
else
do_start() 2>&1
Use auntie/ps to check whether sage is started correctly.
If start successfully, wake_sage script is executed in a screen. wake_sage would periodically output the tasks graph info into $sage_base/stdout/tasks_graph.tmp.<timestamp>.
sage stop
Use 'dt slay' to stop DT.
Kill the sage_screen.
Use ps to check whether sage is stopped correctly.
sage status
"dexer auntie" to check the status of sage.
sage ps
Use "screen -ls" to get the sage_service screens info.
Use "dexer 'ps aux' | grep -E 'vpc|nrc|scheduler|mem_home|atpd|ncat|xfer|sgl|: ps aux'" to get the processes info.
sage tasks
sage tasks invokes function tasks_sage():
Code:
local tasks_graph_file=$base/stdout/tasks_graph.tmp
while True {
while True {
cnt = count ${tasks_graph_file}*;
sleep 5 if cnt>1 || cnt==0;
otherwise break;
}
call auntie ##To wake up sage to collect info in all nodes.
check timestamp;
cat $sage_base/stdout/tasks_graph.tmp.<timestamp>
update timestamp;
}
---------
20191123/lingu: move tasks out.
20190511/cwt: Add auntie call.
20190510/lingu: timeout default 3.
20190509/cwt: Add common var import. Add timeout, IP count etc.
20190508/lingu: add src location.
20160927/yxj: decouple sage service script with glad.