[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25602] trunk/blender/release/scripts: netrender tab to spaces
Campbell Barton
ideasman42 at gmail.com
Tue Dec 29 01:04:57 CET 2009
Revision: 25602
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25602
Author: campbellbarton
Date: 2009-12-29 01:04:57 +0100 (Tue, 29 Dec 2009)
Log Message:
-----------
netrender tab to spaces
Modified Paths:
--------------
trunk/blender/release/scripts/io/netrender/__init__.py
trunk/blender/release/scripts/io/netrender/balancing.py
trunk/blender/release/scripts/io/netrender/client.py
trunk/blender/release/scripts/io/netrender/master.py
trunk/blender/release/scripts/io/netrender/master_html.py
trunk/blender/release/scripts/io/netrender/model.py
trunk/blender/release/scripts/io/netrender/operators.py
trunk/blender/release/scripts/io/netrender/slave.py
trunk/blender/release/scripts/io/netrender/ui.py
trunk/blender/release/scripts/io/netrender/utils.py
trunk/blender/release/scripts/presets/render/HDTV_1080p.py
trunk/blender/release/scripts/presets/render/HDTV_720p.py
trunk/blender/release/scripts/presets/render/TV_PAL.py
trunk/blender/release/scripts/presets/render/TV_PAL_16_colon_9.py
trunk/blender/release/scripts/ui/space_userpref.py
trunk/blender/release/scripts/ui/space_view3d_toolbar.py
Modified: trunk/blender/release/scripts/io/netrender/__init__.py
===================================================================
--- trunk/blender/release/scripts/io/netrender/__init__.py 2009-12-28 23:40:20 UTC (rev 25601)
+++ trunk/blender/release/scripts/io/netrender/__init__.py 2009-12-29 00:04:57 UTC (rev 25602)
@@ -4,12 +4,12 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Modified: trunk/blender/release/scripts/io/netrender/balancing.py
===================================================================
--- trunk/blender/release/scripts/io/netrender/balancing.py 2009-12-28 23:40:20 UTC (rev 25601)
+++ trunk/blender/release/scripts/io/netrender/balancing.py 2009-12-29 00:04:57 UTC (rev 25602)
@@ -4,12 +4,12 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -22,129 +22,129 @@
import netrender.model
class RatingRule:
- def rate(self, job):
- return 0
+ def rate(self, job):
+ return 0
class ExclusionRule:
- def test(self, job):
- return False
+ def test(self, job):
+ return False
class PriorityRule:
- def test(self, job):
- return False
+ def test(self, job):
+ return False
class Balancer:
- def __init__(self):
- self.rules = []
- self.priorities = []
- self.exceptions = []
-
- def addRule(self, rule):
- self.rules.append(rule)
-
- def addPriority(self, priority):
- self.priorities.append(priority)
-
- def addException(self, exception):
- self.exceptions.append(exception)
-
- def applyRules(self, job):
- return sum((rule.rate(job) for rule in self.rules))
-
- def applyPriorities(self, job):
- for priority in self.priorities:
- if priority.test(job):
- return True # priorities are first
-
- return False
-
- def applyExceptions(self, job):
- for exception in self.exceptions:
- if exception.test(job):
- return True # exceptions are last
-
- return False
-
- def sortKey(self, job):
- return (1 if self.applyExceptions(job) else 0, # exceptions after
- 0 if self.applyPriorities(job) else 1, # priorities first
- self.applyRules(job))
-
- def balance(self, jobs):
- if jobs:
- # use inline copy to make sure the list is still accessible while sorting
- jobs[:] = sorted(jobs, key=self.sortKey)
- return jobs[0]
- else:
- return None
-
+ def __init__(self):
+ self.rules = []
+ self.priorities = []
+ self.exceptions = []
+
+ def addRule(self, rule):
+ self.rules.append(rule)
+
+ def addPriority(self, priority):
+ self.priorities.append(priority)
+
+ def addException(self, exception):
+ self.exceptions.append(exception)
+
+ def applyRules(self, job):
+ return sum((rule.rate(job) for rule in self.rules))
+
+ def applyPriorities(self, job):
+ for priority in self.priorities:
+ if priority.test(job):
+ return True # priorities are first
+
+ return False
+
+ def applyExceptions(self, job):
+ for exception in self.exceptions:
+ if exception.test(job):
+ return True # exceptions are last
+
+ return False
+
+ def sortKey(self, job):
+ return (1 if self.applyExceptions(job) else 0, # exceptions after
+ 0 if self.applyPriorities(job) else 1, # priorities first
+ self.applyRules(job))
+
+ def balance(self, jobs):
+ if jobs:
+ # use inline copy to make sure the list is still accessible while sorting
+ jobs[:] = sorted(jobs, key=self.sortKey)
+ return jobs[0]
+ else:
+ return None
+
# ==========================
class RatingUsage(RatingRule):
- def __str__(self):
- return "Usage rating"
-
- def rate(self, job):
- # less usage is better
- return job.usage / job.priority
+ def __str__(self):
+ return "Usage rating"
+ def rate(self, job):
+ # less usage is better
+ return job.usage / job.priority
+
class RatingUsageByCategory(RatingRule):
- def __str__(self):
- return "Usage per category rating"
-
- def __init__(self, get_jobs):
- self.getJobs = get_jobs
- def rate(self, job):
- total_category_usage = sum([j.usage for j in self.getJobs() if j.category == job.category])
- maximum_priority = max([j.priority for j in self.getJobs() if j.category == job.category])
-
- # less usage is better
- return total_category_usage / maximum_priority
-
+ def __str__(self):
+ return "Usage per category rating"
+
+ def __init__(self, get_jobs):
+ self.getJobs = get_jobs
+ def rate(self, job):
+ total_category_usage = sum([j.usage for j in self.getJobs() if j.category == job.category])
+ maximum_priority = max([j.priority for j in self.getJobs() if j.category == job.category])
+
+ # less usage is better
+ return total_category_usage / maximum_priority
+
class NewJobPriority(PriorityRule):
- def str_limit(self):
- return "less than %i frame%s done" % (self.limit, "s" if self.limit > 1 else "")
+ def str_limit(self):
+ return "less than %i frame%s done" % (self.limit, "s" if self.limit > 1 else "")
- def __str__(self):
- return "Priority to new jobs"
-
- def __init__(self, limit = 1):
- self.limit = limit
-
- def test(self, job):
- return job.countFrames(status = DONE) < self.limit
+ def __str__(self):
+ return "Priority to new jobs"
+ def __init__(self, limit = 1):
+ self.limit = limit
+
+ def test(self, job):
+ return job.countFrames(status = DONE) < self.limit
+
class MinimumTimeBetweenDispatchPriority(PriorityRule):
- def str_limit(self):
- return "more than %i minute%s since last" % (self.limit, "s" if self.limit > 1 else "")
+ def str_limit(self):
+ return "more than %i minute%s since last" % (self.limit, "s" if self.limit > 1 else "")
- def __str__(self):
- return "Priority to jobs that haven't been dispatched recently"
-
- def __init__(self, limit = 10):
- self.limit = limit
-
- def test(self, job):
- return job.countFrames(status = DISPATCHED) == 0 and (time.time() - job.last_dispatched) / 60 > self.limit
+ def __str__(self):
+ return "Priority to jobs that haven't been dispatched recently"
+ def __init__(self, limit = 10):
+ self.limit = limit
+
+ def test(self, job):
+ return job.countFrames(status = DISPATCHED) == 0 and (time.time() - job.last_dispatched) / 60 > self.limit
+
class ExcludeQueuedEmptyJob(ExclusionRule):
- def __str__(self):
- return "Exclude queued and empty jobs"
-
- def test(self, job):
- return job.status != JOB_QUEUED or job.countFrames(status = QUEUED) == 0
-
+ def __str__(self):
+ return "Exclude queued and empty jobs"
+
+ def test(self, job):
+ return job.status != JOB_QUEUED or job.countFrames(status = QUEUED) == 0
+
class ExcludeSlavesLimit(ExclusionRule):
- def str_limit(self):
- return "more than %.0f%% of all slaves" % (self.limit * 100)
+ def str_limit(self):
+ return "more than %.0f%% of all slaves" % (self.limit * 100)
- def __str__(self):
- return "Exclude jobs that would use too many slaves"
-
- def __init__(self, count_jobs, count_slaves, limit = 0.75):
- self.count_jobs = count_jobs
- self.count_slaves = count_slaves
- self.limit = limit
-
- def test(self, job):
- return not ( self.count_jobs() == 1 or self.count_slaves() <= 1 or float(job.countSlaves() + 1) / self.count_slaves() <= self.limit )
+ def __str__(self):
+ return "Exclude jobs that would use too many slaves"
+
+ def __init__(self, count_jobs, count_slaves, limit = 0.75):
+ self.count_jobs = count_jobs
+ self.count_slaves = count_slaves
+ self.limit = limit
+
+ def test(self, job):
+ return not ( self.count_jobs() == 1 or self.count_slaves() <= 1 or float(job.countSlaves() + 1) / self.count_slaves() <= self.limit )
Modified: trunk/blender/release/scripts/io/netrender/client.py
===================================================================
--- trunk/blender/release/scripts/io/netrender/client.py 2009-12-28 23:40:20 UTC (rev 25601)
+++ trunk/blender/release/scripts/io/netrender/client.py 2009-12-29 00:04:57 UTC (rev 25602)
@@ -4,12 +4,12 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -28,253 +28,253 @@
from netrender.utils import *
def addFluidFiles(job, path):
- if os.path.exists(path):
- pattern = re.compile("fluidsurface_(final|preview)_([0-9]+)\.(bobj|bvel)\.gz")
+ if os.path.exists(path):
+ pattern = re.compile("fluidsurface_(final|preview)_([0-9]+)\.(bobj|bvel)\.gz")
- for fluid_file in sorted(os.listdir(path)):
- match = pattern.match(fluid_file)
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list