Versions Compared

    Key

    • This line was added.
    • This line was removed.
    • Formatting was changed.
    Comment: Published by Scroll Versions from this space and version 8.0-0

    Like the menu and panel plugin types, the submission plugins are written in Python 3. Each submission plugin is executed directly by the plugin system so, so for example, you can use Python to automate the building of parameters, pre-fill default values, or adapt to changes the user makes.

    At last count Qube! UI ships with 33 submission plugins that you can find in the plugins/submission directory under the application directory (or under QubeUI\bin on Windows). Looking through the submission dialogs for each type in the UI and then reading the corresponding section of it's plugin file is a good way to quickly find how to do what you need in a particular situation.

    Table of Contents

    Submission plugin terminology

    Field

    See parameter.

    Page

    Submission plugin pages are used to group related parameters. Only a single page is shown by the submission dialog at one time.

    Image Removed

    Parameter

    A submission plugin is built up of multiple parameters and is the main mechanism for getting input from the user. Some examples of submission parameters could be an output directory path, an image file type, or a verbosity flag. The terms parameter and field are synonymous and are used interchangeably in this documentation.

    Image Removed

    Creating a new submission type plugin

    The best place to start when creating a new submission plugin is to copy an existing one that's closest to what you intend to make. For the purposes of this documentation we'll start from scratch and create a new plugin for making proxy images using imagemagick.

    The process is as follows:

    1. Add the submission type.
    2. Add a new page for the input path field.
    3. Add parameters.
    4. Override defaults for fields in the Qube Basics page.
    5. Set the command template.

    1. Add the submission type

    ...

    Code Block
    languagepy
    # Create a new submission type
    add_submission_type('Make proxy',
                        short_name='Make Proxy',
                        type="makeProxy",
                        has_range=False,
                        can_batch=False,
                        thread_control='all',
                        prototype="cmdline")

    Check the documentation for add_submission_type() for information on the command's arguments.

    ,
                        group="Pipeline")
    ArgumentTypeDefaultComment
    typestring The type identifier for this submission plugin. The type identifier is used, among other reasons, to determine a job's submission type which allows the UI to open the correct submission dialog upon job resubmission.
    prototypestringcmdlineThe Qube! submission prototype.
    short_namestring An alternative, shorter name for the submission plugin type, used when UI space is tight.
    has_rangebooleanFalseWhether the plugin should display range related fields in the Qube Basics page.
    thread_controlstring An empty string or "false" hides the Threads per instance and Instances use all cores fields from the Qube Basics page. Any other value that is not "all" will hide the Instances use all cores field only.
    can_pad_framesbooleanFalseA value of True will include a Frame Padding field in the Qube Basics page.
    can_batchbooleanFalseAllows generation of partitions or chunks in the submitted job.
    pre_show_validatePython functionon_pre_show_validateThis Python function is called before pre_dialog and should return a boolean that determines whether the submission dialog should be shown.
    pre_dialogPython functionon_pre_dialogThis Python function is called immediately before the submission dialog is shown.
    post_dialogPython functionon_post_dialogThis Python function is called after the job is created and the submission dialog is closed but before submission.
    post_submitPython functionon_post_submitThis Python function is called after the job is submitted.
    installPython functioninstallThis Python function is called when selecting the corresponding menu item in the File->Install App UI menu.

    2. Add a new page for the input path field

    Use pages to group related fields together. We add pages by calling add_page() with a single argument, the page's name.

    ...

    After you add a page it becomes current, every field that follows is added to that page until you add a new one. We'll add a Source Path parameter field using add_field().

    Code Block
    languagepy
    add_field("Source Path",
              type="path",
              required=True,
              destination="package.sourcePath")

    ...

    Let's keep going and make a new Output page and parameter for the output path.

    Code Block
    languagepy
    add_page("Output")
    
    add_field("Destination Path",
              type="path",
              required=True,
              destination="package.destinationPath")
    
    
    
    

    First we make a new page for our output parameters. The Destination Path parameter is nearly identical to our Source Path parameter so we 'll skip the explanation explaining it and move on.

    Code Block
    languagepy
    add_field("ProxyScale",
              default=50,
              min=1,
              max=100,
              required=True,
              destination="package.proxyScale")

    ...

    The command template works in the same way, where the parameter names act as the keys to the dictionary. In our example command template we make a new directory and then run magick to resize the images.

    Submission Plugin Functions

    add_submission_type

    Create a new submission plugin. Each plugin should have exactly one call to add_submission_type()

    ArgumentTypeDefaultComment
    typestring The type identifier for this submission plugin. The type identifier is used, among other reasons, to determine a job's submission type which allows the UI to open the correct submission dialog upon job resubmission.
    prototypestringcmdlineThe Qube! submission prototype.
    short_namestring An alternative, shorter name for the submission plugin type, used when UI space is tight.
    has_rangebooleanFalseWhether the plugin should display frame range related fields in the Qube Basics page.
    thread_controlstring An empty string or "false" hides the Threads per instance and Instances use all cores fields from the Qube Basics page. Any other value that is not "all" will hide the Instances use all cores field only.
    can_pad_framesbooleanFalseA value of True will include a Frame Padding field in the Qube Basics page.
    can_batchbooleanFalseAllows generation of partitions or chunks in the submitted job.
    pre_show_validatePython functionon_pre_show_validateThis Python function is called before pre_dialog and should return a boolean that determines whether the submission dialog should be shown.
    pre_dialogPython functionon_pre_dialogThis Python function is called immediately before the submission dialog is shown.
    post_dialogPython functionon_post_dialogThis Python function is called after the job is created and the submission dialog is closed but before submission.
    post_submitPython functionon_post_submitThis Python function is called after the job is submitted.
    installPython functioninstallThis Python function is called when selecting the corresponding menu item in the File->Install App UI menu.

    add_page

    Add a new page to the submission dialog and make it current. New fields are added to the current page.

    ArgumentPython TypeDefaultComment
    namestr 

    The name of the page.

    add_field

    Add a parameter to the current page.

    Supported Parameter types

    Common arguments

    ArgumentPython TypeDefaultComment
    namestr 

    The name of the parameter is used both as the label next to the parameter in the submission dialog and to refer to it elsewhere in the plugin. The name argument is required.

    typestrstringThe type of parameter, can be one of (bool, int, float, string, text, path, filename, list, combo, combo_file, combo_path, table, datetime, selectorString).
    requiredboolFalseWhether the parameter must be set with a valid value before submission.
    destinationstr Where to store the value in the job, for example package.mayaExecutable.
    argstr The command line argument associated with the parameter.
    defaultParameter type specific A pre-filled value.
    enabledboolTrueWhether the value is editable or grayed out.
    quoteboolFalseWhether the value of the parameter should be surrounded by double quotes.
    set_on_resubmitboolTrueWhen resubmitting a job the parameter's value is set to that of the value of the job being resubmitted.
    separatorstr,When a parameter has several values such as list selections this string is used as the separator.
    arg_value_separatorstr[a single space]The string used to separate the parameter's arg with its value. For example if the command line argument needs to be in the form myArg=myValue the arg_value_separator should be =.
    suppress_path_conversionN/AN/AIf this argument is set then the value (if it's a path or filename parameter) will not be surrounded by QB_CONVERT_PATH().
    on_changePython function taking 0 arguments The given function is called whenever the value of this parameter or any parameters in it's watch_list change.
    watch_listlist of str A list of references to other parameters in this plugin. The page name and parameter names are separated by two colons, for example ["Qube Basics::Threads per instance", "Qube Basics::Instances use all cores"].

    string

    A simple single line text field.

    ArgumentPython TypeDefaultComment
    editableboolTrue 

    Whether the user can change the value of the parameter.

    text

    A multi line text field.

    bool

    A checkbox.

    ArgumentPython TypeDefaultComment
     bool_map_truestr True  The string value used for the parameter's value when the checkbox is checked. For example you can set this to things like on, 1, yes, etc.
    bool_map_falsestrFalseThe string value used for the parameter's value when the checkbox is unchecked. For example you can set this to things like off, 0, no, etc.

    int

    A integer spinbox.

    ArgumentPython TypeDefaultComment
     minint -2147483648 The minimum value for the spinbox. 
    maxint2147483647The maximum value for the spinbox.

    float

    A floating point spinbox.

    ArgumentPython TypeDefaultComment
    minfloat-1.79769e+308The minimum value for the spinbox.
    maxfloat1.79769e+308The maximum value for the spinbox.

    combo

    A drop down menu, allows for a single selection from a list of items.

    ArgumentPython TypeDefaultComment
    itemslist of str The list of available choices in the combo.
    editableboolFalseIf True, the user can type in a custom value. If False, the user can only choose from the given items.

    path

    A single line text field with a browse button that opens a file dialog to select a directory path.

    ArgumentPython TypeDefaultComment
    use_native_separatorsboolFalseIf True, the path will use platform specific directory separators, ie / on Linux and macOS, \ on Windows.

    combo_path

    The same as the path parameter type but also allows for selection of paths from a combo.

    ArgumentPython TypeDefaultComment
    use_native_separatorsboolFalseIf True, the path will use platform specific directory separators, ie / on Linux and macOS, \ on Windows. If False / is used on all platforms.
    itemslist of str A list of paths to show in the combo.

    filename

    A single line text field with a browse button that opens a file dialog to select a file path.

    ArgumentPython TypeDefaultComment
    use_native_separatorsboolFalseIf True, the path will use platform specific directory separators, ie / on Linux and macOS, \ on Windows. If False / is used on all platforms.

    combo_file

    The same as the filename parameter type but also allows for selection of file paths from a combo.

    ArgumentPython TypeDefaultComment
    use_native_separatorsboolFalseIf True, the path will use platform specific directory separators, ie / on Linux and macOS, \ on Windows. If False / is used on all platforms.
    itemslist of str A list of paths to show in the combo.

    list

    A list box where the user can select either a single or multiple values.

    ArgumentPython TypeDefaultComment
    itemslist of str The items to display in the list.
    multi_selectboolTrueWhether the user can select multiple items in the list, or just one.

    table

    A table of values of given dimensions that the user can enter values.

    ArgumentPython TypeDefaultComment
    dimension(int, int)(0, 2)The initial number of rows and columns in the table.

    datetime

    A date and time selection parameter.

    selectorString

    A selectorString parameter uses a Python function to generate a list of strings, take this example from the Worker Selection page (found in python/99_qube_parameters.py in the standard plugin path on your system).

    ...

    ArgumentPython TypeDefaultComment
    opttypestr If the opttype is radio the selectorString will use radio buttons instead of checkboxes, meaning that only a single value can be selected.
    selectorPython function taking 0 arguments and returning a list of str A Python function that returns the list of items to use in the selector.

    set_field

    Set the value of an existing field.

    ArgumentPython TypeDefaultComment
    pagestr The page where the field is located.
    namestr The name of the field to set.
    valueField type specific The value to set the field to.

    set_command_template

    Set the command template for Qube! jobs submitted with this submission type.

    ArgumentPython TypeDefaultComment
    templatestr The command template to use for jobs submitted using this submission type.