[Closed] Trying to access a job submited with cmdjob.exe.. Please Help
Hi, and thanks in advance for any ideas to solve my problem.
Im working on a script that uses pre and post scripts.
In the pre script i use a cmdjob.exe command as a way to start Vrayspawner2009.exe when the render start on the specific nodes that i want to use for distribute render :
The Pre script is like below: (it works fine, it creates a new job on the manager with one task, using teh servers i specified. it also turns vray spawner on the remote server without a problem)
vr = renderers.current
jobname = "Vraydr"+user
global list = ""
for i in 1 to cowslist.count do ( if i == 1 do (list = list + cowslist[i]) if i > 1 do (list = list + ";" + cowslist[i]) )
sendCommand = "\"C:\Program Files (x86)\Autodesk\Backburner\cmdjob.exe\" -jobName " +jobname +" -jobNameAdjust -manager service -servers " + list + " -priority 50 -numTasks " + cowslist.count as string + " -blocktasks -taskName 0 -leaveInQueue -workpath \"C:\Program Files\Autodesk\3ds Max 2009\" vrayspawner2009.exe"
directory = "C:\Users\\" + user + "\Documents\3dsmax\\"
if vr.system_distributedRender == true do
(
if CowsList != undefined do --cowslist is my variable with an array of the render nodes
-- START send a cmdjob to backburner to make servers that will be used fro dist busy --
towritecmd = directory +"dist_bb_job" + ".cmd"
send = fopen towritecmd "wb"
Writestring send sendCommand
fclose send
send = fopen towritecmd "r"
ShellLaunch towritecmd ""
-- END send a cmdjob to backburner to make servers that will be used fro dist busy --
)
In the post script i want to either end that job, that i started or delete it from the manager, so that the servers become idle and can pickup other tasks.
The problem is that i try to access the job from a script within max, and is not listed on the jobs array(after connecting to my manager using sjobs = man.getjobs()), but i can see it on the monitor, is there and i can manually delete it.
Any ideas of how can i remotely delete this job… i need it to be called from the post-render script so that is automatic.
What i have tried already is using taskill, to end the process vrayspawner2009.exe on the remote machines, but this only creates an error and the job on the monitor turns red and restarts. So this doesnt work
I appreciatte if anyone has any clues… im at lost.
Thanks,
M.
I am having a similar problem with cmdjob. The jobs do not register that they are finished and getjobs() gives a blank array or other manually submitted jobs only.
My shell command is roughly;
shelllaunch "c:\Program Files (x86)\Autodesk\backburner\cmdjob.exe" "-jobname "01 Script Submit BLAHBLAH Bake" -jobNameAdjust -priority:49 -logPath:"c:\" -manager BLAHBLAH -port:BLAH "c:\Program Files\Autodesk\3ds MAX 2009\3dsmax.exe" -u MAXScript "C:\Documents and Settings\BLAH\Desktop\BLAH\script work\_Rendering\BLAHBLAH.ms" "c:\1.max""
I won’t go into the variables etc. but fortunately for me I print it to the listener each time I run it so I could give you the ‘final’ version with all the switches. Every switch works but there doesn’t seem to be any documentation on why this difference between cmdjob and normal submittal exists.
There is of course hacky work-arounds like deleting all jobs and having a separate backburner manager with a separate controlling script or something. But if anyone knows what causes this issue, or if I find the solution … please let me know.
Too bad this does NOT list all jobs as the help states…
(
manager = NetRender.GetManager()
manager.connect #manual "manager"
manager.queryControl #wait
manager.SetUpdates false --the queue is now frozen
jobs = manager.GetJobs()
for i = 1 to jobs.count do print (jobs[i].name)
manager.SetUpdates true
)
For anyone still struggling with this, I figured out an effective work-around. 3dsmaxcmd.exe allows you to submit render-jobs to backburner with the correct switches and this can be done through MAX Script as well. These jobs are then visible through Backburner getjobs in max script.
Unfortunately, the UI of MAX is not loaded while Backburner processes a simple render, so many max script functions do not work, but you can execute external commands on the server in the meantime.
This leaves you with a few options:
Either stall the render to replicate a task and load the task in the background, causing say 2 full versions of 3Ds MAX to be loaded.
Or
Load another task and allow the render to continue, finish (you can keep the render simple so that it closes max fast) … the weakness here is that Backburner now thinks the server is idle and can send another task.
With this method though, you can have a server specific control of some sort that is queried with max script, so that when you send another task to this server, it doesn’t execute the external code, just adds to say an internal queue.
Or
Determine another method to query Backburner about it’s tasks. Backburner only tells 3Ds max about MAX tasks through getjobs, and anything submitted via cmdjob is not considered a max task even if the exe is 3dsmax. There may be another way to query for jobs, say through an attached VB script.
This way you could send a non-max script task to the remote computer to control the tasks without even loading max when not neccessary. In my case, I needed max first, photoshop second and then max again & winrar so I didn’t use this option, instead I used the above option.
Or
With the MS loaded pre-render in backburner, you could disconnect the server, load the next instance of max, then reconnect the server. I haven’t investigated thoroughly if this is possible but it’s a pretty hacky work-around since it doesn’t tell you if the job is in progress, just that the server is offline.
Or
Build a basic, functional version of Backburner for your own purposes
3dsmaxcmd.exe allows you to submit render-jobs to backburner with the correct switches and this can be done through MAX Script as well. These jobs are then visible through Backburner getjobs in max script.
This sounds perfect for my use as all I need at this point is to delete a ‘Command Line Tool’ job. Which switch do I set? is it -writeJobFile?
--===========================
--Program Paths
ThreedsMAXcmd = @"c:\Program Files\Autodesk\3ds MAX 2009\3dsmaxcmd.exe"
MAXFile = SavedBakeScene + "\" "
MSCommand = "-prerenderscript:\"" + InitializerScript + "\" "
SavedBakeScene refers to the scene that I will load with Backburner
InitializerScript refers to the script I run before the render
RenderOuputPath = @"C:\1.tga"
RenderOuputX = "512"
RenderOuputY = "512"
RenderOuputFrom = "1"
RenderOuputTo = "1"
General variable settings, fairly self explanatory
RenderCMD = stringStream ""
format "-outputname:% -width:% -height:% -start:% -end:% -submit:\"%\" -port:% -jobname:% -priority:%" RenderOuputPath RenderOuputX RenderOuputY RenderOuputFrom RenderOuputTo EdtBBip.text (spnBBport.value as string) BBJobName (spnBBPri.value as string) to:RenderCMD
RenderCMD = RenderCMD as string
Building renderCMD into something work-able to send to BackBurner via 3dsmaxcmd.exe
shellLaunch ("\"" + ThreedsMAXcmd + "\"") ("\"" + MAXFile + MSCommand + RenderCMD)
print ("Executing via shellcommand; " + ("\"" + ThreedsMAXcmd + "\"") + "
" + ("\"" + MAXFile + MSCommand + RenderCMD))
What I’m really doing
This is where I send the command to BB via 3dsmaxcmd
Didn’t feel like whittling it down too much so I figure this will be about enough, by filling in the 2 variables at the start you should be able to send your task on your own and see the outputted full command with proper syntax. I’ll be around so if you have any questions, please ask.
Thanks for the snippets. I will have to take a look tomorrow from work.
Edit: I just noticed that you are referring to 3dsmaxcmd.exe, not cmdjob.exe. Thus it shows up normally in the queue… nice!
I use the command line via hiddenDOSCommand to start VRaySpawner.exe on each of our render nodes. Actually, I parse a .cfg file that lists which servers the user wants to use and then write a command string to start a false job on BB so that those nodes will not be used for regular BB render work. It names the job according to the user.
""C:\Program Files (x86)\Autodesk\Backburner\cmdjob.exe" -jobName jonah.hawk-VrayDR -jobNameAdjust -manager managerNameHere -priority 50 -numTasks 1 -taskName 1 -timeout 6000 -servers server1 server2 server3; -leaveInQueue -workpath "C:\Program Files\Autodesk\3ds Max design 2010" vrayspawner2010.exe"
VRaySpawner does not notify BB nor shut down when it is done contributing to DR (distributed rendering). What I need to do is to kill that job with a #postRender callback. But Command Line Tool jobs don't show up in the list.
Another approach I was taking was to use psTools to stop the BB service on each machine, start VRaySpawner.exe then have the #postRender callback reverse the process. But this runs the risk of a user firing up DR in the middle of another user's render. So I was going to get the active jobs, cross check the server list from each job against the nodes that the user wants to use for DR.
I’ll post more tomorrow when I get to work.
Yeah, 3dsmaxcmd.exe gives you the ability to control the queue from a script. The problem is it requires an instance of max to be open while the task is listed as in progress in BB.
In the end, I decided that if I was going to create a more advanced system, I would write a completely original program to manage these tasks because BB simply is lacking, although cmdjob.exe is effective in that if you create a script in say vbs and run that, you can spawn all your tasks, and the script can wait while they’re completed, this way you shouldn’t need manual max script queue control.
Here is our Vray DR/BB script. I’ve only taken out our manager name.
It checks the vray_dr.cfg file to see which servers have been selected by the user. We use Windows 7 and Max Design. You’ll need to edit some of the manual paths to match your OS/Max version.
(
local userName = sysinfo.username
local drConfig = openfile ("C:/Users/" + userName + "/AppData/Local/Autodesk/3dsMaxDesign/2010 - 64bit/enu/plugcfg/vray_dr.cfg")
local allServers = #()
local serversChecked = #()
while (not (eof drConfig)) do
(
theLine = (readLine drConfig)
(
append allServers theLine
)
)
close drConfig
--the last two lines are variables, not servers, and are removed from the array
deleteItem allServers (allServers.count - 1) --delete the second to last item
deleteItem allServers (allServers.count) -- delete the last item
format "All Servers:
"
print allServers
print "
"
-- now parse the array for servers that are selected; a 1, not a 0 after their name
for i = 1 to allServers.count do
(
theLine = allServers[i]
if ((FilterString theLine " ")[2] == "1")
do
(
append serversChecked (FilterString theLine " ")[1]
)
)
Format "Servers Checked:
"
print serversChecked
-- generate the string of servers separated by semicolons
serverString = ""
for i = 1 to serversChecked.count do
(
serverString += serversChecked[i] as String
serverString += ";"
)
theString = "\"C:\Program Files (x86)\Autodesk\Backburner\cmdjob.exe\" -jobName " + userName + "-VrayDR -jobNameAdjust -manager managerName -priority 50 -numTasks 10 -taskName 1 -timeout 6000 -servers " + serverString + " -leaveInQueue -workpath \"C:\Program Files\Autodesk\3ds Max design 2010\" vrayspawner2010.exe"
--Fire it off quietly and print the command to the listener
HiddenDosCommand theString startpath:"c:\\"
print theString
)
I think I’m going to go back to using psTools
[ol]
[li]use the netmanager interface to get a list of active jobs/servers[/li][li]remove only the available servers from BB[/li][li]start VRaySpawner[/li][li]register a #postRender callback that will:[list=1][/li][li]kill VRaySpawner[/li][li]Start Backburner Service again[/li][/ol]
[/list]@ senor freebie: I’m curious, what are you doing with Photoshop and WinRAR in backburner?