Here is a more Max-centric view using what SMTD does most of the time:
When you press the Submit button in the SMTD GUI, it calls the function SMTDFunctions.SubmitJobFromUI() - you can find its source in the Repository under Submission\3dsmax\Max\SubmitMaxToDeadline_Functions.ms and see the actual steps it performs, and there is a lot going on there. But here are the basics:
*A new folder is created under your user’s temp folder - e.g. C:\Users\YOURNAMEHERE\AppData\Local\Thinkbox\Deadline6\temp\13_11_2013_1_09_14_PM
This is where the submission files will be copied. We do this so you can have two or more copies of Max submitting at the same time from the same machine without overwritting each-other’s files.
*If Object or Scene XRefs were found and the merging of XRefs was requested via the options, a temp. copy of the scene will also be made to be able to restore post-submission. Then the merging is performed.
*A test for missing maps is performed and if there are any and warning is enabled, a prompt is issued.
*If external files (bitmaps etc.) should be submitted with the job, they are collected. The scene will be modified by removing the paths, so that the scene would search in the MAX file’s folder for the resources instead.
*A few other optional changes might be made at this point, like clearing the content of the Material Editor slots, setting VRay or Brazil to high priority threading etc.
*Render elements are updated to point at the correct output location on the network etc.
*The actual MAX scene for submission is then saved to the temp folder. There are a lot of options what could happen with the scene, but the default is saving the current state to disk so the actual content of Max can go to Deadline. Among the options is the ability to save only visible renderable objects (other than what Mike Owen suggested in another thread, this does not affect lights or cameras, or helpers the geometry depends on - they will all be saved). This is useful when the scene is huge, but a large part of the renderable geometry is hidden. It speeds things up as the submitted scene is made a lot smaller.
Note that in some cases, the MAX scene might have its own temp. folder and the rest of the control files could be in a different temp. folder saved seconds later…
*There is an option to replace all materials with gray or some other temp. material.
*If Batch rendering or Tile Rendering was requested, the corresponding functions are called to submit differently, but in the general case the regular submission follows.
*In the latest versions of SMTD, a text file is created with the command line parameters to send to the actual command line Deadline Submitter (deadlinecommandbg.exe). Each line of this text file is assumed to be a separate argument of the command line. Since we are running the quiet deadlinecommandbg.exe and not deadlinecommand.exe, the output during submission does not go to a Console (aka DOS) Window, but to text files. Two such files are specified as arguments - the one gets only the result output (0 or non-zero value), the other gets the full submission message describing success or failure and the reasons for a failure. These files end up in the temp. folder we discussed before and you can read it to see what is inside. Here is an example
-outputfiles
C:\Users\Borislav\AppData\Local\Thinkbox\Deadline6\temp\13_11_2013_1_09_14_PM\submitOutput.txt
C:\Users\Borislav\AppData\Local\Thinkbox\Deadline6\temp\13_11_2013_1_09_14_PM\submitExitCode.txt
C:\Users\Borislav\AppData\Local\Thinkbox\Deadline6\temp\13_11_2013_1_09_14_PM\max_submit_info.job
C:\Users\Borislav\AppData\Local\Thinkbox\Deadline6\temp\13_11_2013_1_09_14_PM\max_job_info.job
C:\Users\Borislav\AppData\Local\Thinkbox\Deadline6\temp\13_11_2013_1_08_59_PM\DL61_TileRendering_v003.max
The first line tells the commandlinebg.exe to output the messages to the file listed in the second line, and the exit code to the third.
*Then we have the max_submit_info.job and max_job_info.job text files. The former contains the information needed to create a new job (plugin to use and its parameters). The latter contains properties of the job that are exposed as Job Properties in the monitor AND ARE MODIFIABLE, including custom key=value pairs you can query in your own scripts, MAXScript jobs etc. The content of these two files will be ingested into the database. In Deadline 5.2 and earlier, they were sent to the Repository’s Job folder instead.
*The last line of the command line parameters above is the MAX file to render (notice it was written 15 seconds earlier to a different folder since I was testing Tile Rendering which makes separate folders for each region in my current version). It will be copied to the Repository by the commandlinebg.exe submitter.
*In fact, the submission might be split into two passes - there is an option to submit a preview job and a rest of frames job, so in some cases two such submissions are performed for a single scene. But the principles are the same.
*If the job requires scripts (pre/post/etc.) or if the job is a MAXScript job, the Script files are added to the command line file as Auxiliary files. They will be copied to the Job’s folder on the repository, so you can modify the sources without affecting what the job will run. Auxiliary files are always copied to the Slave’s temp folder before rendering, so each slave has its own set of local files to run.
*If external files were requested to be sent with the job, their names will also be added to the command line arguments as Auxiliary files. They will also be copied to the repository and will be then transferred to each Slave’s local temp folder during rendering.
*Once the command line and job info files are written to disk, the commandlinebg.exe is called with the argument file and then MAXScript starts waiting for the two output files listed in the second and third line to appear. During this time, you will see a yellow progress bar crawling in the SMTD UI.
*Once the result is out, it is parsed to see if the result was success or failure. The progress bar in the UI turns green or red, and the message is printed to the log.
*Regardless, any changes made to the scene before submission are reverted back - Material Editor materials, overridden scene materials, bitmap paths etc.
At this point, if the submission was successful, the job will be in the Repository and the Slaves can start working on it.
When a Slave picks a Job, the following basic things happen:
*All job auxiliary files are copied to the Slave’s temp folder. By default, if a Slave has already copied them from a previous task of the same Job and they are still around, it WILL NOT copy them again, unless you check an option in the Job Properties to force the copying. This is to speed things up with large MAX and external files. Also, if you modified the MAX file, the script auxiliary files or anything else in the Job folder in the Repository, you must check this option to make sure the modifications are seen by all Slaves.
*If the job is a 3dsmax plugin job, the 3dsmax.py script located in the Repository\Plugins\3dsmax is run and processes the available data provided by the job info files.
*Max is launched in a special way so it can initialize the required plugins and also load our own connection plugin (Lightning.DLX).
*The MAX scene sent with the job is loaded.
*Once it is loaded, the Post-Load / Pre-Render script is run and can modify the scene. This is similar to Pre-Render script callbacks in Max.
*A customize.ms file (also located in the \Plugins\3dsmax\ folder of the Repo) is run. It reads Max-specific, Renderer-specific etc. settings from the Job Info File and forces the scene to use them. For example GI settings of VRay, Camera to use, Output File Name etc. We use this script to expose custom parameters that are editable from the 3dsmax group of controls in Job Properties. There are some more files involved in exposing new properties there, but that is a different story.
*Once the rendering is finished, the output files are copied from the local temp folder of the Slave machine to the final destination.
*The Task is marked as complete, and the Slave looks again for a job. If the same job turns out to be still the highest priority, Max is not closed and the scene is left as is (unless Restart 3ds Max is requested via options), so the next Task starts again very quickly. There is also an option to restart the Renderer itself which takes no time at all and makes a new instance of VRay, Scanline, Krakatoa or whatever and loads all its settings. This is useful to release some memory in some cases and even fix some glitches in Render Elements with VRay etc.
In Deadline 6, all data related to the actual job is written to the database, so there are no other external files worth mentioning…