简体   繁体   English

Amazon EC2 / RStudio:是否可以在不维护连接的情况下运行作业?

[英]Amazon EC2 / RStudio : Is there are a way to run a job without maintaining a connection?

I have a long running job that I'd like to run using EC2 + RStudio . 我有一项长期的工作,我想使用EC2 + RStudio运行。 I setup the EC2 instance then setup RStudio as a page on my web browser. 我设置EC2实例,然后将RStudio设置为Web浏览器上的页面。 I need to physically move my laptop that I use to setup the connection and run the web browser throughout the course of the day and my job gets terminated in RStudio but the instance is still running on the EC2 dashboard. 我需要物理上移动我用于设置连接的笔记本电脑,并在一整天内运行Web浏览器,并且我的工作在RStudio终止,但实例仍在EC2仪表板上运行。

Is there a way to keep a job running without maintaining an active connection? 有没有办法在不保持活动连接的情况下保持作业运行?

Does it have to be started / controlled via RStudio? 是否必须通过RStudio启动/控制?

If you make your task a "normal" R script, executed via Rscript or littler, then you can run them from the shell ... and get to 如果您将任务设置为通过Rscript或littler执行的“常规” R脚本,则可以从Shell中运行它们并转到

  • use old-school tools like nohup , batch or at to control running in the background 使用nohupbatchat等老式工具来控制后台运行

  • use tools like screen , tmux or byobu to maintain one or multiple sessions in which you launch the jobs, and connect / disconnect / reconnect at leisure. 使用screentmuxbyobu tmux工具来维护一个或多个会话,以在这些会话中启动作业,并随意连接/断开连接/重新连接。

RStudio Server works in similar ways but AFAICT limits you to a single user per user / machine -- which makes perfect sense for interactive work but is limiting if you have a need for multiple sessions. RStudio服务器以类似的方式工作,但是AFAICT将您限制为每位用户/每台计算机只能使用一个用户-这对于交互工作非常有意义,但是如果您需要多个会话,则会受到限制。

FWIW, I like byobu with tmux a lot for this. FWIW,为此,我非常喜欢带tmux的byobu。

My original concern that it needed to maintain a live connection was incorrect. 我最初担心它需要维持实时连接是不正确的。 It turns out the error was from running out of memory, it just coincided with being disconnected from the internet connection. 事实证明,错误是由于内存不足所致,恰好是与Internet连接断开。

An instance is started from the AWS dashboard and stopped or terminated from there also. 实例从AWS仪表板启动,也从那里停止或终止。 As long as it is still running it can be accessed from an RStudio tab by copying the public DNS to the address bar on the web page and logging in again. 只要它仍在运行,就可以从RStudio选项卡访问它,方法是将公共DNS复制到网页的地址栏中,然后再次登录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM