PipelineFX Forum

Qube! => GUI => Topic started by: Scot Brew on November 04, 2008, 06:28:07 AM

Title: Q&A: How do I setup submission-side path translation in the QubeGUI?
Post by: Scot Brew on November 04, 2008, 06:28:07 AM
Situation
I have artists submitting from machines using one platform to a renderfarm using another and I need to translate the paths.

Question
How can I have the QubeGUI automatically convert entered paths (scenefile name, etc) when it submits the job?

Solution
The QubeGUI 5.4 version uses the standardized SimpleCmd/SimpleSubmit framework for all of the submission dialogs.  These submission dialogs are editable and located in the simplecmds/ directory (see "File->Open SimpleCmds Directory...").  A postDialog callback can be added to convert all path parameters to what the renderfarm machines expect.

Here is an example of modification to the "Nuke (cmdline)" submission interface that will convert the paths from OSX to Windows UNC paths.

Code: [Select]
def create():
    cmdjob = SimpleCmd('Nuke (cmdline)', hasRange=True, canChunk=True, help='Nuke render jobtype', postDialog=postDialog)
    ...

def postDialog(cmd, jobProps):
    # Get a list of properties that use paths
    fileProps = set([k for k,v in cmd.options.iteritems() if v.get('type', '') in ['dir', 'file']])
    # For path properties, substitute the string values
    for k,v in jobProps.setdefault('package', {}).iteritems():
        if k in fileProps:
            jobProps['package'][k] = v.replace('/Volumes/myserver/', '//myserver/')
            logging.info('Adjusted path for property "%s" to "%s"'%(k,jobProps['package'][k]))
Title: Re: Q&A: How do I setup submission-side path translation in the QubeGUI?
Post by: Scot Brew on November 07, 2008, 10:11:18 PM
Note that one can also use symbolic links on the Linux/OSX workers to automatically resolve UNC paths (//server/path) without doing any path translation in the jobs.  See the Knowledge Base article:

http://support.pipelinefx.com/wiki/index.php/Qube_Knowledge_Base#Set_up_Linux_or_OS_X_to_handle_jobs_with_UNC_paths


If you do want to do submission-side path translation for converting from PC to OSX/Linux, one can use a similar method and also switch the slash direction from \ to /. 

Code: [Select]
def postDialog(cmd, jobProps):
    # Get a list of properties that use paths
    fileProps = set([k for k,v in cmd.options.iteritems() if v.get('type', '') in ['dir', 'file']])
    # For path properties, substitute the string values and convert \ to /
    for k,v in jobProps.setdefault('package', {}).iteritems():
        if k in fileProps:
            jobProps['package'][k] = v.replace('\\', '/').replace('//Xraid/xraid_disk/' , '/Volumes/XRAID_DISK/')
            logging.info('Adjusted path for property "%s" to "%s"'%(k,jobProps['package'][k]))
           
           
If modifying the mayabatch jobtype, the postDialog callback is specified here:
Code: [Select]
def create_generalMayaRenderer(rendererShortname, rendererFullname, helpStdout, installFunc=None):
    cmdjob = SimpleCmd('Maya BatchRender (%s)'%rendererShortname, hasRange=True, canChunk=True, help='maya batch render using %s renderer options from Maya 2008'%rendererFullname, postDialog=postDialog)
Title: Re: Q&A: How do I setup submission-side path translation in the QubeGUI?
Post by: Scot Brew on February 03, 2009, 08:29:03 AM
The code in the posts above have been updated to remove boldfacing style that did not show up correctly in the code block and to add a statement to print the path adjustments to the log when they are changed.