[Durian-svn] [2692] Master UI tweaks to specify svn revision and quality.

brecht institute at blender.org
Fri Apr 30 14:02:41 CEST 2010


Revision: 2692
          https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=2692
Author:   brecht
Date:     2010-04-30 14:02:41 +0200 (Fri, 30 Apr 2010)
Log Message:
-----------
Master UI tweaks to specify svn revision and quality.

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

Modified: frm/master_ui.py
===================================================================
--- frm/master_ui.py	2010-04-30 11:58:48 UTC (rev 2691)
+++ frm/master_ui.py	2010-04-30 12:02:41 UTC (rev 2692)
@@ -17,40 +17,42 @@
 JOBS_FILE = os.path.join(FARM_DIR, "jobs.pkl")
 SLAVES_FILE = os.path.join(FARM_DIR, "slaves.pkl")
 REPO_PATH = "/media/data/svnroot/durian"
+HTTPD_IP = "127.0.0.1" # 192.168.1.14"
+HTTPD_PORT = 8000
 
 def latest_svn_info():
     command = "svnlook youngest " + REPO_PATH
     p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
-    rev = p.communicate()[0].strip()
+    rev = p.communicate()[0].decode("utf-8").strip()
 
     if len(rev):
         logs = ""
-        for i in range(max(int(rev)-5, 0), int(rev)+1):
+        for i in reversed(range(max(int(rev)-2, 0), int(rev)+1)):
             command = "svnlook log -r%d %s" % (i, REPO_PATH)
             p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
-            log = p.communicate()[0].strip()
+            log = p.communicate()[0].decode("utf-8").strip()
 
-            logs += log + "<br/>\n"
+            logs += "revision %d: %s<br/>\n" % (i, log)
 
         return logs, rev
     else:
         # in case we fail to read
-        return "", "HEAD"
+        return "Could not look up svn information.", "HEAD"
 
 ############################ Jobs ########################
 
 class Job:
     priority_types = ('Low', 'Medium', 'High', 'Critical')
-    quality_types = ('Final 2K', 'Final 4K')
+    quality_types = ('Final 2K',)
     status_types = ('Disabled', 'In Progress', 'Done')
 
-    def __init__(self, id, revision):
+    def __init__(self, id, revision, quality):
         self.id = id
         self.status = "Disabled"
         self.progress = "0% (0/0)"
         self.priority = "Medium"
         self.revision = revision
-        self.quality = "Final 2K"
+        self.quality = quality
         self.enabled = False
 
     @staticmethod
@@ -110,14 +112,14 @@
 #    Job.find(id).progress = "0/0"
 #    Job.dump()
 
-def job_add(id, revision):
+def job_add(id, revision, quality):
     # 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:
-        if job.id == id:
+        if job.id == id: # only one job per file supported
             return
 
-    JOBS.append(Job(id, revision))
+    JOBS.append(Job(id, revision, quality))
     Job.dump()
 
 def job_remove(id):
@@ -202,7 +204,7 @@
         # add a job
         elif self.path == '/job_add':
             d = urllib.parse.parse_qs(command)
-            job_add(d['id'][0], d['revision'][0])
+            job_add(d['id'][0], d['revision'][0], d['quality'][0])
     
         self.send_response(http.client.SEE_OTHER)
         self.send_header("Location", "/")
@@ -296,20 +298,18 @@
 
             # jobs
             section("Jobs")
-            table_begin("File", "Revision", "Status", "Progress", "Priority", "Enabled", "")
+            table_begin("File", "Revision", "Quality", "Status", "Progress", "Priority", "Enabled", "")
 
             for job in JOBS:
                 output("<tr>\n")
                 output("<td>" + job.id + "</td>\n")
                 output("<td>" + job.revision + "</td>\n")
+                output("<td>" + job.quality + "</td>\n")
                 output("<td>" + job.status + "</td>\n")
                 output("<td>" + job.progress + "</td>\n")
                 output("<td>")
                 dropdown('job_set_priority', job.id, job.priority, Job.priority_types)
                 output("</td>\n")
-                #output("<td>")
-                #dropdown('job_set_quality', job.id, job.quality, Job.quality_types)
-                #output("</td>\n")
                 output("<td>")
                 checkbox('job_set_enabled', job.id, job.enabled)
                 output("</td>\n")
@@ -328,12 +328,24 @@
             output("<form method='post' action='/job_add'>\n")
             output("<input name='id' value='/d/pro/scenes/05.8_ambushfight/05.8a_comp.blend' size='50'/>\n")
             output("<input name='revision' value='%s' size='10'/>\n" % (revision,))
+            output("<select name='quality'>\n")
+            for option in Job.quality_types:
+                if option == 'Final 2K': state = "selected"
+                else: state = ""
+                output("\t<option %s value='%s'>%s</option>\n" % (state, option, option))
+            output("</select>\n")
+
             output("<input type='submit' value='Add Job'/>\n")
             output("</form>\n")
 
+            output("<br/>\n")
+
+            section("Recent Commits")
+
             output(logs)
 
             output("<br/>\n")
+            output("<br/>\n")
 
             # progress
             section("Progress")
@@ -383,7 +395,7 @@
 Slave.load()
 Job.load()
 
-HTTPD = http.server.HTTPServer(("127.0.0.1", 8000), HHandler)
+HTTPD = http.server.HTTPServer((HTTPD_IP, HTTPD_PORT), HHandler)
 
 def update(timeout):
     HTTPD.timeout = timeout



More information about the Durian-svn mailing list