def set_environment_variable(cls, var, value): """sets environment var :param str var: The name of the var :param value: The value of the variable """ os.environ[var] = value try: hou.allowEnvironmentVariableToOverwriteVariable(var, True) except AttributeError: # should be Houdini 12 hou.allowEnvironmentToOverwriteVariable(var, True) hscript_command = "set -g %s = '%s'" % (var, value) hou.hscript(str(hscript_command))
def set_environment_variables(self, version): """sets the environment variables according to the given Version instance """ if not version: return # set the $JOB variable to the parent of version.full_path logger.debug('version: %s' % version) logger.debug('version.path: %s' % version.path) logger.debug('version.filename: %s' % version.filename) logger.debug('version.full_path: %s' % version.full_path) logger.debug( 'version.full_path (calculated): %s' % os.path.join( version.path, version.filename ).replace("\\", "/") ) job = os.path.dirname(str(version.full_path)) hip = job hipName = os.path.basename(hip) logger.debug('job : %s' % job) logger.debug('hip : %s' % hip) logger.debug('hipName : %s' % hipName) try: hou.allowEnvironmentVariableToOverwriteVariable("JOB", True) hou.allowEnvironmentVariableToOverwriteVariable("HIP", True) hou.allowEnvironmentVariableToOverwriteVariable("HIPNAME", True) except AttributeError: # should be Houdini 12 hou.allowEnvironmentToOverwriteVariable('JOB', True) hou.allowEnvironmentToOverwriteVariable('HIP', True) hou.allowEnvironmentToOverwriteVariable('HIPNAME', True) # update the environment variables #os.environ.update({"JOB": job}) os.environ["JOB"] = job os.environ["HIP"] = hip os.environ["HIPNAME"] = hipName # also set it using hscript, hou is a little bit problematic hou.hscript("set -g JOB = '%s'" % job) hou.hscript("set -g HIP = '%s'" % hip) hou.hscript("set -g HIPNAME = '%s'" % hipName)
def set_environment_variables(self, version): """sets the environment variables according to the given Version instance """ if not version: return # set the $JOB variable to the parent of version.full_path logger.debug('version: %s' % version) logger.debug('version.path: %s' % version.path) logger.debug('version.filename: %s' % version.filename) logger.debug('version.full_path: %s' % version.full_path) logger.debug( 'version.full_path (calculated): %s' % os.path.join(version.path, version.filename).replace("\\", "/")) job = os.path.dirname(str(version.full_path)) hip = job hipName = os.path.basename(hip) logger.debug('job : %s' % job) logger.debug('hip : %s' % hip) logger.debug('hipName : %s' % hipName) try: hou.allowEnvironmentVariableToOverwriteVariable("JOB", True) hou.allowEnvironmentVariableToOverwriteVariable("HIP", True) hou.allowEnvironmentVariableToOverwriteVariable("HIPNAME", True) except AttributeError: # should be Houdini 12 hou.allowEnvironmentToOverwriteVariable('JOB', True) hou.allowEnvironmentToOverwriteVariable('HIP', True) hou.allowEnvironmentToOverwriteVariable('HIPNAME', True) # update the environment variables #os.environ.update({"JOB": job}) os.environ["JOB"] = job os.environ["HIP"] = hip os.environ["HIPNAME"] = hipName # also set it using hscript, hou is a little bit problematic hou.hscript("set -g JOB = '%s'" % job) hou.hscript("set -g HIP = '%s'" % hip) hou.hscript("set -g HIPNAME = '%s'" % hipName)
tracker_port = int(os.getenv('TRACKER_PORT', options.ds_port)) sim_slice = options.ds_slice print('Setting distributed simulation parameters:') print('Tracker: %s:%d' % (tracker_address, tracker_port)) print('Simulation slice = %d' % sim_slice) ds_node.parm('visaddress').set(tracker_address) ds_node.parm('port').set(tracker_port) # ds_node.parm('slice' ).set( sim_slice ) default value is $SLICE and can't be set with this # Setting $SLICE environment variable sli_var = "SLICE" try: hou.allowEnvironmentVariableToOverwriteVariable(sli_var, True) except AttributeError: # should be Houdini 12 hou.allowEnvironmentToOverwriteVariable(sli_var, True) hscript_command = "set -g %s = '%s'" % (sli_var, sim_slice) hou.hscript(str(hscript_command)) print('ACTIVITY: %s:%d/%d' % (tracker_address, tracker_port, sim_slice)) # Set take, if specified: if take is not None and len(take) > 0: hou.hscript('takeset ' + take) # If end wasn't specified, render single frame if end is None:
tracker_port = int( os.getenv('TRACKER_PORT', options.ds_port )) sim_slice = options.ds_slice print('Setting distributed simulation parameters:') print('Tracker: %s:%d' % ( tracker_address, tracker_port)) print('Simulation slice = %d' % sim_slice) ds_node.parm('visaddress').set( tracker_address) ds_node.parm('port' ).set( tracker_port ) # ds_node.parm('slice' ).set( sim_slice ) default value is $SLICE and can't be set with this # Setting $SLICE environment variable sli_var = "SLICE" try: hou.allowEnvironmentVariableToOverwriteVariable(sli_var, True) except AttributeError: # should be Houdini 12 hou.allowEnvironmentToOverwriteVariable(sli_var, True) hscript_command = "set -g %s = '%s'" % (sli_var, sim_slice) hou.hscript(str(hscript_command)) print('ACTIVITY: %s:%d/%d' % (tracker_address, tracker_port, sim_slice)) # Set take, if specified: if take is not None and len(take) > 0: hou.hscript('takeset ' + take) # If end wasn't specified, render single frame