Example #1
0
import ntpath, re
from subprocess import Popen, PIPE
from rrt import RinglingException, get_log
LOG = get_log()

def get_share(path):
    """
    Maps windows drive letters to unc paths.
    """
    drive_letter = ntpath.splitdrive(path)[0]
    try:
        # See http://bugs.python.org/issue3905 for why we pipe stdin and close it right away
        p = Popen(['net use', drive_letter], stdin=PIPE, stdout=PIPE, 
                  stderr=PIPE, shell=True)
        p.stdin.close()
        (out, err) = p.communicate()
        if p.returncode != 0:
            LOG.error(err)
            raise RinglingException("Can't find network share for drive %s" % drive_letter)
        unc = out.splitlines()[1].split()[2].strip().lower()
        
        """
        TODO: decide if we want to hold off on these transformations until we're 
        in hpc-spool-script...
        """
        # on the cluster vlan, our file-server hosts have a 1 appended to their names        
        return re.sub("^\\\\\\\\(.+)\\\\(.+)$", '\\\\\\\\\g<1>1\\\\\g<2>', unc, 1).replace('.ringling.edu','',1)
    except Exception, e:
        raise e
Example #2
0
import rrt
from rrt.maya.shortcuts import scene_is_dirty, get_job_type, get_scene_name,\
    get_frame_range

from pymel import versions
from pymel.core.system import workspace, sceneName
from pymel.core.general import Scene
from pymel.core import frameLayout, button, menuItem, columnLayout,\
    optionMenu, intField, textField, text, formLayout, uiTemplate, window,\
    confirmBox, checkBox, radioCollection, radioButton, setParent
from pymel.core.language import scriptJob #@UnresolvedImport
from rrt.localJobSpec import JobSpec
from random import randint

LOG = rrt.get_log('hpcSubmit')

class SubmitGui:
    """ A python singleton """

    # storage for the instance reference
    __instance = None

    def __init__(self):
        """ Create singleton instance """
        # Check whether we already have an instance
        if SubmitGui.__instance is None:
            # Create and remember instance
            SubmitGui.__instance = SubmitGui.__impl()

        # Store instance reference as the only member in the handle
Example #3
0
"""
These functions serve as script entry points.
They identify the job style based on the environment, then pass the request off
to application specific implementations.
"""
import os, sys, shutil, platform, datetime, rrt
from subprocess import call
from pkg_resources import Requirement, resource_filename #@UnresolvedImport

from rrt import RinglingException, get_log
from rrt.hpc import env
LOG = get_log(platform.uname()[1], True)

class MissingDelegateError(RinglingException):pass

class Delegator(object):
    _env = env()
    __delegates__ = {
                     'maya_render_sw': 'rrt.hpc.maya.sw',
                     'maya_render_rman': 'rrt.hpc.maya.rman',
                     'max': 'rrt.hpc.max',
                     'md': 'rrt.hpc.md'
                     }
    _delegate = None

    def __init__(self):
        LOG.info("Starting " + rrt.get_version())
        LOG.debug("Params: %r" % self._env) #LOG.debug("Params: %r" % env())
        jobtype = self._env['RENDERER'] #jobtype = os.getenv('RENDERER', None)
        if jobtype not in self.__delegates__:
            raise MissingDelegateError
Example #4
0
import os
import rrt
LOG = rrt.get_log()
LOG.info("Starting %s" % rrt.get_version())

from rrt.hpc import env
ENV = env()

from maya import cmds

posix = lambda s: s.replace('\\', '/')

proj = posix(ENV['PROJECT'])
node_proj = posix(ENV['NODE_PROJECT'])

map_pairs = [
    (node_proj, proj),
]

for name in os.listdir(ENV['PROJECT']):
    full = os.path.join(ENV['PROJECT'], name)
    if os.path.isdir(full):
        map_pairs.append(('//'+name, posix(full)))
        map_pairs.append((node_proj+'/'+name, posix(full)))
        map_pairs.append((node_proj+'//'+name, posix(full)))

LOG.debug("Dirmaps:")
for m in map_pairs:
    LOG.debug(m)
    cmds.dirmap(mapDirectory=m)
cmds.dirmap(enable=True)