Closed Dinaamagdy closed 4 years ago
startupcmd =j.servers.startupcmd.get("")
j.servers.corex.default.start()
corex = j.servers.corex.default.client
startupcmd.executor = "corex"
startupcmd.corex_client_name = corex.name startupcmd.cmd_start="python3 -m http.server"
startupcmd.start()
--TRACEBACK------------------
<stdin> in <module>
1
/sandbox/lib/jumpscale/Jumpscale/servers/startupcmd/StartupCMD.py in start
500 if not reset and self.is_running() == True:
/sandbox/lib/jumpscale/Jumpscale/servers/startupcmd/StartupCMD.py in is_running
336 return self._error_raise("cannot check running don't have pid or corex_id")
/sandbox/lib/jumpscale/Jumpscale/servers/startupcmd/StartupCMD.py in _error_raise
90 raise j.exceptions.Base(msg)
-----------------------------
Tue 24 08:55:35 tupcmd/StartupCMD.py - 90 - _error_raise : EXCEPTION:
error in startupcmd :ee
cannot check running don't have pid or corex_id
None```
Issue : stop with foreground The issue occured because the pid was not set for the startupcmd as once the cmd was executed in foreground it was blocking and therefore the rest of the start cmd wasnt executed. When stopping there was no pid set to stop the process by
Fix: Make self.pid a property that is retrieved everytime by getting the pid from the name of the startupcmd and not using the one saved in the innstance itself
Issue: JUMPSCALE interpreter Fix: https://github.com/threefoldtech/jumpscaleX_core/commit/2e14a31069aa08810c293cb8cee8bac7f0c858e8
WIP: corex executor doesn't work fixes so far: start and stop working for the first time.
j.sal.process.getProcessObject(pid)
has a sleeping statusCurrent issue: When starting then stopping then starting again, the previous corex pid is used and there is no process that is currently running with this pid. Working on resetting corex data when stopping the server
Issue: corex executor doesn't work Fixes in startupcmd:
same for foreground stop not working
same for foreground stop not working
It is working with 2 scenarios: 1 - manually entering tmux session and starting the process in foreground and stopping it from outside tmux 2 - starting and stopping the process in foreground without tmux being involved
Due to the following change https://github.com/threefoldtech/jumpscaleX_core/commit/e6895989e4cbb29a58fb8ef8de36f96f39d50653#diff-03f28845f874457487974ea8fecb3dddL526 , the fixes were reverted and the following error arises again. Will look into it.
corex executor doesn't work:
startupcmd =j.servers.startupcmd.get("") j.servers.corex.default.start() corex = j.servers.corex.default.client startupcmd.executor = "corex" startupcmd.corex_client_name = corex.name startupcmd.cmd_start="python3 -m http.server" startupcmd.start()
--TRACEBACK------------------ <stdin> in <module> 1 /sandbox/lib/jumpscale/Jumpscale/servers/startupcmd/StartupCMD.py in start 500 if not reset and self.is_running() == True: /sandbox/lib/jumpscale/Jumpscale/servers/startupcmd/StartupCMD.py in is_running 336 return self._error_raise("cannot check running don't have pid or corex_id") /sandbox/lib/jumpscale/Jumpscale/servers/startupcmd/StartupCMD.py in _error_raise 90 raise j.exceptions.Base(msg) ----------------------------- Tue 24 08:55:35 tupcmd/StartupCMD.py - 90 - _error_raise : EXCEPTION: error in startupcmd :ee cannot check running don't have pid or corex_id None```
start and stop working fine in foreground
3BOTDEVEL:3bot:~: tmux new-session -d -s session 'kosmos -p "j.servers.startupcmd.get().start()"'
3BOTDEVEL:3bot:~: ss -ntulp
NetidState Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 5 0.0.0.0:8000 0.0.0.0:* users:(("python3",pid=1793,fd=3))
tcp LISTEN 0 128 0.0.0.0:6379 0.0.0.0:* users:(("redis-server",pid=68,fd=7))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=24,fd=3))
tcp LISTEN 0 128 [::]:6379 [::]:* users:(("redis-server",pid=68,fd=6))
tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=24,fd=4))
3BOTDEVEL:3bot:~: tmux new-session -d -s session1 'kosmos -p "j.servers.startupcmd.get().stop()"'
3BOTDEVEL:3bot:~: ss -ntulp
NetidState Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 128 0.0.0.0:6379 0.0.0.0:* users:(("redis-server",pid=68,fd=7))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=24,fd=3))
tcp LISTEN 0 128 [::]:6379 [::]:* users:(("redis-server",pid=68,fd=6))
tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=24,fd=4))
3BOTDEVEL:3bot:~:
start and stop in background is working fine also:
JSX> x=j.servers.startupcmd.get("test")
JSX> x.executor="background"
JSX> x.cmd_start = "python -m SimpleHTTPServer"
JSX> x.stop()
True
but there is an issue with corex executor when you but these commands as one step the status of startupcmd is updated successfully from NOTFOUND to RUNNING and it starts without any errors.
JSX> j.servers.corex.default.start()
JSX> corex = j.servers.corex.default.client
JSX> startupcmd = j.servers.startupcmd.get(name="startup_test",executor="corex",corex_client_name=corex.name,cmd_start="python3 -m http.server")
JSX> startupcmd.start()
JSX> startupcmd.stop()
True
and when you start it step by step you got an error because of failing in getting startupmd status
JSX> startupcmd =j.servers.startupcmd.get("")
JSX> j.servers.corex.default.start()
JSX> corex = j.servers.corex.default.client
JSX> startupcmd.executor = "corex"
JSX> startupcmd.corex_client_name = corex.name
JSX> startupcmd.cmd_start="python3 -m http.server"
JSX> startupcmd.start()
Wed 20 14:55:00 tupcmd/StartupCMD.py - 544 - start : EXCEPTION:
RuntimeError()
--TRACEBACK------------------
<stdin> in <module>
1
/sandbox/lib/jumpscale/Jumpscale/servers/startupcmd/StartupCMD.py in start
544 raise RuntimeError()
-----------------------------
now all start options (corex, background,foreground ) works successfully but all .stop() don't work it return true but server keep runnning
@Dinaamagdy can u please update all branches to unstable and check again stop() should be working
verified on branch unstable
- stop with foreground
Steps
startupcmd_server = j.servers.startupcmd.get() startupcmd_server.executor = "foreground" startupcmd_server.cmd_start = "python3 -m http.server" tmux -d -s session 'kosmos -p "j.servers.startupcmd.get().start()"' tmux -d -s session 'kosmos -p "j.servers.startupcmd.get().stop()"'
Issue
- corex executor doesn't work:
startupcmd =j.servers.startupcmd.get("") j.servers.corex.default.start() corex = j.servers.corex.default.client startupcmd.executor = "corex" startupcmd.corex_client_name = corex.name startupcmd.cmd_start="python3 -m http.server"
startupcmd.start()
- JUMPSCALE interpreter
server=j.servers.startupcmd.get("dinad")
server.interpreter="JUMPSCALE"
server.cmd_start="j.sal.fs.createEmptyFile('/root/dina')" servet.start()