You are viewing an old version of this page. View the current version.

    Compare with Current View Page History

    « Previous Version 143 Next »

    Next, we will learn how to populate a job dictionary keeping the UI in mind.  Doing so will allow the job to be resubmitted through the UI.

    In order to understand how to create a job that will properly populate a UI for resubmission, we must first know how the UIs work.  Qube! GUI submission happens through something called SimpleCmds. SimpleCmds are python scripts that are read by the GUI during startup & can be modified or created by users.  SimpleCmd creation is outside of the scope of this document, but you can start reading up on them here: Creating a new SimpleCmd or SimpleCmd Readme or by going to Help > "SimpleCmd Developer Guide" in the GUI.

    In this exercise, we will work slightly backward - getting parameters from a previously submitted job.  These parameters can be found through the GUI by clicking on a previously submitted job then looking in the details pane > Job internals > Internal Data:

    ...or by using the API itself, using the qb.jobinfo(id=job_id) function.

    Set up a test job

    We will start by submitting a job to get started. Attached is a dummy "Maya BatchRender (rib)" 

    Rib_gen.xja

    Download the above and open up in Qube! WranglerView by going to Submit > "Job From File..." menu > browse to the download location and open.  You will get the following submission dialog:

    Scroll through this and note the fields.  As you can see we have filled in a few of the commonly used fields. All the path parameters are for an Linux OS, but that's of no concern to us.  This job will almost certainly fail, but the point of this exercise is the parameters rather than the output of the job.  Feel free to use a different job that will work on your OS.

    [Re]Submit the job.  It will fail.  That's fine. 

    Reverse Engineer to find parameters

    As far as submitting through the Python API is concerned, in order for resubmission to work, we must first know which SimpleCmd to use. Above, we described how to look at the job internals. Choose your preferred method, then look for the "simpleCmdType" parameter in the job's package.  You should see:

    simpleCmdType  : Maya BatchRender (rib)

    This parameter tells Qube! which submission dialog to use.  In this case, we're using one called "Maya BatchRender (rib)".  Take note of this for later.

    Icon
    When a simplecmd is created, it is given a type name in its constructor.  If you're looking at the code for the simpleCmds, this comes from the line that starts with "cmdjob = SimpleCmd(..." and is the first parameter in that constructor.

    Next, we'll need to know each of the parameters in the submission UI that are specific to this particular job and application.  All application-specific parameters are in the job's package.  Again, we can find this info either in job internals (from the GUI) or through the API's qb.jobinfo call.  For this job, the package parameters are as follows:

    Internal Data
    ----------------------------------------

      Job Package

    ----------------------------------------

    -cam           : test

    -proj          : /mnt/storage/

    -renderer      : rib

    -rl            : test

    cmdline        : "/usr/autodesk/maya2012/bin/Render" -s QB_FRAME_START -e QB_FRAME_END -b QB_FRAME_STEP -cam "test" -rl "test" -proj "/mnt/storage/" -renderer "rib"  "/mnt/storage/test.mb"

    mayaExe        : /usr/autodesk/maya2012/bin/Render

    range          : 1-100

    scenefile      : /mnt/storage/test.mb

    simpleCmdType  : Maya BatchRender (rib)

    For the job to run correctly, as with the previous examples, we must only supply the "cmdline" parameter. However, for the submission UI to be properly populated for resubmission, we must also provide the other parameters.

    Parameters to note:

    • -cam, -proj, -renderer, -r1: these are parameters that will be passed directly.  SimpleCmds are fairly clever with options like these & will pass them directly to the command line by way of the command template to create the cmdline that we see above.  This is to say that if one were to change one of the values in the resubmitted submission UI, the cmdline paramter would change to match.
    • mayaExe: much like the parameters above, the simpleCmd will use the mayaExe parameter to generate the cmdline parameter by way of the command template.
    • sceneFile: same as above.  This parameter is necessary for resubmission as it will be used to generate the cmdline paramter.
    • simpleCmdType: As mentioned at the beginning of this section, this will determine which submission UI will be used.

    Create the script

    Using the information we've gleaned thus far, we can now generate our submission script that will properly resubmit through the GUI. 

    Try running this script ... 

    you will see that it pre fills all fields upon resubmission as if you had submitted the job from the GUI.


    Continue to Basic dependencies

     

    • No labels