How can I shut down Rserve gracefully?

前端 未结 3 656
青春惊慌失措
青春惊慌失措 2020-12-28 18:56

I have tried many options both in Mac and in Ubuntu. I read the Rserve documentation

http://rforge.net/Rserve/doc.html

and that for the Rse

3条回答
  •  粉色の甜心
    2020-12-28 19:45

    Load Rserve and RSclient packages, then connect to the instances.

    > library(Rserve)
    > library(RSclient)
    
    > Rserve(port = 6311, debug = FALSE)
    > Rserve(port = 6312, debug = TRUE)
    
    Starting Rserve...
     "C:\..\Rserve.exe" --RS-port 6311
    Starting Rserve...
     "C:\..\Rserve_d.exe" --RS-port 6312 
    
    > rsc <- RSconnect(port = 6311)
    > rscd <- RSconnect(port = 6312)
    

    Looks like they're running...

    > system('tasklist /FI "IMAGENAME eq Rserve.exe"')
    > system('tasklist /FI "IMAGENAME eq Rserve_d.exe"')
    
    Image Name                     PID Session Name        Session#    Mem Usage
    ========================= ======== ================ =========== ============
    Rserve.exe                    8600 Console                    1     39,312 K
    Rserve_d.exe                 12652 Console                    1     39,324 K
    

    Let's shut 'em down.

    > RSshutdown(rsc)
    > RSshutdown(rscd)
    

    And they're gone...

    > system('tasklist /FI "IMAGENAME eq Rserve.exe"')
    > system('tasklist /FI "IMAGENAME eq Rserve_d.exe"')
    
    INFO: No tasks are running which match the specified criteria.
    

    Rserve can be used w/o RSclient by starting it with args and/or a config script. Then you can connect to it from some other program (like Tableau) or with your own code. RSclient provides a way to pass commands/data to Rserve from an instance of R.

    Hope this helps :)

提交回复
热议问题