[英]Process get terminated when I call system() with wait=FALSE
I'm trying to process videos on OpenCPU and because they are very big I want to call the "FFmpeg" process using "system" and allow it to keep working until it's done.我正在尝试在 OpenCPU 上处理视频,因为它们非常大,所以我想使用“系统”调用“FFmpeg”进程,并让它继续工作直到完成。 But I need to get the temporary "file directory" created by OpenCPU so I can pull that directory until the video conversion is done.
但我需要获取由 OpenCPU 创建的临时“文件目录”,以便我可以拉取该目录,直到视频转换完成。 In order to do that i call the system function with the parameter wait=FALSE as shown bellow
为此,我使用参数 wait=FALSE 调用系统 function,如下所示
This work fine if I use the library(opencpu) on my machine, but when I move this into the production environment (Ubuntu 14.x) the system call get interrupted just after starting.如果我在我的机器上使用库(opencpu),这个工作正常,但是当我将它移动到生产环境(Ubuntu 14.x)时,系统调用在启动后立即中断。
Is this something that can be fixed using opencpu.confg?这是可以使用 opencpu.confg 修复的问题吗? Or is it a bug?
或者这是一个错误?
ffmpeg_exe <- "/usr/bin/ffmpeg" # Linux path
exec_convert <- paste0("( ",ffmpeg_exe,' -i ',input_file,' ',convert_command,' ',output_file, ' 2> PROCESS_OUTPUT.txt ; ls > PROCESS_DONE.txt ',")")
system(exec_convert, wait=FALSE)
I just found out that on linux, OpenCPU does not allow for this behavior, It kills all child processes when the request returns.我刚刚发现在 linux 上,OpenCPU 不允许这种行为,它会在请求返回时杀死所有子进程。 This is on purpose.
这是故意的。 It doesn't want orphan processes to run potentially forever on the server, opencpu is not designed for that purpose.
它不希望孤立进程在服务器上永远运行,opencpu 不是为此目的而设计的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.