Angelo
Angelo

Reputation: 13

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. But I need to get the temporary "file directory" created by OpenCPU so I can pull that directory until the video conversion is done. In order to do that i call the system function with the parameter wait=FALSE as shown bellow

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.

Is this something that can be fixed using 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)

Upvotes: 0

Views: 46

Answers (1)

Angelo
Angelo

Reputation: 13

I just found out that on linux, OpenCPU does not allow for this behavior, It kills all child processes when the request returns. This is on purpose. It doesn't want orphan processes to run potentially forever on the server, opencpu is not designed for that purpose.

Upvotes: 0

Related Questions