From: Stephan Kosinski <stephan@logan.tv>
Subject: [SUBMIT] auto confirm/submit Form
   Date: Thu, 04 Mar 2010 20:49:21 -0500
Msg# 1923
View Complete Thread (5 articles) | All Threads
Last Next
Hello,

	I am using this kind of command to generate and submit maya render form:

submit-maya.pl -field JobTitle jobname -field ScenePath myScenePath etc.....

It is really convenient since I can launch renders within maya but would be even more convenient I didn't have to click on the "Submit" button to launch the render on the farm.

Is there a way to auto-confirm the form so it goes to the farm as soon as hit "enter" in my shell?

Thank you very much for your help.

Stephan.

   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [SUBMIT] auto confirm/submit Form
   Date: Thu, 04 Mar 2010 21:14:34 -0500
Msg# 1924
View Complete Thread (5 articles) | All Threads
Last Next
Stephan Kosinski wrote:
> 	I am using this kind of command to generate and submit maya render form:
> 
> 	    submit-maya.pl -field JobTitle jobname -field ScenePath myScenePath 
> etc.....
> 
> 	It is really convenient since I can launch renders within maya  but 
> would be even more convenient I didn't have to click on the "Submit" 
> button to launch the render on the farm.
> 
> 	Is there a way to auto-confirm the form so it goes to the farm as soon 
> as hit "enter" in my shell?

	Yes. It should be as easy as:

perl //path/to/submit-maya.pl -submit /var/tmp/myfile.txt

	..where the /var/tmp/myfile.txt contains the key/value pairs
	of the submit form, which you can generate from within maya,
	or from another script.

	When you run that command, the job will go straight to the farm.

	To do that, you can simulate what the submit script does when the
	user hits the 'Submit' button, basically these two steps:

		1) Save out a simple text file that contains the key/value pairs
		   for all the submit form's fields (see below)

		2) Invoke the submit script with the arguments "-submit file"
		   where "file" is the pathname of the above text file. eg:

perl //path/to/submit-maya.pl -submit /var/tmp/myfile.txt

	..where /var/tmp/myfile.txt is a file that contains key/value pairs
	of all the submit fields.
		
	When you submit a maya job, a copy of this key/value file
	is saved in the user's home directory as:

		UNIX: ~/.rush/.submit-maya-last
		WINDOWS: c:\temp\.rush-<USERNAME>\.submit-maya-last

	So for instance, to resubmit the last maya job you submitted,
	under unix you might do:

perl //path/to/submit-maya.pl -submit ~/.rush/.submit-maya-last

	To generate the key/value file yourself, you can nab a copy of the
	one the rush submit form generates, and use that as a template in your
	own script, changing the fields as you want (Frames:, Cpus:, etc).

	It's important that the key/value file have the same fields the submit
	script expects. Be aware that newer versions of the submit-maya script
	sometimes have new fields, so your app would need to keep in sync with these.

	What follows is a unix bash script that does this.
	If you need an example in some other language, let me know.

	Note you may need to modify the key/value data with one of your own
	submit-maya-last files, and you'll need to change the pathname of
	to the submit script for the location on your file server.

* * *

#!/bin/sh

### CREATE A KEY VALUE PAIR FILE
cat << EOF > /var/tmp/myfile.txt
        AutoDump: off
       BatchClip: yes
     BatchFrames: 1
            Cpus: +any=5
           Debug: off
        DoneMail:
        DumpMail:
          Frames: 1-10
    ImageCommand:
  ImageDirectory:
  JobDoneCommand:
  JobDumpCommand:
 JobStartCommand:
        JobTitle:
 LicenseBehavior: Licpause+Retry
    LogDirectory:
        LogFlags: Overwrite
      MaxLogSize: 0
         MaxTime: 00:00:00
    MaxTimeState: Que
       MayaFlags:
     MrayCommand: ray
       MrayFlags:
   MrayVerbosity: 5
    NeverUseCpus:
PrintEnvironment: off
         Project:
             Ram: 1
        Renderer: maya(sw)
         Retries: 3
   RetryBehavior: Fail
 SaveMIDirectory:
       ScenePath: //meade/net/tmp/scenes/foo.ma
      StartIrush: yes
     SubmitHosts:
   SubmitOptions:
         Threads: all
         WaitFor:
    WaitForState: Dump
        _SAVE_ID: Maya-Submit
EOF

### NOW RUN THE SUBMIT-MAYA SCRIPT TO SUBMIT IT AS A JOB
perl //yourserver/rushscripts/submit-maya.pl -submit /var/tmp/myfile.txt

