forked from bartvdbraak/blender
netrender: display dispatching rules under master header. (read only for now)
This commit is contained in:
parent
95db4d16dd
commit
8f3a529585
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user