We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Running Processing in batch mode
Page Index Toggle Pages: 1
Running Processing in batch mode? (Read 2331 times)
Running Processing in batch mode?
Jan 15th, 2010, 5:16am
 
Hi,

I would like to know if is it is possible to run a Processing script in batch mode, i.e. non-interactively, trough a command line, without any active display on screen.

This could be useful for me to integrate processing in a production environment running on a remote HPC cluster. (by the way, I am using Linux). For example to post-process automatically the frames of a video, saving the post-processed sequence of images in a storage.

I am not expert in java at the moment, so maybe I have posed a stupid question.

Thank you.
Re: Running Processing in batch mode?
Reply #1 - Jan 15th, 2010, 5:20am
 
See Commander
Re: Running Processing in batch mode?
Reply #2 - Jan 23rd, 2010, 1:53pm
 
Wow, you know, I had the same question!  And apparently 123 people
have viewed this post since Jan 15.  It seems to be a popular question.
Perhaps a more detailed answer might be made available to those
of us who are new to Processing?

It seems somewhat strange to me that ./processing --help doesn't explain
this question directly.
Re: Running Processing in batch mode?
Reply #3 - Feb 21st, 2010, 12:23am
 
Yes. An example or just an explicit documentation should be great. Actually this issue is what is preventing me from using Processing in my work...

I just understood that "commander" is a java class that can be used for this purpose. But I haven't understood how to use it and if this class is already included in the processing package. Should one have to compile and include it by him/herself?

Maybe the problem is only that I am not a java expert, so maybe it is just a matter of knowing how to manage standard java apps produced with Processing.

Thank you anyway.
Re: Running Processing in batch mode?
Reply #4 - Feb 21st, 2010, 1:49am
 
Thinking more about it, I don't think that Commander allows you to do headless processing (sic) power... (but I can be wrong).
The core of Processing code is PApplet, which, as the name implies, is an applet, something made to run in a browser, but that can be run standalone.
But it is designed to display a window in all cases. When I do a quick graphics-less sketch (eg. println("Info")), I still have the default display, I have to get rid of it by calling exit() at the end.

So, if I am not mistaken, to make a headless Processing, one would need to take the source code of PApplet and hack it to remove references to java.applet.Applet (and usage of keyboard, mouse, scanning display characteristics, etc.).
Ie. it would need an alternative Processing application. Not very hard to do if you know Java a bit...

[EDIT] Searching headless in shows this old thread: Server-side image generation. Basically, fry confirms my observations...
On the other side, in Processing on EC2, OP mentions using Xvfb (virtual frame buffers) to simulate display on a headless server. I don't know more about that...
Re: Running Processing in batch mode?
Reply #5 - Feb 21st, 2010, 4:45am
 
Thank you for the tips. I actually succeed to run Processing in a "virtual" display using Xvfb (installed on a Linux Ubuntu server):

Code:

> sudo apt-get install xvfb
> Xvfb :2 -screen 0 1024x768x24 &
> export DISPLAY=localhost:2.0
> ./<myExportedProcessingApplication>


I think this is the fastest and easiest (even if maybe not so elegant) way to run non-interactively a Processing script on a remote server (the script needs to be previously exported as an application, from the Processing gui).
Page Index Toggle Pages: 1