diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-12-21 22:56:53 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-12-21 22:56:53 +0300 |
commit | 8f3a529585186a8b0a3315d037ac374351c63221 (patch) | |
tree | 40052b6e5c32d29dd03e676168f3184c6ccf59f7 | |
parent | 95db4d16dd6f69a823b6128c8ce0cfaeb633c009 (diff) |
netrender: display dispatching rules under master header. (read only for now)
-rw-r--r-- | release/scripts/io/netrender/balancing.py | 27 | ||||
-rw-r--r-- | release/scripts/io/netrender/master_html.py | 29 | ||||
-rw-r--r-- | release/scripts/io/netrender/netrender.css | 11 |
3 files changed, 64 insertions, 3 deletions
diff --git a/release/scripts/io/netrender/balancing.py b/release/scripts/io/netrender/balancing.py index 410279f6957..d8951b1e2e8 100644 --- a/release/scripts/io/netrender/balancing.py +++ b/release/scripts/io/netrender/balancing.py @@ -81,11 +81,17 @@ class Balancer: # ========================== class RatingUsage(RatingRule): + 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): @@ -96,6 +102,12 @@ class RatingUsageByCategory(RatingRule): 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__(self): + return "Priority to new jobs" + def __init__(self, limit = 1): self.limit = limit @@ -103,6 +115,12 @@ class NewJobPriority(PriorityRule): 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__(self): + return "Priority to jobs that haven't been dispatched recently" + def __init__(self, limit = 10): self.limit = limit @@ -110,10 +128,19 @@ class MinimumTimeBetweenDispatchPriority(PriorityRule): 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 class ExcludeSlavesLimit(ExclusionRule): + 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 diff --git a/release/scripts/io/netrender/master_html.py b/release/scripts/io/netrender/master_html.py index 99d74b64019..1f530efa7c6 100644 --- a/release/scripts/io/netrender/master_html.py +++ b/release/scripts/io/netrender/master_html.py @@ -40,8 +40,16 @@ def get(handler): def link(text, url): return "<a href='%s'>%s</a>" % (url, text) - def startTable(border=1): - output("<table border='%i'>" % border) + def startTable(border=1, class_style = None, caption = None): + output("<table border='%i'" % border) + + if class_style: + output(" class='%s'" % class_style) + + output(">") + + if caption: + output("<caption>%s</caption>" % caption) def headerTable(*headers): output("<thead><tr>") @@ -93,8 +101,23 @@ def get(handler): output("<h2>Master</h2>") - output("""<button title="remove all jobs" onclick="request('/clear', null);">CLEAR</button>""") + output("""<button title="remove all jobs" onclick="request('/clear', null);">CLEAR JOB LIST</button>""") + + startTable(caption = "Rules", class_style = "rules") + + headerTable("type", "description", "limit") + + for rule in handler.server.balancer.rules: + rowTable("rating", rule, rule.str_limit() if hasattr(rule, "limit") else " ") + + for rule in handler.server.balancer.priorities: + rowTable("priority", rule, rule.str_limit() if hasattr(rule, "limit") else " ") + for rule in handler.server.balancer.exceptions: + rowTable("exception", rule, rule.str_limit() if hasattr(rule, "limit") else " ") + + endTable() + output("<h2>Slaves</h2>") startTable() diff --git a/release/scripts/io/netrender/netrender.css b/release/scripts/io/netrender/netrender.css index 20a64ff984a..87de1083315 100644 --- a/release/scripts/io/netrender/netrender.css +++ b/release/scripts/io/netrender/netrender.css @@ -17,6 +17,12 @@ h2 { padding:5px; } +h2 { + background-color:#ddd; + font-size:110%; + padding:5px; +} + table { text-align:center; border:0; @@ -62,3 +68,8 @@ button { .fluid { display: none; } + +.rules { + width: 60em; + text-align: left; +}
\ No newline at end of file |