连接断开时,PyCharm远程进程完成 [英] PyCharm remote processes finish when connection breaks

查看:351
本文介绍了连接断开时,PyCharm远程进程完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用通过SSH连接的远程解释器来运行项目(PyCharm Professional 2016.3.3).当我建立连接时,一切正常,但是如果我的连接中断(我不小心合上了笔记本电脑盖,进入了睡眠模式,或者由于某种未知原因,wifi连接暂时中断了),那么当我重新连接时,控制台会话将终止Process finished with exit code -1.

I am running a project using a remote interpreter using an SSH connection (PyCharm professional 2016.3.3). When I have a connection everything works fine, but if my connection gets interrupted (either I accidentally close the laptop lid, enter sleep mode, or the wifi connection breaks momentarily for some unknown reason) then when I reconnect, my console session is terminated with Process finished with exit code -1.

交互式控制台的输出为:

The output from the interactive console reads:

ssh://username@remote_server:22/usr/bin/python /home/some_path/.pycharm_helpers/pydev/pydevconsole.py 0 0
PyDev console: using IPython 5.1.0
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
>>> a = 1
>>> # At this point I break the connection and then re-establish it after about 1 min. 
Process finished with exit code -1

在此示例中,我禁用了wifi,然后重新启用,连接到其他wifi源,然后再连接回原始wifi源.这种情况发生的频率适中(可能每天一次),可能是一个真正的障碍.

In this example I disabled wifi, and then re-enabled, connecting to a different wifi source, and then connected back to the orignal wifi source. This happens moderately frequently (maybe once daily) and can be a real hindrance.

是否存在可以更改的设置来避免这种情况,或者是否存在更强大的连接方法来将控制台连接到远程主机上运行的进程?理想的情况是,如果我失去与一个wifi源的连接并打开与另一个wifi的连接,那么我的进程将不会被杀死.

Is there perhaps a setting I can change to avoid this, or is there a more robust connection method to attach the console to the process running on the remote host? The ideal situation would be one where if I lost my connection with one wifi source and opened a connection with another then my process would not be killed.

NB-进行交互式会议非常重要,因为我的工作是基于研究的,因此我需要能够交互式地编写和运行代码.

NB - It is important that I can have an interactive session, as my work is research based and I would need to be able to interactively write and run code.

推荐答案

我也在寻找解决此问题的方法.我现在唯一想到的解决方法是,在工具">部署">配置">高级选项"下将保持活动的消息间隔"设置为很高的值.也许这解决了该过程完成的问题(但是我还无法测试).

I am also looking for a solution to this problem. The only workaround that I can think of for now is to set the keep alive message interval to a very high value under Tools>Deployment>Configuration>Advance Options. Maybe this solves the problem that the process finishes (But I couldn't test this yet).

这篇关于连接断开时,PyCharm远程进程完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