RStudio

Warning

仅限校内使用,校外浏览器无法打开rstudio server。

  • 载入rstudio

    如果没有配置module,请先配置module,见 module

    $ module load RStudio/4.2 
    

  • 提交rstudio作业

    $ rstudio_submit
    Job <80178229> is submitted to queue <normal>.
    

  • 查看作业输出

    作业正常运行后,使用bpeek命令查看作业输出信息。第7行中,login_port为集群登录端口,login_ip为集群登录IP;13, 14行的用户名和密码为网页端rstudio的登录用户名和密码。

    $  bpeek 80178229
    << output from stdout >>
    
    << output from stderr >>
    1. SSH tunnel from your workstation using the following command:
    
    ssh -p login_port -N -L 0.0.0.0:58093:c03n01:58093 username@login_ip
    
    and point your web browser to http://login_ip:58093
    
    2. log in to RStudio Server using the following credentials:
    
    user: username
    password: OyKPU9F/WM+gLWr432mk
    
    When done using RStudio Server, terminate the job by:
    
    1. Exit the RStudio Session ("power" button in the top right corner of the RStudio window)
    2. Issue the following command on the login node:
    
        bkill 80178229
    

  • 端口转发

    即上面第7行代码的内容,-L 参数部分每次都不相同。将运行在计算节点的rstudio server服务端口转发至登录节点,以便用户能在个人PC上的浏览器中打开rstudio server。在使用rstudio过程中,需要保持该命令在终端中一直运行;rstudio作业结束后,按ctrc+c组合键结束该命令即可。

    Warning

    该命令需要在登录节点运行,不能在交互节点运行。

    $ ssh -p login_port -N -L login_ip:58093:sg59:58093 username@login_ip
    
  • 打开rstudio server

    在个人PC浏览器中打开链接, login_ip:58093,其中58093与上面-L 参数的login_ip:58093保持一致,打开后分别输入上面的用户名和密码即可。有时可能因为存储压力交大,rstudio server后台启动时间较长,导致浏览器页面打开时间较长,此状况等几分钟即可。

    用户可在rstudio中自行安装R包,默认安装路径为${HOME}/R/rstudio/4.2/,不同rstuio版本此路径不同。部分常用R包也可由管理员安装在公共路径中供用户使用。

    require(ggplot2)
    data(diamonds)
    set.seed(42)
    small <- diamonds[sample(nrow(diamonds), 1000), ]
    p <- ggplot(data=small, mapping=aes(x=carat, y=price, shape=cut, colour=color))
    p+geom_point()
    
    rstudio_1

  • 注意事项

    • 一个浏览器中只能打开一个rstudio页面;

    • rstudio作业被提交在interactive队列,该队列每个用户的作业数有限制,请勿提多个studio作业;

    • 每个rstudio作业的时长与interactive上的作业时长一致,一般为24h,超时自动被系统杀掉;

    • 请勿在Rstudio中运行使用非常多内存的程序(30G),否则会被系统杀掉;杀掉之后再启动Rstudio会加载之前的环境和数据,导致Rstudio超内存限制启动失败(Bus error),解决办法为删除目录 ~/.local/share/rstudio

本文阅读量  次
本站总访问量  次