简体   繁体   English

作为屏幕进程运行的 Python 脚本在 Ubuntu / AWS EC2 上被“杀死”

[英]Python script running as screen process gets “Killed” on Ubuntu / AWS EC2

I want to have a python script running on my Ubuntu instance constantly.我想在我的 Ubuntu 实例上不断运行 python 脚本。 It's an AWS EC2 a1.medium instance and the script is taking pretty much 100% of the CPU constantly.这是一个 AWS EC2 a1.medium 实例,脚本不断占用几乎 100% 的 CPU。

I start the script with screen <run script> , however it gets killed randomly and I have no idea why.我用screen <run script>启动脚本,但是它被随机杀死,我不知道为什么。 One time I had it running in the foreground and I saw "Killed" as the last output of the process.有一次我让它在前台运行,我看到“Killed”是进程的最后一个 output。

I tried running it as root with sudo screen <run script> but I get [screen is terminating] .我尝试使用sudo screen <run script>以 root 身份运行它,但我得到[screen is terminating] Not sure if root would even help though.不确定root是否会有所帮助。

Is there anything I can do to troubleshoot this?我能做些什么来解决这个问题吗? I tried with -L -Logfile <filename> with proper permissions for the file, but it stays empty, so I really have no idea how to tell what went wrong.我尝试使用-L -Logfile <filename>对文件具有适当的权限,但它保持为空,所以我真的不知道如何判断出了什么问题。

What is nature of your script?你的剧本的性质是什么? Is it CPU/Memory bound?是否受 CPU/内存限制? I am assuming you are over utilising vCPUs provide in a1.medium EC2 instance我假设您过度使用 a1.medium EC2 实例中提供的 vCPU

You can also take a look at this to understand steal time你也可以看看这个来了解窃取时间

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

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