-- 
Greg Ercolano, erco@(email surpressed)
Seriss Corporation
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)

   From: Stephan Kosinski <stephan@logan.tv>
Subject: Re: [SUBMIT] auto confirm/submit Form
   Date: Thu, 04 Mar 2010 21:41:44 -0500
Msg# 1925
View Complete Thread (5 articles) | All Threads
Last Next
Thank you very much Greg, it works perfectly.

That will even allows me to generate one file per layer to render.

One last thing, the "Be very Happy" window is still popping-up, which is really nice :) , but annoying when I have several to close after I launched several forms at a time. Any way to prevent this?

Thank you again for your precious help.

Stephan.






Greg Ercolano wrote:
Stephan Kosinski wrote:
	I am using this kind of command to generate and submit maya render form:

submit-maya.pl -field JobTitle jobname -field ScenePath myScenePath etc.....

It is really convenient since I can launch renders within maya but would be even more convenient I didn't have to click on the "Submit" button to launch the render on the farm.

Is there a way to auto-confirm the form so it goes to the farm as soon as hit "enter" in my shell?

	Yes. It should be as easy as:

perl //path/to/submit-maya.pl -submit /var/tmp/myfile.txt

	..where the /var/tmp/myfile.txt contains the key/value pairs
	of the submit form, which you can generate from within maya,
	or from another script.

	When you run that command, the job will go straight to the farm.

	To do that, you can simulate what the submit script does when the
	user hits the 'Submit' button, basically these two steps:

		1) Save out a simple text file that contains the key/value pairs
		   for all the submit form's fields (see below)

		2) Invoke the submit script with the arguments "-submit file"
		   where "file" is the pathname of the above text file. eg:

perl //path/to/submit-maya.pl -submit /var/tmp/myfile.txt

	..where /var/tmp/myfile.txt is a file that contains key/value pairs
	of all the submit fields.
		
	When you submit a maya job, a copy of this key/value file
	is saved in the user's home directory as:

		UNIX: ~/.rush/.submit-maya-last
		WINDOWS: c:\temp\.rush-<USERNAME>\.submit-maya-last

	So for instance, to resubmit the last maya job you submitted,
	under unix you might do:

perl //path/to/submit-maya.pl -submit ~/.rush/.submit-maya-last

	To generate the key/value file yourself, you can nab a copy of the
	one the rush submit form generates, and use that as a template in your
	own script, changing the fields as you want (Frames:, Cpus:, etc).

	It's important that the key/value file have the same fields the submit
	script expects. Be aware that newer versions of the submit-maya script
	sometimes have new fields, so your app would need to keep in sync with these.

	What follows is a unix bash script that does this.
	If you need an example in some other language, let me know.

	Note you may need to modify the key/value data with one of your own
	submit-maya-last files, and you'll need to change the pathname of
	to the submit script for the location on your file server.

* * *

#!/bin/sh

### CREATE A KEY VALUE PAIR FILE
cat << EOF > /var/tmp/myfile.txt
        AutoDump: off
       BatchClip: yes
     BatchFrames: 1
            Cpus: +any=5
           Debug: off
        DoneMail:
        DumpMail:
          Frames: 1-10
    ImageCommand:
  ImageDirectory:
  JobDoneCommand:
  JobDumpCommand:
 JobStartCommand:
        JobTitle:
 LicenseBehavior: Licpause+Retry
    LogDirectory:
        LogFlags: Overwrite
      MaxLogSize: 0
         MaxTime: 00:00:00
    MaxTimeState: Que
       MayaFlags:
     MrayCommand: ray
       MrayFlags:
   MrayVerbosity: 5
    NeverUseCpus:
PrintEnvironment: off
         Project:
             Ram: 1
        Renderer: maya(sw)
         Retries: 3
   RetryBehavior: Fail
 SaveMIDirectory:
       ScenePath: //meade/net/tmp/scenes/foo.ma
      StartIrush: yes
     SubmitHosts:
   SubmitOptions:
         Threads: all
         WaitFor:
    WaitForState: Dump
        _SAVE_ID: Maya-Submit
EOF

### NOW RUN THE SUBMIT-MAYA SCRIPT TO SUBMIT IT AS A JOB
perl //yourserver/rushscripts/submit-maya.pl -submit /var/tmp/myfile.txt


   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [SUBMIT] auto confirm/submit Form
   Date: Thu, 04 Mar 2010 23:45:20 -0500
