[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3484] trunk/py/scripts/tools/bi_farm: add step option to the renderfarm

Campbell Barton ideasman42 at gmail.com
Tue Jun 12 16:42:29 CEST 2012


Revision: 3484
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3484
Author:   campbellbarton
Date:     2012-06-12 14:42:25 +0000 (Tue, 12 Jun 2012)
Log Message:
-----------
add step option to the renderfarm

Modified Paths:
--------------
    trunk/py/scripts/tools/bi_farm/master_ui.py
    trunk/py/scripts/tools/bi_farm/new_blend_2_frames.py
    trunk/py/scripts/tools/bi_farm/new_master.py

Modified: trunk/py/scripts/tools/bi_farm/master_ui.py
===================================================================
--- trunk/py/scripts/tools/bi_farm/master_ui.py	2012-06-12 09:37:48 UTC (rev 3483)
+++ trunk/py/scripts/tools/bi_farm/master_ui.py	2012-06-12 14:42:25 UTC (rev 3484)
@@ -78,10 +78,11 @@
 
 class Job:
     priority_types = ('Low', 'Medium', 'High', 'Critical', 'Final')
+    step_types = ('1', '2', '3', '5', '10')
     quality_types = ('File settings', 'Final 4K', 'Final 2K', 'Final 1K', 'Final 0.5k', 'Final HD', 'Preview 1K', 'NoShading 1K', 'Simplified 1K')
     status_types = ('Disabled', 'In Progress', 'Done!')
 
-    def __init__(self, id, revision, quality):
+    def __init__(self, id, revision, quality, step):
         self.id = id
         self.status = "Disabled"
         self.progress = "0% (0/0)"
@@ -90,6 +91,7 @@
         self.quality = quality
         self.enabled = False
         self.stats = ""
+        self.step = step
 
     @staticmethod
     def find(id):
@@ -147,7 +149,13 @@
     Job.dump()
 
 
-def job_add(id, revision, quality):
+def job_set_step(id, step):
+    # changes in priority are detected in master loop
+    Job.find(id).step = step
+    Job.dump()
+
+
+def job_add(id, revision, quality, step):
     # master loop will find the new job when refreshes it's jobs list in
     # the outer loop, so actually starting to render may take a while
     for job in JOBS:
@@ -173,7 +181,7 @@
         print(command)
         os.system(command)
 
-    job = Job(id, revision, quality)
+    job = Job(id, revision, quality, step)
     JOBS.append(job)
     # JOBS.sort(key=lambda job: job.revision)
     Job.dump()
@@ -302,7 +310,7 @@
                 rev = d['revision'][0]
             else:
                 rev = 'HEAD'
-            job_add(d['id'][0], rev, d['quality'][0])
+            job_add(d['id'][0], rev, d['quality'][0], int(d['step'][0]))
 
         self.send_response(http.client.SEE_OTHER)
         self.send_header("Location", "/")
@@ -426,7 +434,7 @@
 
             # jobs
             section("Jobs")
-            table_begin("", "File", "Revision", "Quality", "Status", "Progress", "Stats", "Priority", "")
+            table_begin("", "File", "Revision", "Quality", "Status", "Progress", "Stats", "Priority", "Step", "")
 
             for job in JOBS:
                 output("<tr>\n")
@@ -449,6 +457,12 @@
                 output("<td>")
                 dropdown('job_set_priority', job.id, job.priority, Job.priority_types)
                 output("</td>\n")
+
+                # output("<td>")
+                # dropdown('job_set_step', job.id, job.step, Job.step_types)
+                # output("%d" % job.step)
+                output("<td>" + job.step + "</td>\n")
+
                 output("<td id='td-toggle'>")
                 action('job_remove(\\"%s\\")' % job.id, "X", "Are you sure you want to remove this job?")
                 output("</td>\n")
@@ -473,6 +487,15 @@
                 output("\t<option %s value='%s'>%s</option>\n" % (state, option, option))
             output("</select>\n")
 
+            output("<select name='quality'>\n")
+            for option in Job.step_types:
+                if option == "1":
+                    state = "selected"
+                else:
+                    state = ""
+                output("\t<option %s value='%s'>%s</option>\n" % (state, option, option))
+            output("</select>\n")
+
             output("<input type='submit' class='job-add' value='Add Job'/>\n")
             output("</form>\n")
 

Modified: trunk/py/scripts/tools/bi_farm/new_blend_2_frames.py
===================================================================
--- trunk/py/scripts/tools/bi_farm/new_blend_2_frames.py	2012-06-12 09:37:48 UTC (rev 3483)
+++ trunk/py/scripts/tools/bi_farm/new_blend_2_frames.py	2012-06-12 14:42:25 UTC (rev 3484)
@@ -27,20 +27,21 @@
 # frames/%s/%s_######" % (fname, fname)
 
 
-def blend_2_frames_start_end(path, start, end):
+def blend_2_frames_start_end(path, start, end, step=1):
     images = []
     fname = os.path.splitext(os.path.basename(path))[0]
+    assert(step != 0)
 
     format_string = os.path.join(REND_DIR, fname, fname + "_%.6d.exr")
     frame = start
     while frame <= end:
         images.append((frame, format_string % frame))
-        frame += 1
+        frame += step
 
     return images
 
 
-def blend_2_frames(path):
+def blend_2_frames(path, step=1):
     try:
         values = blend_render_info.read_blend_rend_chunk(path)
     except IOError:
@@ -49,7 +50,7 @@
     images = []
 
     for start, end, scene in values:
-        images += blend_2_frames_start_end(path, start, end)
+        images += blend_2_frames_start_end(path, start, end, step=step)
 
     return images
 

Modified: trunk/py/scripts/tools/bi_farm/new_master.py
===================================================================
--- trunk/py/scripts/tools/bi_farm/new_master.py	2012-06-12 09:37:48 UTC (rev 3483)
+++ trunk/py/scripts/tools/bi_farm/new_master.py	2012-06-12 14:42:25 UTC (rev 3484)
@@ -131,7 +131,7 @@
                 format_string = os.path.join(REND_DIR, fname_overview, fname + "_%.6d.exr")
                 images.append((frame + 1, format_string % frames[0]))
     elif os.path.exists(blendfile_abs):
-        images = new_blend_2_frames.blend_2_frames(blendfile_abs)
+        images = new_blend_2_frames.blend_2_frames(blendfile_abs, step=job.step)
     else:
         images = []
 



More information about the Bf-extensions-cvs mailing list