服务器端命令行排队
是否可以有一个服务器端程序来排队和管理在命令行执行的进程?
我正在从事的项目从用户处获取图像,修改图像,然后将其作为纹理应用到 3D 形状。该 3D 场景由 Blender/Cinema 4d 在命令行生成,并将其输出为图像。正是这个过程需要排队或以某种方式从服务器端程序进行管理。发送回用户的最终结果是包含动画 3D 形状的视频,其图像作为应用到其上的纹理。
这些渲染可能需要一段时间(也可能不需要),但我如何确保它们在正确的时间执行并以排队的方式完成?
这最好用 python 来完成。
Is it possible to have a server side program that queues and manages processes that are executed at the command line?
The project I am working on takes an image from the user, modifies the image then applies it as a texture to a 3D shape. This 3D scene is generated by blender/Cinema 4d at the command line which outputs it as an image. It is this process that needs to be queued or somehow managed from the server side program. The end result sent back to the user is a video containing an animated 3D shape with their image as a texture applied to it.
These renders may take a while (they may not) but how can I ensure that they are executed at the right times and done so in a queued manner?
This will preferably be done in python.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于缺乏有关如何/为何进行排队的更多详细信息(一次只能运行这么多,事情需要按正确的顺序完成等?),很难提出具体的解决方案。但是,任何情况的基本答案是您想要使用
subprocess
module 来启动进程,然后您可以观察它们(使用该模块提供的工具)等待它们完成,然后执行队列中的下一个进程。Lacking more details about how/why you're doing queuing (can only run so many at a time, things need to be done in the right order, etc?), it's hard to suggest a specific solution. However, the basic answer for any situation is that you want to use the
subprocess
module to fire off the processes, and then you can watch them (using the tools afforded to you by that module) to wait until they're complete and then execute the next one in the queue.