From: Andrew Kingston <andrew@peerless.co.uk> Subject: Override lastsubmit in submit gui Date: Wed, 05 Mar 2008 06:11:12 -0500 |
Msg# 1699 View Complete Thread (6 articles) | All Threads Last Next |
HiI want to be able to override certain values in the lastsubmit file with the defaults automatically when I open a submit gui. For instance, if I open up submit-maya.pl & put "Maya Job" in the Job Title box, then submit my job, the next time I open up submit-maya.pl I want the Job Title to be its default value (blank), but the rest of the values to be the same as my previous job. I can't quite work out how to do this, so any help is appreciated. Cheers Andrew |
From: Greg Ercolano <erco@(email surpressed)> Subject: Re: Override lastsubmit in submit gui Date: Wed, 05 Mar 2008 09:24:15 -0500 |
Msg# 1700 View Complete Thread (6 articles) | All Threads Last Next |
Andrew Kingston wrote: > I want to be able to override certain values in the lastsubmit file with > the defaults automatically when I open a submit gui. If you're using 102.42a8, submit-maya, submit-shake, and submit-softimage support the -field command line argument, eg: perl //yourserver/rushscripts/submit-maya.pl -field "JobTitle" "Foo" ..see 'submit-maya -help' for more info. In 102.42a9, *all* the submit scripts support this -field flag. (BTW, it's not hard to add this feature to the older scripts.. if anyone needs help with that, follow up here) > For instance, if I > open up submit-maya.pl & put "Maya Job" in the Job Title box, then > submit my job, the next time I open up submit-maya.pl I want the Job > Title to be its default value (blank), but the rest of the values to be > the same as my previous job. I can't quite work out how to do this, so > any help is appreciated. You should be able to do that from the command line via: perl //yourserver/rushscripts/submit-maya.pl -field "JobTitle" "" I suppose you could just make a simple foo.bat script on your desktop that invokes that command. Or you can hack logic into the submit script that does this if you want the behavior for all users. To do that, you could add some code in the MAIN_Input() section of the script where you can resave the form file to remove the 'JobTitle:' line, just before the section of code that invokes 'input' to open the form. If you need a code example for that, just let me know and I can paste it here. But my guess is the above foo.bat file is probably the best thing for you, so that this behavior is local to you. -- Greg Ercolano, erco@(email surpressed) Seriss Corporation Rush Render Queue, http://seriss.com/rush/ Tel: (Tel# suppressed) Fax: (Tel# suppressed) Cel: (Tel# suppressed) |
From: Andrew Kingston <andrew@peerless.co.uk> Subject: Re: Override lastsubmit in submit gui Date: Wed, 05 Mar 2008 09:52:21 -0500 |
Msg# 1701 View Complete Thread (6 articles) | All Threads Last Next |
Greg Ercolano wrote: Still on straight 102.42 I'm afraid - must sort out upgrading one of these days.Andrew Kingston wrote:I want to be able to override certain values in the lastsubmit file with the defaults automatically when I open a submit gui.If you're using 102.42a8, submit-maya, submit-shake, and submit-softimage support the -field command line argument, eg: perl //yourserver/rushscripts/submit-maya.pl -field "JobTitle" "Foo" ..see 'submit-maya -help' for more info. In 102.42a9, *all* the submit scripts support this -field flag. (BTW, it's not hard to add this feature to the older scripts.. if anyone needs help with that, follow up here) For instance, if I open up submit-maya.pl & put "Maya Job" in the Job Title box, then submit my job, the next time I open up submit-maya.pl I want the Job Title to be its default value (blank), but the rest of the values to be the same as my previous job. I can't quite work out how to do this, so any help is appreciated.You should be able to do that from the command line via: perl //yourserver/rushscripts/submit-maya.pl -field "JobTitle" "" I suppose you could just make a simple foo.bat script on your desktop that invokes that command. Or you can hack logic into the submit script that does this if you want the behavior for all users. To do that, you could add some code in the MAIN_Input() section of the script where you can resave the form file to remove the 'JobTitle:' line, just before the section of code that invokes 'input' to open the form. If you need a code example for that, just let me know and I can paste it here. But my guess is the above foo.bat file is probably the best thing for you, so that this behavior is local to you. I did actually want this behaviour for all users, so if you could let me have that code example for the MAIN_Input() section that'd be great. |
From: Greg Ercolano <erco@(email surpressed)> Subject: Re: Override lastsubmit in submit gui Date: Wed, 05 Mar 2008 10:31:04 -0500 |
Msg# 1702 View Complete Thread (6 articles) | All Threads Last Next |
Andrew Kingston wrote: > Still on straight 102.42 I'm afraid - must sort out upgrading one of > these days. Wow, that's about 3 years old ;) > I did actually want this behaviour for all users, so if you could let me > have that code example for the MAIN_Input() section that'd be great. NOTE: When cutting + pasting the below code, be sure your email reader's window is wide enough to prevent wrapping any lines. I'd recommend defining the following function above the definition of the MAIN_Input() function: ---- snip # PEERLESS: MAKE LOCAL HACKS TO THE "LAST SUBMIT" FILE sub HackLastSubmit() { my $err = 0; my $infile = $G::lastsubmit; my $outfile = "${G::lastsubmit}.modify"; # OPEN LASTSUBMIT FILE FOR READING unless ( open(IN, "<$infile") ) { $err = 1; ErrorWindow("open $infile for read: $!"); } # OPEN TMP FILE FOR OUTPUT COPY unless ( open(OUT, ">$outfile") ) { $err = 1; ErrorWindow("open $outfile for write: $!"); } # REMOVE LINES FROM LASTSUBMIT FILE THAT WE DONT WANT while ( <IN> ) { if ( /^\s+JobTitle:/ ) # remove JobTitle lines { next; } print OUT $_; # copy thru all other lines } unless ( close(IN) ) { $err = 1; ErrorWindow("close $infile for reading: $!"); } unless ( close(OUT) ) { $err = 1; ErrorWindow("close $outfile for writing: $!"); } # Apply changes by renaming file over old one (if no errors) if ( $err == 0 ) { unless ( rename($outfile, $infile) ) { ErrorWindow("rename($outfile,$infile): $!"); } } # Make sure we remove tmpfile if somehow left behind unlink($outfile); } ---- snip ..then adding a call to this new function near the top of MAIN_Input(), eg: ---- snip # PRESENT USER WITH INPUT FORM # Prompts the user for data. # sub MAIN_Input() { # CREATE DEFAULTS IF NONE if ( ! -e $G::lastsubmit ) { if ( CreateDotRushDir() < 0 ) { exit(1); } my $errmsg = WriteDefaults($G::lastsubmit); if ( $errmsg ne "" ) { ErrorWindow($errmsg); exit(1); } } # CREATE HISTORY FILE IF NONE open(FD, ">>${G::histfile}"); close(FD); # PEERLESS: APPLY LOCAL HACKS TO THE LASTSUBMIT FILE HackLastSubmit(); #### ADD THIS LINE #### ---- snip That's it. Since the lastsubmit file is ascii (all files in rush are ascii ;) you can just hack away at it with normal text editing techniques. There's actually easier ways to write the above using the predefined functions LoadInput()/SaveInput() functions in .common.pl, but since you might have even older submit scripts, I thought it best to 'spell it all out' with explicit code. If you're curious about those two predefined functions (in .common.pl), you can just peruse the submit scripts that use them to see how they can be used to modify the file's contents with regex's. -- Greg Ercolano, erco@(email surpressed) Seriss Corporation Rush Render Queue, http://seriss.com/rush/ Tel: (Tel# suppressed) Fax: (Tel# suppressed) Cel: (Tel# suppressed) |
From: Andrew Kingston <andrew@peerless.co.uk> Subject: Re: Override lastsubmit in submit gui Date: Thu, 06 Mar 2008 04:51:29 -0500 |
Msg# 1704 View Complete Thread (6 articles) | All Threads Last Next |
Greg Ercolano wrote: Andrew Kingston wrote:Still on straight 102.42 I'm afraid - must sort out upgrading one of these days.Wow, that's about 3 years old ;) Time has just flown by... Thanks for the prompt about LoadInput & SaveInput. I have used them before to do something similar, but had totally forgotten about it. Here's my HackLastSubmit() function.There's actually easier ways to write the above using the predefined functions LoadInput()/SaveInput() functions in .common.pl, but since you might have even older submit scripts, I thought it best to 'spell it all out' with explicit code. If you're curious about those two predefined functions (in .common.pl), you can just peruse the submit scripts that use them to see how they can be used to modify the file's contents with regex's. sub HackLastSubmit() { # LOAD INPUT FORM DATA INTO %in my %in; my $errmsg; my $infile = $G::lastsubmit; if ( LoadInput(\%in, $infile, \$errmsg) < 0 ) { print "$errmsg\n"; exit(1); } $in{JobTitle} = ""; $in{Ram} = "2048"; $in{RetryBehavior} = "AddNever+Requeue"; $in{Retries} = "3"; if ( SaveInput(\%in, $infile, \$errmsg) < 0 ) { print "$errmsg\n"; exit(1); } } Cheers Andrew |
From: Greg Ercolano <erco@(email surpressed)> Subject: Re: Override lastsubmit in submit gui Date: Thu, 06 Mar 2008 05:13:59 -0500 |
Msg# 1705 View Complete Thread (6 articles) | All Threads Last Next |
Andrew Kingston wrote: > Here's my HackLastSubmit() function. > > sub HackLastSubmit() > { > # LOAD INPUT FORM DATA INTO %in > my %in; > my $errmsg; > my $infile = $G::lastsubmit; > > if ( LoadInput(\%in, $infile, \$errmsg) < 0 ) > { print "$errmsg\n"; exit(1); } > > $in{JobTitle} = ""; > $in{Ram} = "2048"; > $in{RetryBehavior} = "AddNever+Requeue"; > $in{Retries} = "3"; > > if ( SaveInput(\%in, $infile, \$errmsg) < 0 ) > { print "$errmsg\n"; exit(1); } > } Yes, exactly! Only suggestion is change the "print" statements to ErrorWindow(), eg: { ErrorWindow("$errmsg\n"); exit(1); } ..so that any errors show up in a little dialog before exiting. Without that, in the context of being called from MAIN_Input(), the messages would go to stdout/stderr, which won't be seen unless the user invoked the script from a command prompt. So if they invoke it from the Desktop and an error occurs, without ErrorWindow(), the script will appear to silently fail, without opening any GUIs, confusing the user (and sysadmin!) In other contexts, such as MAIN_Submit() or MAIN_Render(), messages printed to stdout/err are managed in a useful way. Just not in MAIN_Input(), because no GUI has been opened yet. -- Greg Ercolano, erco@(email surpressed) Seriss Corporation Rush Render Queue, http://seriss.com/rush/ Tel: (Tel# suppressed) Fax: (Tel# suppressed) Cel: (Tel# suppressed) |