Deadline VRay Maya submission script

I was wondering if there is a tutorial or snippet of code demonstrating how to submit a rendering deadline job from Maya for VRay? There is one for 3ds max, but i need to do this same thing in maya and navigating their mel script file is quite daunting…

https://www.awsthinkbox.com/tutorial/submitting-maxscript-jobs

1 Like

As usual, you have two options - you can either look at the .mel script and extract only the parts that matter to V-Ray (there is a lot of code for a bunch of other renderers in there you can skip), or look at the Monitor Submitter which is written in Python and while it does not run inside of Maya, it might give you ideas.

The general principles of submitting jobs to Deadline is pretty much the same for all applications, so I am unsure what you are after - just create the two JOB files and call deadlinecommand to submit. Maya jobs generally use the SceneFile= key value to define the location of the scene to be rendered, so you don’t have to pass an auxiliary file with the scene, just write to the .job file where the scene is.

If I were you, I would

  • Submit a Maya+VRay job via either one of the submitters
  • Look at the .job files (or export the Submission Params from the Job Properties dialog)
  • Write a simple Python or MEL script to create equivalent .job files
  • Copy the function from either submitter that resolves the location of deadlinecommand and calls its command line.

That should give you a simple submitter.

There isn’t much that is V-Ray specific in the submission (we don’t export all renderer properties like we do in SMTD)…

That is a huge help to know. Thank you Bobo. I’ll look at the deadline version of the submission stuff today and see what content it contains and report back here if I have any further questions. Thank you

Where can i locate the python scripts used by deadline monitor to submit maya jobs?
I wanted to look at the code for those.

Thanks

All Monitor submitters are stored in \DeadlineRepository10\scripts\Submission\

1 Like

@Bobo is there an easy way to send the submission a copy of the Maya file to use for rendering vs what i’m currently doing, which is giving it the path to the actual maya file, which is causing all kinds of issues as the users continue to edit the file after submission.

I know i do this on the 3ds Max side, but have no idea how to do that with Maya correctly.

Yes, check out the “Submit Maya Scene File” checkbox in the integrated submitter. Just like with 3ds Max, the maya scene file gets included in the deadlinecommand arguments as an auxiliary file, and travels to the Repository’s job folder. From there, the Worker copies it to the local drive before loading it.

The integrated submitter normally also saves a copy of the scene file to the projects folder specified in the submitter even if you don’t include the file. So it is up to you to save a copy of the scene and include the copy in the SceneFile= Plugin Info property. The artists can continue modifying the original, and Deadline gets a copy of it that should be off limits to them. But I can imagine it happens that they end up editing the scene that is being rendered…

Thanks for the quick reply. I can easily copy and create a duplicate of the file manually. My main question is how do i send it as an auxilary file? Currently my submission script looks like this…

# create jobInfo
jobDict = {
    'Name': filename,
    'Comment': comment,
    'Frames': '{}-{}'.format(startFrame, endFrame),
    ...
}

pluginDict = {
    'SceneFile': mayafilepath,
    ...
}

# submit to deadline job
Deadline = Connect.DeadlineCon('WK100', 8082)
job = Deadline.Jobs.SubmitJob(jobDict, pluginDict, idOnly=True)
print('Success >> {}'.format(job))

Any help would be greatly appreciated. This is quite of an urgent issue as our renders are currently going to the wrong locations because of this issue which i didn’t think about until it came up.

SubmitJob()

def Jobs.Jobs.SubmitJob ( self,
info,
plugin,
aux = [],
idOnly = False
)

Submit a new Job.
Input: info: Dictionary of Job information.
plugin: Dictionary of Plugin information for the Job.
aux: Array of any additional auxiliary submission files, defaults to empty.
idOnly: If True, only the Job’s ID is returned, defaults to False. Returns: The new Job.

Awesome thank you Bobo and more importantly thanks for the reference to the docs. Sometimes the docs can be hard to navigate and find what you are looking for.

What I’m not clear on is what would i write as the SceneFile arg in the the pluginDict, if i want it to use the Aux file as the file to use when rendering on the farm?

For example look at the following…

# create local copy of maya scene file
tempFileCopy = createFileCopy(mayafilepath)

# create jobInfo
jobDict = {
    'Name': filename,
    ...
}

# create pluginInfo
pluginDict = {
    'SceneFile': tempFileCopy,
    ...
}

# aux files
auxfiles = [
	tempFileCopy
]


# submit to deadline job
Deadline = Connect.DeadlineCon('PSBUR-PULSE', 8082)
print Deadline.Pulse.GetPulseInfo('PSBUR-PULSE')
job = Deadline.Jobs.SubmitJob(jobDict, pluginDict, auxfiles, idOnly=True)

In this example I make the copy of the Maya file on the user’s local machine. So how does the deadline job on the farm know to use the aux file as the file to use when rendering. Does it copy from the local users machine to the repo?

The trick is this:

If the PluginInfo does NOT contain an entry called SceneFile=, then the Worker automatically goes looking for the FIRST auxiliary file in the submission, and assumes it is the scene file. It is true for every plugin, including Maya, 3dsmax etc.

If the PluginInfo DOES contain a SceneFile= entry pointing at a network location, the auxiliary files will still be sent, but none of them will be assumed to be the scene file to render.

When auxiliary files are specified, and when using the deadlinecommand executable, files located on the local computer performing the submission will be copied automatically over to the Job’s sub-folder in the Jobs folder of the Repository (unless configured otherwise via Tools>Configure Repository Options>Job Settings>Auxiliary Files). Of course, if they are on a network path, they will also be copied. When a Worker dequeues a Job to render, it will copy the content of that folder to the local temp folder and will load from there.

However, when using the REST API, local files on the machine making the call will NOT work because the REMOTE machine you are talking to has to perform the submission. So once again you would have to make a copy of the scene file to a network path that is accessible to all computers on the network, esp. the one running the WebService/Pulse/RCS etc. (I assume it is the same machine hosting the Repository/Database, but it does not have to be). After a successful submission, that temp. network copy could be deleted because it would be now part of the Job in the Job’s aux. files folder.

See this post for a similar situation:

1 Like

Awww ok this is all making sense now. So last question i have at the moment. Is there a built in command that I can call to create a copy of the maya file to the correct location that i can then pass along as the aux file?

Because I’m assuming i can’t just create a copy on the artists local machine in their temp folder and send that to the farm, that would not work.

Are you submitting from inside of Maya, or from an external tool that has no access to Maya?
Why do you have to use the REST API instead of deadlinecommand?

I’m running this code inside of maya itself using python

I’m running the code inside maya for submission using Python. When you refer to the REST API, are you talking about me using the Pulse Server to submit?

I’m not quite sure what you mean by that. But if there is an easier way of doing this im all ears.

Yes, that’s what I meant. You are connecting to a server, and sending a job submission request to it using dictionaries and arrays.

The Maya Integrated Submitter simply calls the deadlinecommand.exe. It is true that the integrated submitter was written in MEL, but the same approach applies to any other submitter written in Python (or MAXScript, or whatever). You create two text files on disk, call the deadlinecommand CLI with them as arguments, and add any auxiliary files to the command line after that. Since the command line can get rather long, you can also build a text file containing each command line argument on a separate line, and then call deadlinecommand yourtextfile.txt to execute it.

This would handle the local auxiliary files properly without the need to move them to the network. Just try rewriting the SubmitMayaToDeadline.mel submission logic in Python, or take a look at any other submitter that is already in Python, e.g. Houdini, Nuke etc.

1 Like

All works like a charm now. thank you

Privacy | Site terms | Cookie preferences