If your site has special needs for pathnames to work across workstations and render farms, then you'll probably want to configure pathname translation on your network.
For instance, you may find users submit files with a path like:
Z:\somefile /Volumes/somefileand have those both be automatically converted to:
//myserver/prod/somefile..then you can add the following two lines to the rush/etc/path_convert file (shown in red):
The rush/etc/path_convert File |
# Example rush/etc/path_convert file. # For documentation on this file's format, see: # http://seriss.com/rush.103.00/rush-files.html#path_convert # [..snip..] #### ADD YOUR SETTINGS BELOW THIS LINE ### os=all path_convert "z:" "//myserver/prod" os=all path_convert "/Volumes/prod" "//myserver/prod" |
Use 'rush -push path_convert +any' to push that change to the network.
This will then affect both the Perl and Python Rush submit scripts, plus any scripts that use the new 'rush -pathconvert' command to access pathname conversions.
Or, if you prefer to make such changes directly to the submit scripts using regular expressions, you can use the older technique that involves modifying the Perl FixPath() function in the Perl .common.pl script, and/or the Python FixPath() function in the Python RushSiteSettings.py script.
Some sites using Windows need to have certain drive mappings in place in order for renders to work properly, as the renders may contain drive mapped pathnames hard coded into their scene files in such a way that it would be technically nontrivial to change them all.
In such cases, you can configure Rush to force drive mappings to be checked just before rendering, and not enabled, force them to be mapped.
For instance, let's say your network needs the following drive mappings:
X: -> \\myserver\prod1 Y: -> \\myserver\prod2 Z: -> \\myserver\prod3..then you can add the following three lines to the rush/etc/path_convert file (shown in red):
The rush/etc/path_convert File |
# Example rush/etc/path_convert file. # For documentation on this file's format, see: # http://seriss.com/rush.103.00/rush-files.html#path_convert # [..snip..] #### ADD YOUR SETTINGS BELOW THIS LINE ### os=windows drive_map "x:" "//myserver/prod1" os=windows drive_map "y:" "//myserver/prod2" os=windows drive_map "z:" "//myserver/prod3" |
Use 'rush -push path_convert +any' to push that change to the network.
Note the use of front slashes for the UNC pathname; if you want to use backslashes, you'll have to double them up, as front slashes are escape characters in this context. So e.g. "\\\\myserver\\prod1")
These settings will affect both the Perl and Python Rush submit scripts: the settings are applied by the Perl PreRenderInit() function in .common.pl, and the Python PreRenderInit() function in RushSiteSettings.py. You can view drive mappings configured this way by running 'rush -drivemaps'.
It is advised that you use the path_convert file to do pathname conversions when possible, as changing it affects both Perl and Python, as well as giving other scripts the ability to access configured path translations with the rush -pathconvert command.
However, if you really need procedural control or regular expressions to manipulate path conversion, then you can modify the FixPath() function in the Perl .common.pl script.
So for instance, if users might be supplying paths like:
Z:\somefile /Volumes/somefileand you want those to be automatically converted to:
//myserver/prod/somefile..then you can add the following two lines (shown in red) to the FixPath() function in the Perl .common.pl file:
Perl .common.pl FixPath() Function |
# FIX COMMON PATH PROBLEMS # $1 - path to fix # Returns 'fixed' path. # Handles: # Backslashes -> Front slashes under windows # Convert to lowercase # Mapped drive letters -> UNC # sub FixPath($) { my ($path) = @_; # APPLY ANY CONVERSIONS THAT MIGHT BE IN rush/etc/path_convert if ( -e "$ENV{RUSH_DIR}/etc/path_convert" ) { my $newpath = `rush -pathconvert $path`; # use 'rush -pathconvert |
Note that this change will only affect the Rush perl submit scripts.
To affect the Python submit scripts, you'll need to make similar changes to the FixPath() function in the RushSiteSettings.py script.
It is advised that you use the path_convert file to do pathname conversions when possible, as changing it affects both Perl and Python, as well as giving other scripts the ability to access configured path translations with the rush -pathconvert command.
However, if you really need procedural control or regular expressions to manipulate path conversion, then you can modify the FixPath() function in the Python RushSiteSettings.py file.
So for instance, if users might be supplying paths like:
Z:\somefile /Volumes/somefileand you want those to be automatically converted to:
//myserver/prod/somefile..then you can add the following two lines (shown in red) to the FixPath() function in the Python RushSiteSettings.py file:
Python RushSiteSettings.py FixPath() Function |
def FixPath(path): '''Fix pathnames users specify by tranforming them into pathnames that work across all platforms at your site. path [IN] -- the path to be repaired. Returns: transformed path ''' # Convert \'s -> /'s for maximum 'cross platform' compatibility path = Rush.FrontSlashes(path) # \path\file -> /path/file # Remove automount stuff path = re.sub("^/tmp_mnt(.*)", "\\1", path) path = re.sub("^/exports(.*)", "\\1", path) path = re.sub("^/private/automount(.*)", "\\1", path) # Mac OSX/JAGUAR path = re.sub("^/private/var/automount(.*)", "\\1", path) # Mac OSX/PANTHER # UNCOMMENT FOR DRIVE MAP CONVERSIONS # path = re.sub("^[xX]:", "//server/share1", path) # x: -> //server/share1 # UNCOMMENT FOR UNC STYLE PATHNAMES # path = re.sub("^(/[A-z0-9])", "/\\1", path) # /server/foo -> //server/foo ### ADD YOUR OWN SETTINGS HERE path = re.sub("^z:", "//myserver/prod", path) # z:/foo -> //myserver/prod/foo path = re.sub("^/Volumes/prod", "//myserver/prod", path) # /Volumes/prod/foo -> //myserver/prod/foo return(path) |