AWS Thinkbox Discussion Forums

Maya submission through Python failing

Hi, so I’ve written a simple code that does some things in a Maya scene. I want to complete my code by submitting a render from Maya to Deadline for Quality control, but hard code it in the code.

Every time I submit my job I get the “Error: Required job info key “Plugin” not found (Deadline.Submission.DeadlineSubmissionException)” error.

Now, I am lost here because I cannot find what the problem is. I’ve looke here but all I can find is that the Plugin key is required, and everything else is optional. The code I’m using as far as I can tell, definitely has that key specified.

Any help will be very much appreciated.


import os
import sys
import subprocess
import maya.cmds as cmds


def maya_deadline_job():
    """
    this function will collect scene file information and write a job file
    :return:
    """
    renderer_name = 'File'
    version = cmds.about(version=True)
    project_path = cmds.workspace(q=True, directory=True)
    width = cmds.getAttr("defaultResolution.width")
    height = cmds.getAttr("defaultResolution.height")
    output_file_path = cmds.workspace(expandName="images")
    output_file_prefix = cmds.getAttr("defaultRenderGlobals.imageFilePrefix")
    scene_file = cmds.file(q=True, location=True)
    info_txt = 'Animation=1\n' \
               'Renderer={}\n' \
               'UsingRenderLayers=0\n' \
               'RenderLayer=\n' \
               'RenderHalfFrames=0\n' \
               'LocalRendering=0\n' \
               'StrictErrorChecking=1\n' \
               'MaxProcessors=0\n' \
               'AntiAliasing=low\n' \
               'Version={}\n' \
               'Build=64bit\n' \
               'ProjectPath={}\n' \
               'ImageWidth={}\n' \
               'ImageHeight={}\n' \
               'OutputFilePath={}\n' \
               'OutputFilePrefix={}\n' \
               'Camera=\n' \
               'Camera0=\n' \
               'SceneFile={}\n' \
               'IgnoreError211=0'.format(renderer_name,
                                         version,
                                         project_path,
                                         width,
                                         height,
                                         output_file_path,
                                         output_file_prefix,
                                         scene_file)

    maya_deadline_job_file = r'{}\maya_deadline_job.job'.format(os.getenv('TEMP'))
    with open(maya_deadline_job_file, 'w') as job_file:
        job_file.write(info_txt)
    return maya_deadline_job_file


def maya_deadline_info():
    """
    this function will collect maya deadline information and write a job file
    :return:
    """
    info_txt = 'Plugin=MayaBatch\n' \
               'Name=MY_FILE_NAME\n' \
               'Comment=Render Launch by Python\n' \
               'Pool=none\n' \
               'MachineLimit=0\n' \
               'Priority=50\n' \
               'OnJobComplete=Nothing\n' \
               'TaskTimeoutMinutes=0\n' \
               'MinRenderTimeMinutes=0\n' \
               'ConcurrentTasks=1\n' \
               'Department=\n' \
               'Group=none\n' \
               'LimitGroups=\n' \
               'JobDependencies=\n' \
               'InitialStatus=Suspended\n' \
               'OutputFilename0=Test_file\n' \
               'Frames=1-10\n' \
               'ChunkSize=1'

    maya_deadline_info_file = r'{}\maya_deadline_info.job'.format(os.getenv('TEMP'))
    with open(maya_deadline_info_file, 'w') as job_file:
        job_file.write(info_txt)
    return maya_deadline_info_file


def submit_to_deadline():
    """
    this function will send current scene to deadline for rendering
    :return:
    """
    deadline_cmd = r"C:\Program Files\Thinkbox\Deadline10\bin\deadlinecommand.exe"
    job_file = maya_deadline_job()
    info_file = maya_deadline_info()
    command = '{deadline_cmd} "{job_file}" "{info_file}"'.format(**vars())
    process = subprocess.Popen(command, stdout=subprocess.PIPE)
    lines_iterator = iter(process.stdout.readline, b"")
    #  Lets print the output log to see the Error / Success 
    for line in lines_iterator:
        print(line)
        sys.stdout.flush()

submit_to_deadline()

Thanks

Hey,
My programming skills are naïve but I looked at your script seems like plugin is supposed to be the part of the function “maya_deadline_job()” which makes the job Info file. If you see an already submitted MayaJob or any job in Monitor> Modify Job Properties in the right menu option> Submission Params - You will find “Plugin” in the Job Infor Parameters. So I think it should be the part of Job Info file.

Privacy | Site terms | Cookie preferences