[Durian-svn] [3863] update render farm script to include durian svn revision in metadata

campbell institute at blender.org
Wed May 26 08:13:16 CEST 2010


Revision: 3863
          https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=3863
Author:   campbell
Date:     2010-05-26 08:13:16 +0200 (Wed, 26 May 2010)
Log Message:
-----------
update render farm script to include durian svn revision in metadata

Modified Paths:
--------------
    frm/new_blender_setup.py

Modified: frm/new_blender_setup.py
===================================================================
--- frm/new_blender_setup.py	2010-05-26 03:00:59 UTC (rev 3862)
+++ frm/new_blender_setup.py	2010-05-26 06:13:16 UTC (rev 3863)
@@ -14,6 +14,7 @@
 quality = sys.argv[-2] + " " + sys.argv[-1]
 print(quality)
 
+
 def get_ip():
 
     import socket
@@ -28,7 +29,7 @@
             struct.pack('256s', ifname[:15])
         )[20:24])
 
-    for iface in "eth0", "eth1", "eth2", "eth3":
+    for iface in "eth0", "eth1", "eth2", "eth3", "eth0_rename":
         try:
             ip = get_ip_address(iface)
             break
@@ -37,108 +38,136 @@
         
     return ip
 
-ip = get_ip()
-fpath = bpy.data.filename
-fname = os.path.splitext(os.path.basename(fpath))[0]
-scene_current = bpy.context.scene
-tmpdir = "/tmp/durian_farm"
 
-print("loaded:", fpath, scene_current)
+def get_revision():
+    '''returns the revision of this blendfile'''
+    import subprocess
+    lines = subprocess.Popen(["svn", "info", bpy.data.filename], stdout=subprocess.PIPE).communicate()[0].splitlines()
+    rev = b""
+    for l in lines:
+        if l.startswith(b'Revision: '):
+            rev = l.split()[-1]
 
-# not working
-bpy.context.user_preferences.filepaths.temporary_directory = tmpdir
-os.system("rm -rf %s" % tmpdir)
-os.system("mkdir %s" % tmpdir)
+    if rev:
+        return int(rev)
+    else:
+        return -1
 
-bpy.context.user_preferences.system.image_tile_memory_limit = 256
 
-for scene in bpy.data.scenes:
-    rd = scene.render
+def main():
 
-    # file output
-    rd.file_format = 'OPEN_EXR'
-    rd.exr_half = True
-    rd.exr_preview = True
-    rd.output_path = "/shared/software/durian_farm/frames/%s/%s_######" % (fname, fname)
-    rd.use_file_extension = True
-    rd.use_placeholder = False
-    rd.use_overwrite = False
+    ip = get_ip()
+    fpath = bpy.data.filename
+    fname = os.path.splitext(os.path.basename(fpath))[0]
+    scene_current = bpy.context.scene
+    tmpdir = "/tmp/durian_farm"
 
-    # stamp
-    rd.render_stamp = False
-    rd.stamp_note = True
-    rd.stamp_render_time = True
-    rd.stamp_note_text = "rev:%s, %s" % (bpy.app.build_revision, ip)
-    rd.stamp_font_size = 18
-    rd.stamp_foreground = 1.0, 1.0, 1.0, 1.0
-    rd.stamp_background = 0.0, 0.0, 0.0, 0.75
+    print("loaded:", fpath, scene_current)
 
-    # performance/memory
-    rd.free_image_textures = True
-    rd.save_buffers = True
-    rd.full_sample = True
-    rd.threads_mode = 'AUTO'
-    rd.use_local_coords = False
-    if rd.parts_x < 32: rd.parts_x = 32
-    if rd.parts_y < 16: rd.parts_y = 16
+    # not working
+    bpy.context.user_preferences.filepaths.temporary_directory = tmpdir
+    os.system("rm -rf %s" % tmpdir)
+    os.system("mkdir %s" % tmpdir)
 
-    # resolution
-    rd.resolution_percentage = 100
-    rd.resolution_x = 2048
-    rd.resolution_y = 872
-    rd.use_border = False
-    rd.color_mode = 'RGB'
+    bpy.context.user_preferences.system.image_tile_memory_limit = 256
 
-    # quality
-    if quality == "Preview 1K":
-        rd.resolution_percentage = 50
+    for scene in bpy.data.scenes:
+        rd = scene.render
 
