[Closed] Submit to backburner with dependencies
Changed my direction on this and seems to be working now.
http://forums.cgsociety.org/showthread.php?p=5563105#post5563105
Ok I did end up using your code. I just modified it to work with ffmpeg. It is now a 1 button press to an FLV on are render farm. Here is the script.
macroScript FLVrenderer
category:"Mikes"
toolTip:""
(
/* CONNECT TO THE NETWERK MANAGER */
m = netrender.getmanager()
c1 = m.connect #automatic "255.255.255.0"
-- Batch it max (PEN) runs through a folder of files opening them and submitting them via this script
localFileName = maxFilePath + maxFileName
--saves the settings
saveMaxFile localFileName
-- Will be used in the mxs submit and dosCommand dependencies!
jobName = (filterString maxFileName "." )[1] -- < add some extra string here to allow to sent unique jobs
/* WHEN CONNECTION AND FILE SUCCESFULLY COPIED */
if c1 then
(
/* SUBMIT JOB */
-- Easy BB submit
job = m.newjob file:localFileName
job.name = jobName
job.includeMaps = true --turn on "Include Maps"
job.submit() --this uses all servers for the job
/* FILE SETTINGS */
-- Set the parameters that ffmpeg needs
startTime = "%%04d"
fPath = getFilenamePath rendOutputFilename
s1 = toLower fpath
s2 = "[\\\ ta_server\\3d]( http://forums.cgsociety.org/) model library\\"
s3 = " z:\\"
filePath = substituteString s1 s2 s3
fileName = (getFilenameFile rendOutputFilename )
fileNameExt = getFilenameType rendOutputFilename
vInput = filePath + fileName + startTime + fileNameExt
ffmpeg = @"z:\ffmpeg.exe "
vScript1 = @"-f image2 -i " + vInput
vOutput1 = @" -b 700k -vcodec flv -y " + filePath + fileName + ".flv"
scriptJobName1 = jobName + "_FLV"
print ffmpeg + vScript1 + vOutput1
/* OUTPUT1 - UNCOMPRESSED AVI */
-- Build stringStream
jobString1 = stringStream ""
-- Create jobname
format "-jobName:% " scriptJobName1 to:jobString1
-- SET THE DEPENDENCY!
format "-dependencies:% " jobName to:jobString1
-- Add netmask
format "-netmask:255.255.255.0 " to:jobString1
-- Add execution string
format "% " (ffmpeg + vScript1 + vOutput1) to:jobString1
-- max root
maxRoot = pathConfig.GetDir #maxroot
-- Build command string
cmd = "cmdjob.exe " + (jobString1 as string)
-- Execute it
DOSCommand cmd
)
)
Cool thanks for posting! Posting any altered or different scripts doing the same thing here would be great and a good resource! I have noticed my self that there is a difference in submitting the open scene simply with “newJob()” and submitting a saved scene with a job that started like “job = m.newjob file:localFileName”… anybody else experienced that? The later form rendered fields for example while the first doesn’t, just like it drops all render settings when you create a job with “file:…”.
-Johan
I have never used the newjob file:, I have always used 3dsmaxcmd and HiddenDOSCommand to submit jobs from other files.
-Eric
I could use a little help. I am trying to modify this for batch rendering. everything seems to be working but it is not sending the dependant jobs.
/* CONNECT TO THE NETWERK MANAGER */
m = netrender.getmanager()
c1 = m.connect #automatic "255.255.255.0"
--gets the number of jobs
vNum = batchRenderMgr.numViews
--for loop to dynamiclly change bview ot the numbers of veiws
for v = 1 to (vNum) collect (
bview = v
-- gets the index number
bNum = batchRenderMgr.GetView bview
--gets the name of the view
bname = bNum.name
--gets the start frame of veow
sframe = bNum.startFrame
--gets the end frame of veiw
eframe = bNum.endFrame
--output width
bwidth = bNum.width
--output height
bheight = bNum.height
--camera
bcamera = bNum.camera
--scene state
bstate = bNum.sceneStateName
--gets the output path, file name and extension
bout = bNum.outputFilename
-- Batch it max (PEN) runs through a folder of files opening them and submitting them via this script
localFileName = maxFilePath + maxFileName
-- Will be used in the mxs submit and dosCommand dependencies!
jobName = (filterString maxFileName "." )[1] -- < add some extra string here to allow to sent unique jobs
/* WHEN CONNECTION AND FILE SUCCESFULLY COPIED */
if c1 then
(
/* SUBMIT JOB */
-- Easy BB submit
job = m.newjob file:localFileName
job.name = jobName + " " + bname
job.fromFrame = sframe
job.toFrame = eframe
job.outputWidth = bwidth
job.outputHeight = bheight
job.includeMaps = true --turn on "Include Maps"
job.submit() --this uses all servers for the job
/* FILE SETTINGS */
-- Set the parameters that ffmpeg needs
startTime = "%%04d"
fPath = bout
s1 = toLower fpath
s2 = "[\\\ ta_server\\3d]( http://forums.cgsociety.org/) model library\\"
s3 = " z:\\"
filePath = substituteString s1 s2 s3
fileName = bout
fileNameExt = getFilenameType bout
filePathOut = (filterString filePath ".")[1]
vInput = filePath + startTime + fileNameExt
ffmpeg = @"z:\ffmpeg.exe "
vScript1 = @"-f image2 -i " + vInput
vOutput1 = @" -b 700k -vcodec flv -y " + filePathOut + ".flv"
scriptJobName1 = jobName + "_" + bname + "_FLV"
depJob = jobName + "_" + bname
/* OUTPUT1 - UNCOMPRESSED AVI */
-- Build stringStream
jobString1 = stringStream ""
-- Create jobname
format "-jobName:% " scriptJobName1 to:jobString1
print jobString1
-- SET THE DEPENDENCY!
format "-dependencies:% " (jobName + "_" + bname) to:jobString1
-- Add netmask
format "-netmask:255.255.255.0 " to:jobString1
-- Add execution string
format "% " (ffmpeg + vScript1 + vOutput1) to:jobString1
print jobString1
-- max root
maxRoot = pathConfig.GetDir #maxroot
-- Build command string
cmd = "cmdjob.exe " + (jobString1 as string)
-- Execute it
DOSCommand cmd
)
)
Turns out it was the spaces I was adding in the jobString. I changed them to dashes and we have a batch render to FLV. I was unable to pass scene states or render presets to the net work. I could grab them but not pass. Anybody have any ideas on that.
macroScript batchFLVrenderer
category:"Mikes"
toolTip:""
(
/* CONNECT TO THE NETWERK MANAGER */
m = netrender.getmanager()
c1 = m.connect #automatic "255.255.255.0"
--gets the number of jobs
vNum = batchRenderMgr.numViews
--for loop to dynamiclly change bview ot the numbers of veiws
for v = 1 to (vNum) collect (
bview = v
-- gets the index number
bNum = batchRenderMgr.GetView bview
--gets the name of the view
bname = bNum.name
--gets the start frame of veow
sframe = bNum.startFrame
--gets the end frame of veiw
eframe = bNum.endFrame
--output width
bwidth = bNum.width
--output height
bheight = bNum.height
--camera
bcamera = bNum.camera.name
--scene state
bstate = bNum.sceneStateName
--gets the output path, file name and extension
bout = bNum.outputFilename
-- Batch it max (PEN) runs through a folder of files opening them and submitting them via this script
localFileName = maxFilePath + maxFileName
-- Will be used in the mxs submit and dosCommand dependencies!
jobName = (filterString maxFileName "." )[1] -- < add some extra string here to allow to sent unique jobs
/* WHEN CONNECTION AND FILE SUCCESFULLY COPIED */
if c1 then
(
/* SUBMIT JOB */
-- Easy BB submit
job = m.newjob file:localFileName
job.name = jobName + "_" + bname
job.fromFrame = sframe
job.toFrame = eframe
job.outputWidth = bwidth
job.outputHeight = bheight
job.renderCamera = bcamera
job.includeMaps = true --turn on "Include Maps"
job.submit() --this uses all servers for the job
/* FILE SETTINGS */
-- Set the parameters that ffmpeg needs
startTime = "%%04d"
fPath = bout
s1 = toLower fpath
s2 = "[\\\ ta_server\\3d]( http://forums.cgsociety.org/) model library\\"
s3 = " z:\\"
filePath = substituteString s1 s2 s3
fileName = bout
fileNameExt = getFilenameType bout
filePathOut = (filterString filePath ".")[1]
vInput = filePath + startTime + fileNameExt
ffmpeg = @"z:\ffmpeg.exe "
vScript1 = @"-f image2 -i" + vInput
vOutput1 = @" -b 700k -vcodec flv -y " + filePathOut + ".flv"
scriptJobName1 = jobName + "_" + bname + "_FLV"
depJob = jobName + "_" + bname
/* OUTPUT1 - FLV */
-- Build stringStream
jobString1 = stringStream ""
-- Create jobname
format "-jobName:% " scriptJobName1 to:jobString1
-- SET THE DEPENDENCY!
format "-dependencies:% " (jobName + "_" + bname) to:jobString1
-- Add netmask
format "-netmask:255.255.255.0 " to:jobString1
-- Add execution string
format "% " (ffmpeg + vScript1 + vOutput1) to:jobString1
-- max root
maxRoot = pathConfig.GetDir #maxroot
-- Build command string
cmd = "cmdjob.exe " + (jobString1 as string)
-- Execute it
DOSCommand cmd
)
)
)