Msg# 1926
View Complete Thread (5 articles) | All Threads
Last Next
Stephan Kosinski wrote:
> [posted to rush.general]
> 
> Thank you very much Greg, it works perfectly.
> 
> That will even allows me to generate one file per layer to render.
> 
> One last thing, the "Be very Happy" window is still popping-up, which is 
> really nice :) , but annoying when I have several to close after I 
> launched several forms at a time. Any way to prevent this?

	Ah, that.

	Yes, I recently added the ability to turn that off, which will
	be in the next release. (The new code takes a flexible argument
	list that lets one disable that dialog)

	The code responsible for opening that dialog is in the RushSubmit()
	function in .common.pl, specifically:

----
            open(STARTIRUSH, "|$inputcmd");
            print STARTIRUSH "-----------------\n" .
                             "--- SUBMIT OK ---\n" .
                             "-----------------\n\n" .
                             $msg;
            unless ( close(STARTIRUSH) ) { return(0); } # picked "No Irush"
----

	What I'd suggest as a workaround is putting a conditional around that code
	that checks an environment variable (which you'd set in your application
	to turn that off), ie:

----
            if ( ! defined($ENV{RUSH_NO_SUCCESS_DIALOG}) )  ### ADD THIS LINE
	    {                                               ### ADD THIS LINE
                open(STARTIRUSH, "|$inputcmd");
                print STARTIRUSH "-----------------\n" .
                                 "--- SUBMIT OK ---\n" .
                                 "-----------------\n\n" .
                                 $msg;
                unless ( close(STARTIRUSH) ) { return(0); } # picked "No Irush"
            }                                               ### ADD THIS LINE
----

	..then in your script, just before you invoke the submit script to
	submit the job, set that environment variable RUSH_NO_SUCCESS_DIALOG to 1.
	That will prevent the dialog from opening.

	You can set environment variables from all scripting languages,
	including 'mel', which I think would be with:

		putenv("RUSH_NO_SUCCESS_DIALOG", "1");

	Meanwhile other users invoking the submit script interactively
	will continue to have the normal behavior, because that variable
	would not be set.

	Let me know if that doesn't work.. I'd think it should.

-- 
Greg Ercolano, erco@(email surpressed)
Seriss Corporation
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)

   From: Stephan Kosinski <stephan@logan.tv>
Subject: Re: [SUBMIT] auto confirm/submit Form
   Date: Fri, 05 Mar 2010 14:41:54 -0500
Msg# 1927
View Complete Thread (5 articles) | All Threads
Last Next
Thank you so much Greg.

I'll try that.

Stephan.




Greg Ercolano wrote:
Stephan Kosinski wrote:
[posted to rush.general]

Thank you very much Greg, it works perfectly.

That will even allows me to generate one file per layer to render.

One last thing, the "Be very Happy" window is still popping-up, which is really nice :) , but annoying when I have several to close after I launched several forms at a time. Any way to prevent this?

	Ah, that.

	Yes, I recently added the ability to turn that off, which will
	be in the next release. (The new code takes a flexible argument
	list that lets one disable that dialog)

	The code responsible for opening that dialog is in the RushSubmit()
	function in .common.pl, specifically:

----
            open(STARTIRUSH, "|$inputcmd");
            print STARTIRUSH "-----------------\n" .
                             "--- SUBMIT OK ---\n" .
                             "-----------------\n\n" .
                             $msg;
            unless ( close(STARTIRUSH) ) { return(0); } # picked "No Irush"
----

	What I'd suggest as a workaround is putting a conditional around that code
	that checks an environment variable (which you'd set in your application
	to turn that off), ie:

----
            if ( ! defined($ENV{RUSH_NO_SUCCESS_DIALOG}) )  ### ADD THIS LINE
	    {                                               ### ADD THIS LINE
                open(STARTIRUSH, "|$inputcmd");
                print STARTIRUSH "-----------------\n" .
                                 "--- SUBMIT OK ---\n" .
                                 "-----------------\n\n" .
                                 $msg;
                unless ( close(STARTIRUSH) ) { return(0); } # picked "No Irush"
            }                                               ### ADD THIS LINE
----

	..then in your script, just before you invoke the submit script to
	submit the job, set that environment variable RUSH_NO_SUCCESS_DIALOG to 1.
	That will prevent the dialog from opening.

	You can set environment variables from all scripting languages,
	including 'mel', which I think would be with:

		putenv("RUSH_NO_SUCCESS_DIALOG", "1");

	Meanwhile other users invoking the submit script interactively
	will continue to have the normal behavior, because that variable
	would not be set.

	Let me know if that doesn't work.. I'd think it should.