-        rd.use_simplify = True
-        rd.simplify_subdivision = 0
-        rd.simplify_child_particles = 1.0
-        rd.simplify_triangulate = True
-        rd.simplify_shadow_samples = 1
-        rd.simplify_ao_sss = 0.2
-        if scene.world:
-            scene.world.lighting.use_cache = False
-            scene.world.lighting.samples = 1
-    elif quality == "NoShading 1K":
-        rd.resolution_percentage = 50
+        # file output
+        rd.file_format = 'OPEN_EXR'
+        rd.exr_half = True
+        rd.exr_preview = True
+        rd.output_path = "/shared/software/durian_farm/frames/%s/%s_######" % (fname, fname)
+        rd.use_file_extension = True
+        rd.use_placeholder = False
+        rd.use_overwrite = False
 
-        rd.use_textures = False
-        rd.use_raytracing = False
-        rd.use_sss = False
-        rd.use_shadows = False
-    elif quality == "Simplified 1K":
-        rd.resolution_percentage = 50
+        # stamp
+        rd.render_stamp = False
+        rd.stamp_note = True
+        rd.stamp_render_time = True
+        rd.stamp_note_text = "rev:%s, art_rev:%s, %s" % (bpy.app.build_revision, str(get_revision()), ip)
+        rd.stamp_font_size = 18
+        rd.stamp_foreground = 1.0, 1.0, 1.0, 1.0
+        rd.stamp_background = 0.0, 0.0, 0.0, 0.75
 
-        rd.use_textures = True
-        rd.use_raytracing = False
-        rd.use_sss = False
-        rd.use_shadows = False
+        # performance/memory
+        rd.free_image_textures = True
+        rd.save_buffers = True
+        rd.full_sample = True
+        # XXX fixed for now because it gives different results for hair
+        # rd.threads_mode = 'AUTO'
+        rd.threads_mode = 'FIXED'
+        rd.threads = 8
+        rd.use_local_coords = False
+        if rd.parts_x < 32: rd.parts_x = 32
+        if rd.parts_y < 16: rd.parts_y = 16
 
-        rd.use_simplify = True
-        rd.simplify_subdivision = 0
-        rd.simplify_child_particles = 0.1
-        rd.simplify_triangulate = True
-        rd.simplify_mipmap_levels = 5
-    elif quality == "Final 4K":
-        # is this resolution right?
-        rd.resolution_percentage = 200
-    elif quality == "Final 1K":
-        rd.resolution_percentage = 50
-    elif quality == "Final 0.5K":
-        rd.resolution_percentage = 25
+        # resolution
+        rd.resolution_percentage = 100
+        rd.resolution_x = 2048
+        rd.resolution_y = 872
+        rd.use_border = False
+        rd.color_mode = 'RGB'
 
-    scene.frame_start = render_frame
-    scene.frame_end = render_frame
+        # quality
+        if quality == "Preview 1K":
+            rd.resolution_percentage = 50
 
-print("rendering frame %d" % (render_frame))
+            rd.use_simplify = True
+            rd.simplify_subdivision = 0
+            rd.simplify_child_particles = 1.0
+            rd.simplify_triangulate = True
+            rd.simplify_shadow_samples = 1
+            rd.simplify_ao_sss = 0.2
+            if scene.world:
+                scene.world.lighting.use_cache = False
+                scene.world.lighting.samples = 1
+        elif quality == "NoShading 1K":
+            rd.resolution_percentage = 50
 
-# TODO, 02.f.blend has this bug!
-scene_current.set_frame(scene_current.frame_current)
+            rd.use_textures = False
+            rd.use_raytracing = False
+            rd.use_sss = False
+            rd.use_shadows = False
+        elif quality == "Simplified 1K":
+            rd.resolution_percentage = 50
 
-# TODO, some valid file test would be nice.
-if not fpath.startswith("<memory"):
-    bpy.ops.render.render(animation=True)
+            rd.use_textures = True
+            rd.use_raytracing = False
+            rd.use_sss = False
+            rd.use_shadows = False
 
+            rd.use_simplify = True
+            rd.simplify_subdivision = 0
+            rd.simplify_child_particles = 0.1
+            rd.simplify_triangulate = True
+            rd.simplify_mipmap_levels = 5
+        elif quality == "Final 4K":
+            # is this resolution right?
+            rd.resolution_percentage = 200
+        elif quality == "Final 1K":
+            rd.resolution_percentage = 50
+        elif quality == "Final 0.5K":
+            rd.resolution_percentage = 25
+
+        scene.frame_start = render_frame
+        scene.frame_end = render_frame
+
+    print("rendering frame %d" % (render_frame))
+
+    # TODO, 02.f.blend has this bug!
+    # scene_current.set_frame(scene_current.frame_current)
+
+    for sce_iter in bpy.data.scenes:
+        sce_iter.set_frame(scene_current.frame_current)
+
+
+    # TODO, some valid file test would be nice.
+    if not fpath.startswith("<memory"):
+        bpy.ops.render.render(animation=True)
+
+
+if __name__ == "__main__":
+    main()
\ No newline at end of file



More information about the Durian-svn mailing list