Author Topic: Q&A: How do I setup submission-side path translation in the QubeGUI?  (Read 5323 times)

Scot Brew

  • Hero Member
  • *****
  • Posts: 272
    • PipelineFX
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]))
« Last Edit: February 03, 2009, 08:25:59 AM by Scot Brew »

Scot Brew

  • Hero Member
  • *****
  • Posts: 272
    • PipelineFX
Re: Q&A: How do I setup submission-side path translation in the QubeGUI?
« Reply #1 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)
« Last Edit: February 27, 2009, 01:56:32 AM by Scot Brew »

Scot Brew

  • Hero Member
  • *****
  • Posts: 272
    • PipelineFX
Re: Q&A: How do I setup submission-side path translation in the QubeGUI?
« Reply #2 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.
« Last Edit: February 27, 2009, 01:49:19 AM by Scot Brew »