Author: eallen
Date: 2009-06-22 13:02:23 -0400 (Mon, 22 Jun 2009)
New Revision: 3462
Added:
mgmt/trunk/cumin/python/cumin/grid/model.py
Modified:
mgmt/trunk/cumin/python/cumin/account/main.py
mgmt/trunk/cumin/python/cumin/account/main.strings
mgmt/trunk/cumin/python/cumin/grid/collector.py
mgmt/trunk/cumin/python/cumin/grid/collector.strings
mgmt/trunk/cumin/python/cumin/grid/job.py
mgmt/trunk/cumin/python/cumin/grid/job.strings
mgmt/trunk/cumin/python/cumin/grid/limit.py
mgmt/trunk/cumin/python/cumin/grid/main.py
mgmt/trunk/cumin/python/cumin/grid/negotiator.py
mgmt/trunk/cumin/python/cumin/grid/negotiator.strings
mgmt/trunk/cumin/python/cumin/grid/pool.py
mgmt/trunk/cumin/python/cumin/grid/scheduler.py
mgmt/trunk/cumin/python/cumin/grid/scheduler.strings
mgmt/trunk/cumin/python/cumin/grid/submitter.py
mgmt/trunk/cumin/python/cumin/grid/submitter.strings
mgmt/trunk/cumin/python/cumin/inventory/system.py
mgmt/trunk/cumin/python/cumin/inventory/system.strings
mgmt/trunk/cumin/python/cumin/model.py
Log:
Moving model actions to tasks for Grid.
Modified: mgmt/trunk/cumin/python/cumin/account/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/account/main.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/account/main.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -5,7 +5,6 @@
from cumin.widgets import *
from cumin.modelwidgets import *
from cumin.util import *
-from cumin.grid.job import JobTab
from user import UserSession
from model import *
@@ -53,27 +52,18 @@
def render_title(self, session):
return "Account"
-class AccountView(TabbedModeSet):
+class AccountView(Widget):
def __init__(self, app, name):
super(AccountView, self).__init__(app, name)
- heading = self.Heading(app, "heading")
- self.add_child(heading)
+ self.add_child(self.Heading(app, "heading"))
- self.add_tab(self.AccountTab(app, "acct"))
- self.add_tab(self.MyGridJobs(app, "jobs"))
+ self.__tabs = TabbedModeSet(app, "tabs")
+ self.add_child(self.__tabs)
- def render_change_password_href(self, session):
- subject = session.user_session.subject
- return self.app.change_password.get_href(session, subject)
+ self.__tabs.add_tab(self.AccountTab(app, "acct"))
+ #self.__tabs.add_tab(UserGridJobs(app, "jobs", None))
- class Heading(CuminHeading):
- def render_title(self, session):
- return "Your Account"
-
- def render_icon_href(self, session):
- return "resource?name=action-36.png"
-
class AccountTab(ActionSet):
def __init__(self, app, name):
super(AccountView.AccountTab, self).__init__(app, name)
@@ -89,30 +79,39 @@
def render_title(self, session):
return "Account Settings"
- class MyGridJobs(JobTab):
+ class Heading(CuminHeading):
def render_title(self, session):
- return "Your Grid Jobs %s" %
fmt_count(self.get_item_count(session))
+ return "Account"
- def render_sql_where(self, session, *args):
- if hasattr(session, "user_session"):
- user = session.user_session.subject.name
- else:
- user = ""
- elems = list()
- elems.append("b.name like '%s%s'" % (user, "%"))
- elems.append(self.get_phase_sql(session))
- return "where %s" % " and ".join(elems)
+ def render_icon_href(self, session):
+ return "resource?name=pool-36.png"
- def get_sql_values(self, session, *args):
- pass
+from cumin.grid.job import JobTab
- def get_visible_columns(self, session):
- return self.get_request_visible_columns(session, ["custom_group",
"scheduler"])
+class UserGridJobs(JobTab):
+ def render_title(self, session):
+ return "Your Grid Jobs %s" % fmt_count(self.get_item_count(session))
- def render_user(self, session, *args):
- if hasattr(session, "user_session"):
- return session.user_session.subject.name
+ def render_sql_where(self, session):
+ if hasattr(session, "user_session"):
+ user = session.user_session.subject.name
+ else:
+ user = ""
+ elems = list()
+ elems.append("b.name like '%s%s'" % (user, "%"))
+ elems.append(self.get_phase_sql(session))
+ return "where %s" % " and ".join(elems)
+ def get_sql_values(self, session):
+ pass
+
+ def get_visible_columns(self, session):
+ return self.get_request_visible_columns(session, ["custom_group",
"scheduler"])
+
+ def render_user(self, session, *args):
+ if hasattr(session, "user_session"):
+ return session.user_session.subject.name
+
class LoginPage(HtmlPage):
def __init__(self, app, name):
super(LoginPage, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/account/main.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/account/main.strings 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/account/main.strings 2009-06-22 17:02:23 UTC (rev 3462)
@@ -89,14 +89,6 @@
<div id="foot"/>
-[AccountView.html]
-<div class="oblock">
- {heading}
-
- <ul class="TabbedModeSet tabs">{tabs}</ul>
- <div class="TabbedModeSet mode">{content}</div>
-</div>
-
[AccountTab.html]
<ul class="actions">
<li>{change_password}</li>
Modified: mgmt/trunk/cumin/python/cumin/grid/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/collector.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/grid/collector.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -7,22 +7,21 @@
from wooly.tables import *
from cumin.stat import *
from cumin.widgets import *
+from cumin.modelwidgets import *
from cumin.parameters import *
from cumin.formats import *
from cumin.util import *
-from job import *
+import main
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.grid.collector")
-class CollectorSet(CuminTable, Form):
+class CollectorSet(CuminSelectionTable):
def __init__(self, app, name):
- super(CollectorSet, self).__init__(app, name)
+ item = CollectorParameter(app, "item")
+ super(CollectorSet, self).__init__(app, name, item)
- self.ids = CheckboxIdColumn(app, "id")
- self.add_column(self.ids)
-
col = self.NameColumn(app, "name")
self.add_column(col)
self.set_default_column(col)
@@ -30,24 +29,20 @@
col = self.SystemColumn(app, "system")
self.add_column(col)
- self.__start = self.StartButton(app, "start")
- self.add_child(self.__start)
+ task = main.module.collector_set_start
+ button = TaskButton(app, "start", task, self.selection)
+ self.buttons.add_child(button)
- self.__stop = self.StopButton(app, "stop")
- self.add_child(self.__stop)
+ task = main.module.collector_set_stop
+ button = TaskButton(app, "stop", task, self.selection)
+ self.buttons.add_child(button)
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def render_title(self, session, collector):
- count = self.get_item_count(session, collector)
+ def render_title(self, session):
+ count = self.get_item_count(session)
return "Collectors %s" % fmt_count(count)
- def render_sql_where(self, session, collector):
+ def render_sql_where(self, session):
sql = "qmf_delete_time is null"
- #sql = "((cs.qmf_update_time is null and c.qmf_update_time > now() -
interval '10 minutes') or " + \
- # "(cs.qmf_update_time > now() - interval '10 minutes')"
+ \
- # " and qmf_delete_time is null)"
return "where %s" % sql
class NameColumn(SqlTableColumn):
@@ -71,32 +66,6 @@
href = self.page.main.inventory.system.get_href(session, sys)
return fmt_link(href, data["system_name"])
- class StartButton(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
-
- branch = session.branch()
- frame = self.frame.show_colls_start(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
-
- def render_content(self, session):
- return "Start"
-
- class StopButton(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
-
- branch = session.branch()
- frame = self.frame.show_colls_stop(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
-
- def render_content(self, session):
- return "Stop"
-
class CollectorFrame(CuminFrame):
def __init__(self, app, name):
super(CollectorFrame, self).__init__(app, name)
@@ -104,7 +73,7 @@
self.object = CollectorParameter(app, "id")
self.add_parameter(self.object)
- self.view = CollectorView(app, "view")
+ self.view = CollectorView(app, "view", self.object)
self.add_mode(self.view)
class CollectorStats(Widget):
@@ -133,7 +102,7 @@
return "Slot State"
class CollectorView(CuminView):
- def __init__(self, app, name):
+ def __init__(self, app, name, collector):
super(CollectorView, self).__init__(app, name)
status = self.CollectorStatus(app, "status")
@@ -142,44 +111,32 @@
self.__tabs = TabbedModeSet(app, "tabs")
self.add_child(self.__tabs)
- stats = CollectorStats(app, "stats")
- self.__tabs.add_tab(stats)
+ self.__tabs.add_tab(CollectorStats(app, "stats"))
+ self.__tabs.add_tab(CuminDetails(app, "details"))
- details = CuminDetails(app, "details")
- self.__tabs.add_tab(details)
-
class CollectorStatus(CuminStatus):
def render_title(self, session, object):
return "Collector Status"
-class CollectorStart(CuminBulkActionForm):
- def render_title(self, session, *args):
- return "Start Collector"
+class CollectorStartForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(CollectorStartForm, self).__init__(app, name, task)
- def render_form_heading(self, session, *args):
- return ""
+ self.object = CollectorParameter(app, "collector")
+ self.add_parameter(self.object)
- def render_item_content(self, session, id):
- return "Start Collector '%s'" % Collector.get(id).Name
+class CollectorStopForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(CollectorStopForm, self).__init__(app, name, task)
- def process_item(self, session, item):
- collector = Collector.get(item)
- action = self.app.model.master.start
- action.invoke(collector, {"subsystem": "COLLECTOR"})
- self.process_cancel(session)
+ self.object = CollectorParameter(app, "collector")
+ self.add_parameter(self.object)
-class CollectorStop(CuminBulkActionForm):
- def render_title(self, session, *args):
- return "Stop Collector"
+class CollectorSetTaskForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(CollectorSetTaskForm, self).__init__(app, name, task)
- def render_form_heading(self, session, *args):
- return ""
+ item = CollectorParameter(app, "item")
- def render_item_content(self, session, id):
- return "Stop Collector '%s'" % Collector.get(id).Name
-
- def process_item(self, session, item):
- collector = Collector.get(item)
- action = self.app.model.master.stop
- action.invoke(collector, {"subsystem": "COLLECTOR"})
- self.process_cancel(session)
+ self.object = ListParameter(app, "collector", item)
+ self.add_parameter(self.object)
Modified: mgmt/trunk/cumin/python/cumin/grid/collector.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/collector.strings 2009-06-18 17:41:14 UTC (rev
3461)
+++ mgmt/trunk/cumin/python/cumin/grid/collector.strings 2009-06-22 17:02:23 UTC (rev
3462)
@@ -16,29 +16,6 @@
left outer join collector_stats as cs on cs.id = c.stats_curr_id
{sql_where}
-[CollectorSet.html]
-<form id="{id}" method="post" action="?">
- <div class="sactions">
- <h2>Act on Selected Collectors:</h2>
- {start} {stop}
- </div>
-
- <table class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
-
- <div>{hidden_inputs}</div>
-</form>
-
[CollectorStats.html]
<table class="twocol">
<tbody>
Modified: mgmt/trunk/cumin/python/cumin/grid/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/job.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/grid/job.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -6,20 +6,23 @@
from wooly.tables import *
from time import time
from cumin.widgets import *
+from cumin.modelwidgets import *
from cumin.parameters import *
from cumin.stat import *
from cumin.formats import *
from cumin.util import *
+import main
+
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.job")
-class JobSet(CuminTable, Form):
- def __init__(self, app, name):
- super(JobSet, self).__init__(app, name)
+class JobSet(CuminSelectionTable):
+ def __init__(self, app, name, pool):
+ item = JobParameter(app, "item")
+ super(JobSet, self).__init__(app, name, item)
- self.ids = CheckboxIdColumn(app, "id")
- self.add_column(self.ids)
+ self.pool = pool
col = self.CustomIdColumn(app, "custom_id")
self.add_column(col)
@@ -76,9 +79,18 @@
self.phase = JobStatusSwitch(app, "phase")
self.add_child(self.phase)
- def get_args(self, session):
- return self.frame.get_args(session)
+ task = main.module.job_set_hold
+ button = TaskButton(app, "hold", task, self.selection)
+ self.buttons.add_child(button)
+ task = main.module.job_set_release
+ button = TaskButton(app, "release", task, self.selection)
+ self.buttons.add_child(button)
+
+ task = main.module.job_set_remove
+ button = TaskButton(app, "remove", task, self.selection)
+ self.buttons.add_child(button)
+
def get_phase_sql(self, session, phase=None):
return self.phase.get_sql_constraint(session, phase)
@@ -87,7 +99,7 @@
return self.phase.get_title(state)
def render_sql_where(self, session, *args):
- phase = len(args) > 1 and args[1] or None
+ phase = len(args) > 0 and args[0] or None
elems = list()
elems.append(self.get_phase_sql(session, phase))
elems.append("s.pool = %(pool)s")
@@ -98,7 +110,7 @@
return (phase == 'c') and "left outer join job_stats as c on c.id =
j.stats_curr_id" or ""
def get_sql_values(self, session, *args):
- pool = args[0]
+ pool = self.pool.get(session)
return {"pool": pool.id}
class ArgsColumn(SqlTableColumn):
@@ -240,18 +252,9 @@
return fmt_duration(time() - secs(since))
class JobTab(JobSet):
- def __init__(self, app, name):
- super(JobTab, self).__init__(app, name)
+ def __init__(self, app, name, pool):
+ super(JobTab, self).__init__(app, name, pool)
- self.__remove = JobRemoveButton(app, "remove")
- self.add_child(self.__remove)
-
- self.__hold = JobHoldButton(app, "hold")
- self.add_child(self.__hold)
-
- self.__release = JobReleaseButton(app, "release")
- self.add_child(self.__release)
-
self.job_search = self.JobSearch(app, "job_search")
self.add_child(self.job_search)
@@ -287,8 +290,7 @@
def get_full_item_count(self, session, *args):
# request item count with phase=="a"
- new_args = (args[0], "a")
- return self.get_item_count(session, *new_args)
+ return self.get_item_count(session, 'a')
def get_visible_columns(self, session):
return self.get_request_visible_columns(session, ["custom_group",
"scheduler", "submitter"])
@@ -338,29 +340,20 @@
from cumin.inventory.system import SystemFrame, SystemSet
class JobGroupFrame(CuminFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(JobGroupFrame, self).__init__(app, name)
self.object = JobGroupParameter(app, "id")
self.add_parameter(self.object)
- self.view = JobGroupView(app, "view")
+ self.view = JobGroupView(app, "view", pool)
self.add_mode(self.view)
- self.jobs_hold = JobSetHold(app, "jobshold")
- self.add_mode(self.jobs_hold)
-
- self.jobs_release = JobSetRelease(app, "jobsrelease")
- self.add_mode(self.jobs_release)
-
- self.jobs_remove = JobSetRemove(app, "jobsremove")
- self.add_mode(self.jobs_remove)
-
self.system = SystemFrame(app, "system")
self.add_mode(self.system)
class JobGroupView(CuminView):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(JobGroupView, self).__init__(app, name)
summary = CuminSummary(app, "summary")
@@ -370,7 +363,7 @@
self.add_child(self.__tabs)
self.__tabs.add_tab(JobGroupStats(app, "stats"))
- self.__tabs.add_tab(JobGroupJobSet(app, "jobs"))
+ self.__tabs.add_tab(JobGroupJobSet(app, "jobs", pool))
self.__tabs.add_tab(JobGroupSystemSet(app, "systems"))
#self.__tabs.add_tab(CuminDetails(app, "details"))
@@ -432,91 +425,28 @@
percent = (value*1.0) / (jobs*1.0) * 100.0
return jobs and "%2.1f" % percent or "-"
-class JobRemoveButton(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
-
- href = self.frame.jobs_remove.get_href(session, ids)
- self.page.set_redirect_url(session, href)
-
- def render_content(self, session):
- return "Remove"
-
- def render_disabled_attr(self, session, *args):
- phase = self.parent.phase.get(session)
- return phase == "d" and "disabled=\"disabled\"" or
None
-
- def render_class(self, session, *args):
- phase = self.parent.phase.get(session)
- return phase == "d" and "disabled" or "enabled"
-
-class JobHoldButton(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
-
- href = self.frame.jobs_hold.get_href(session, ids)
- self.page.set_redirect_url(session, href)
-
- def render_content(self, session):
- return "Hold"
-
- def render_disabled_attr(self, session, *args):
- phase = self.parent.phase.get(session)
- return (phase == "h" or phase == "d") and
"disabled=\"disabled\"" or None
-
- def render_class(self, session, *args):
- phase = self.parent.phase.get(session)
- return (phase == "h" or phase == "d") and
"disabled" or "enabled"
-
-class JobReleaseButton(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
-
- href = self.frame.jobs_release.get_href(session, ids)
- self.page.set_redirect_url(session, href)
-
- def render_content(self, session):
- return "Release"
-
- def render_disabled_attr(self, session, *args):
- phase = self.parent.phase.get(session)
- return (phase == "r" or phase == "d") and
"disabled=\"disabled\"" or None
-
- def render_class(self, session, *args):
- phase = self.parent.phase.get(session)
- return (phase == "r" or phase == "d") and
"disabled" or "enabled"
-
class JobGroupJobSet(JobTab):
- def __init__(self, app, name):
- super(JobGroupJobSet, self).__init__(app, name)
+ def __init__(self, app, name, pool):
+ super(JobGroupJobSet, self).__init__(app, name, pool)
- self.__remove = JobRemoveButton(app, "remove")
- self.add_child(self.__remove)
-
- self.__hold = JobHoldButton(app, "hold")
- self.add_child(self.__hold)
-
- self.__release = JobReleaseButton(app, "release")
- self.add_child(self.__release)
-
def get_visible_columns(self, session):
return self.get_request_visible_columns(session, ["scheduler",
"submitter"])
- def render_title(self, session, group):
+ def render_title(self, session):
+ group = self.frame.object.get(session)
where_group = "custom_group = '%s'" % group.get_id()
return "Jobs %s" % fmt_count(Job.select(where_group).count())
- def render_sql_where(self, session, group):
+ def render_sql_where(self, session):
+ group = self.frame.object.get(session)
phase_sql = self.get_phase_sql(session)
group_sql = "j.custom_group = '%s'" % group.get_id()
return "where %s" % " and ".join([phase_sql, group_sql])
- def render_count(self, session, *args):
- str = super(JobGroupJobSet, self).render_count(session, *args)
- return "%s in Job Group '%s'" % (str, args[0].id)
+ def render_count(self, session):
+ group = self.frame.object.get(session)
+ str = super(JobGroupJobSet, self).render_count(session)
+ return "%s in Job Group '%s'" % (str, group.get_id())
class JobGroupStatus(CuminStatus):
def render_color(self, session, job_group):
@@ -528,10 +458,7 @@
return "Status"
class JobGroupSystemSet(SystemSet):
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def render_sql_where(self, session, group):
+ def render_sql_where(self, session):
subquery = """
select 1
from slot as l
@@ -541,7 +468,8 @@
return "where exists (%s)" % subquery
- def get_sql_values(self, session, group):
+ def get_sql_values(self, session):
+ group = self.frame.object.get(session)
return {"id": group.id}
class JobFrame(CuminFrame):
@@ -1031,11 +959,10 @@
return JobStatusInfo.get_status_string(job.JobStatus)
class JobGroupSet(CuminTable):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(JobGroupSet, self).__init__(app, name)
- self.ids = CheckboxStringIdColumn(app, "id")
- self.add_column(self.ids)
+ self.pool = pool
col = self.GroupColumn(app, "job_group")
self.add_column(col)
@@ -1062,16 +989,13 @@
return "Jobs"
class JobsAndGroupsTab(TabbedModeSet):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(JobsAndGroupsTab, self).__init__(app, name)
- self.jobs_tab = JobTab(app, "jobtab")
+ self.jobs_tab = JobTab(app, "jobtab", pool)
self.add_tab(self.jobs_tab)
- self.add_tab(JobGroupTab(app, "jobgrouptab"))
+ self.add_tab(JobGroupTab(app, "jobgrouptab", pool))
- def get_args(self, session):
- return self.frame.get_args(session)
-
def render_title(self, session, *args):
return "Jobs %s" % fmt_count(self.jobs_tab.get_full_item_count(session,
*args))
@@ -1079,103 +1003,47 @@
return self.mode.get(session) == self.jobs_tab and
self.jobs_tab.phase.render(session) or ""
class JobGroupTab(JobGroupSet, Form):
- def __init__(self, app, name):
- super(JobGroupTab, self).__init__(app, name)
+ def __init__(self, app, name, pool):
+ super(JobGroupTab, self).__init__(app, name, pool)
- self.__remove = self.Remove(app, "remove")
- self.add_child(self.__remove)
-
- self.__hold = self.Hold(app, "hold")
- self.add_child(self.__hold)
-
- self.__release = self.Release(app, "release")
- self.add_child(self.__release)
-
self.set_default_column_name("job_group")
def render_title(self, session, *args):
return "Job Groups"
- class Remove(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
+class JobReasonForm(CuminFieldForm):
+ def __init__(self, app, name, task, verb):
+ super(JobReasonForm, self).__init__(app, name)
- href = self.frame.job_group_remove.get_href(session, ids)
- self.page.set_redirect_url(session, href)
+ self.task = task
+ self.verb = verb
+ self.object = None
- def render_content(self, session):
- return "Remove"
+ self.reason = self.ReasonField(app, "reason")
+ self.add_field(self.reason)
- class Hold(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
+ def init(self):
+ assert self.object
+ super(JobReasonForm, self).init()
- href = self.frame.job_group_hold.get_href(session, ids)
- self.page.set_redirect_url(session, href)
+ def render_submit_content(self, session):
+ return self.verb
- def render_content(self, session):
- return "Hold"
+ def render_cancel_content(self, session):
+ return "Cancel"
- class Release(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
+ def process_submit(self, session):
+ object = self.object.get(session)
+ reason = self.get_reason(session, self.verb)
- href = self.frame.job_group_release.get_href(session, ids)
- self.page.set_redirect_url(session, href)
-
- def render_content(self, session):
- return "Release"
-
-class JobReasonBulkActionForm(CuminBulk):
- def __init__(self, app, name):
- super(JobReasonBulkActionForm, self).__init__(app, name)
-
- self.reason = Parameter(app, "reason")
- self.add_parameter(self.reason)
-
- self.error = Attribute(app, "error")
- self.add_attribute(self.error)
-
- self.error_tmpl = Template(self, "reason_html")
-
- def render_reason_text(self, session, *args):
- return "Reason"
-
- def render_reason_path(self, session, *args):
- return self.reason.path
-
- def render_reason_value(self, session, *args):
- return escape_entity(self.reason.get(session))
-
- def render_reason_error(self, session, *args):
- if self.error.get(session):
- writer = Writer()
- self.error_tmpl.render(writer, session, *args)
- return writer.to_string()
-
- def render_reason_error_text(self, session, *args):
- return self.error.get(session)
-
- def render_form_heading(self, session, *args):
- pass
-
- def process_submit(self, session, *args):
- reason = self.reason.get(session)
if not reason:
- self.error.set(session, "Reason is required")
- else:
- super(JobReasonBulkActionForm, self).process_submit(session, *args)
+ error = FormError("Reason is required")
+ self.errors.add(session, error)
- def process_return(self, session, *args):
- self.reason.set(session, "")
+ if not self.errors.get(session):
+ self.task.invoke(session, object, reason)
+ self.task.exit_with_redirect(session, object)
- branch = session.branch()
- self.frame.view.show(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
def get_reason(self, session, verb):
""" returns <verb> by username[: <user input reason>]
"""
reason = [self.reason.get(session)]
@@ -1183,119 +1051,34 @@
reason.insert(0, verb_by)
return ": ".join(reason)
-class JobReasonIntBulkActionForm(JobReasonBulkActionForm, CuminIntIdList):
- def get_items(self, session, *args):
- return self.ids.get(session)
+ class ReasonField(StringField):
+ def render_title(self, session):
+ return "Reason"
-class JobSetHold(JobReasonIntBulkActionForm):
- def process_item(self, session, id):
- job = Job.get(id)
- action = self.app.model.job.hold
- reason = self.get_reason(session, "held")
- action.invoke(job, reason)
+class JobTaskForm(JobReasonForm):
+ def __init__(self, app, name, task, verb):
+ super(JobTaskForm, self).__init__(app, name, task, verb)
- def render_title(self, session):
- ids = self.ids.get(session)
- return len(ids) > 1 and "Hold Jobs" or "Hold Job"
+ self.object = JobParameter(app, "job")
+ self.add_parameter(self.object)
- def render_item_content(self, session, id):
- return "Hold Job '%s'" % Job.get(id).CustomId
-
- def render_reason_text(self, session, *args):
- return "Hold Reason"
-
-class JobSetRelease(JobReasonIntBulkActionForm):
- def process_item(self, session, id):
- job = Job.get(id)
- action = self.app.model.job.release
- reason = self.get_reason(session, "released")
- action.invoke(job, reason)
-
def render_title(self, session):
- ids = self.ids.get(session)
- return len(ids) > 1 and "Release Jobs" or "Release Job"
+ job = self.object.get(session)
+ return "%s Job '%s'" % (self.verb, str(job.id))
- def render_item_content(self, session, id):
- return "Release Job '%s'" % Job.get(id).CustomId
+class JobSetTaskForm(JobReasonForm):
+ def __init__(self, app, name, task, verb):
+ super(JobSetTaskForm, self).__init__(app, name, task, verb)
- def render_reason_text(self, session, *args):
- return "Release Reason"
+ item = JobParameter(app, "item")
-class JobSetRemove(JobReasonIntBulkActionForm):
- def process_item(self, session, id):
- job = Job.get(id)
- action = self.app.model.job.remove
- reason = self.get_reason(session, "removed")
- action.invoke(job, reason)
+ self.object = ListParameter(app, "job", item)
+ self.add_parameter(self.object)
def render_title(self, session):
- ids = self.ids.get(session)
- return len(ids) > 1 and "Remove Jobs" or "Remove Job"
+ jobs = self.object.get(session)
+ return "%s %i Job%s" % (self.verb, len(jobs), len(jobs) > 1 and
"s" or "")
- def render_item_content(self, session, id):
- return "Remove Job '%s'" % Job.get(id).CustomId
-
- def render_reason_text(self, session, *args):
- return "Remove Reason"
-
-class JobReasonStringBulkActionForm(JobReasonBulkActionForm, CuminStringIdList):
- def get_items(self, session, *args):
- return self.ids.get(session)
-
-class JobGroupHold(JobReasonStringBulkActionForm):
- def process_item(self, session, id):
- sel = "custom_group='%s'" % id
- action = self.app.model.job.hold
- reason = self.get_reason(session, "held")
- for job in Job.select(sel):
- action.invoke(job, reason)
-
- def render_title(self, session):
- ids = self.ids.get(session)
- return len(ids) > 1 and "Hold Job Groups" or "Hold Job
Group"
-
- def render_item_content(self, session, group):
- return group
-
- def render_reason_text(self, session, *args):
- return "Hold Reason"
-
-class JobGroupRelease(JobReasonStringBulkActionForm):
- def process_item(self, session, id):
- sel = "custom_group='%s'" % id
- action = self.app.model.job.release
- reason = self.get_reason(session, "released")
- for job in Job.select(sel):
- action.invoke(job, reason)
-
- def render_title(self, session):
- ids = self.ids.get(session)
- return len(ids) > 1 and "Release Job Groups" or "Release Job
Group"
-
- def render_item_content(self, session, group):
- return group
-
- def render_reason_text(self, session, *args):
- return "Release Reason"
-
-class JobGroupRemove(JobReasonStringBulkActionForm):
- def process_item(self, session, id):
- sel = "custom_group='%s'" % id
- action = self.app.model.job.remove
- reason = self.get_reason(session, "removed")
- for job in Job.select(sel):
- action.invoke(job, reason)
-
- def render_title(self, session):
- ids = self.ids.get(session)
- return len(ids) > 1 and "Remove Job Groups" or "Remove Job
Group"
-
- def render_item_content(self, session, group):
- return group
-
- def render_reason_text(self, session, *args):
- return "Remove Reason"
-
class JobStatusSwitch(StateSwitch):
def __init__(self, app, name):
super(JobStatusSwitch, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/grid/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/job.strings 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/grid/job.strings 2009-06-22 17:02:23 UTC (rev 3462)
@@ -104,30 +104,7 @@
}
});
-[JobTab.html]
-<form id="{id}" method="post" action="?"
update="{id}.table">
- <div class="sactions">
- {job_search}
- <h2>Act on Selected Jobs:</h2>
- {hold} {release} {remove}
- </div>
- <table id="{id}.table" class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
-
-
[JobSearch.html]
<div class="rfloat searchbox">
<h2><label for="job_search">Go To Job:</label></h2>
@@ -166,53 +143,6 @@
<ul class="radiotabs tabs">{tabs}</ul>
<div class="radiotabs mode">{content}</div>
-[JobGroupTab.html]
-<form id="{id}" method="post" action="?">
- <div class="sactions">
- <h2>Act on Selected Groups:</h2>
- {hold} {release} {remove}
- </div>
-
- <table class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
-
-[JobGroupJobSet.html]
-<form id="{id}" method="post" action="?"
update="{id}.table">
-<div class="rfloat">{phase}</div>
-
- <div class="sactions" style="clear:right;">
- {job_search}
- <h2>Act on Selected Jobs:</h2>
- {hold} {release} {remove}
- </div>
-
- <table id="{id}.table" class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
-
[JobStatus.html]
<div id="{id}" class="CuminStatus {color}">
<h2>Job Status</h2>
@@ -302,59 +232,6 @@
<div>{hidden_inputs}</div>
</form>
-[JobReasonBulkActionForm.css]
-div.action_reason {
- margin: 1em;
-}
-
-div.action_reason label {
- font-weight: bold;
- margin-right: 0.5em;
-}
-
-div.action_reason input {
- width: 20em;
-}
-
-div.action_reason div.reason_error {
- float: right;
- border: 1px solid red;
- color: red;
- padding: 0.5em;
-}
-
-[JobReasonBulkActionForm.reason_html]
- <div class="reason_error">{reason_error_text}</div>
-
-[JobReasonBulkActionForm.html]
-<form id="{id}" class="mform" method="post"
action="?">
- <div class="head">
- <h1>{title}</h1>
- </div>
- <div class="body">
- <span class="legend">{form_heading}</span>
- <div class="action_reason">
- {reason_error}
- <label for="reason">{reason_text}</label> <input
type="text" name="{reason_path}" id="reason"
value="{reason_value}" maxlength="4000" />
- </div>
- <fieldset>
- <ul>{items}</ul>
- </fieldset>
-
- {hidden_inputs}
- </div>
- <div class="foot">
- {help}
- {submit}
- {cancel}
- </div>
-</form>
-<script type="text/javascript">
-//<![CDATA[
- $("{id}").elements[0].focus();
-//]]>
-</script>
-
[JobOutput.css]
textarea#job_output {
height: 25em;
Modified: mgmt/trunk/cumin/python/cumin/grid/limit.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/limit.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/grid/limit.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -129,13 +129,13 @@
return dict()
class LimitsFrame(CuminFrame, LimitActions):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(LimitsFrame, self).__init__(app, name)
self.object = LimitParameter(app, "id")
self.add_parameter(self.object)
- self.view = LimitsView(app, "view")
+ self.view = LimitsView(app, "view", pool)
self.add_mode(self.view)
self.edit = LimitEdit(app, "edit")
@@ -231,7 +231,7 @@
self.process_cancel(session, *args)
class LimitsView(CuminView):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(LimitsView, self).__init__(app, name)
status = LimitsStatus(app, "status")
@@ -240,7 +240,7 @@
self.__tabs = TabbedModeSet(app, "tabs")
self.add_child(self.__tabs)
- jobs = LimitsJobSet(app, "jobs")
+ jobs = LimitsJobSet(app, "jobs", pool)
self.__tabs.add_tab(jobs)
details = CuminDetails(app, "details")
Modified: mgmt/trunk/cumin/python/cumin/grid/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/main.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/grid/main.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -4,15 +4,40 @@
from cumin.widgets import *
from cumin.util import *
+from model import *
from pool import *
strings = StringCatalog(__file__)
class GridModule(object):
- def __init__(self):
- self.frame = None
+ def init(self, app):
- def init(self, app):
+ job = app.model.job
+ self.job_hold = JobHoldTask(app, job)
+ self.job_set_hold = JobSetHoldTask(app, job)
+ self.job_release = JobReleaseTask(app, job)
+ self.job_set_release = JobSetReleaseTask(app, job)
+ self.job_remove = JobRemoveTask(app, job)
+ self.job_set_remove = JobSetRemoveTask(app, job)
+
+ scheduler = app.model.scheduler
+ self.scheduler_start = SchedulerStartTask(app, scheduler)
+ self.scheduler_stop = SchedulerStopTask(app, scheduler)
+ self.scheduler_set_start = SchedulerSetStartTask(app, scheduler)
+ self.scheduler_set_stop = SchedulerSetStopTask(app, scheduler)
+
+ collector = app.model.collector
+ self.collector_start = CollectorStartTask(app, collector)
+ self.collector_stop = CollectorStopTask(app, collector)
+ self.collector_set_start = CollectorSetStartTask(app, collector)
+ self.collector_set_stop = CollectorSetStopTask(app, collector)
+
+ negotiator = app.model.negotiator
+ self.negotiator_start = NegotiatorStartTask(app, negotiator)
+ self.negotiator_stop = NegotiatorStopTask(app, negotiator)
+ self.negotiator_set_start = NegotiatorSetStartTask(app, negotiator)
+ self.negotiator_set_stop = NegotiatorSetStopTask(app, negotiator)
+
self.frame = GridFrame(app, "grid")
app.main_page.main.grid = self.frame
app.main_page.main.add_tab(self.frame)
@@ -32,15 +57,6 @@
self.sticky_pool = Parameter(app, "last_pool")
self.add_parameter(self.sticky_pool)
- self.jobs_hold = JobSetHold(app, "jobshold")
- self.add_mode(self.jobs_hold)
-
- self.jobs_release = JobSetRelease(app, "jobsrelease")
- self.add_mode(self.jobs_release)
-
- self.jobs_remove = JobSetRemove(app, "jobsremove")
- self.add_mode(self.jobs_remove)
-
def set_last_pool(self, session, pool):
self.sticky_pool.set(session, pool)
Added: mgmt/trunk/cumin/python/cumin/grid/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/model.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/grid/model.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -0,0 +1,291 @@
+from wooly import Session
+
+from cumin.util import *
+
+from cumin.model import Task, SetTask
+from job import *
+from scheduler import *
+from collector import *
+from negotiator import *
+
+class NegotiatorStartTask(QmfTask):
+ def __init__(self, app, cls):
+ super(NegotiatorStartTask, self).__init__(app, cls)
+
+ self.form = NegotiatorStartForm(app, "negotiator_start", self)
+
+ def do_enter(self, session, job):
+ self.form.object.set(session, job)
+
+ def do_exit(self, session, job):
+ self.app.main_page.main.grid.negotiator.view.show(session)
+
+ def get_title(self, session):
+ return "Start"
+
+ def do_invoke(self, completion, session, negotiator):
+ assert isinstance(negotiator, Negotiator)
+
+ system_name = negotiator.System
+ try:
+ master = Master.select("System = '%s'" % system_name)[0]
+ except IndexError:
+ raise Exception("Master daemon not running")
+ master.Start(self.app.model.mint.model, completion, "NEGOTIATOR")
+
+class NegotiatorSetStartTask(SetTask):
+ def __init__(self, app, cls):
+ super(NegotiatorSetStartTask, self).__init__(app, cls)
+
+ self.form = NegotiatorSetTaskForm(app, "negotiator_set_start", self)
+ self.item_task = NegotiatorStartTask(app, cls)
+
+ def do_enter(self, session, objects):
+ self.form.object.set(session, objects)
+
+class NegotiatorStopTask(QmfTask):
+ def __init__(self, app, cls):
+ super(NegotiatorStopTask, self).__init__(app, cls)
+
+ self.form = NegotiatorStopForm(app, "negotiator_stop", self)
+
+ def do_enter(self, session, job):
+ self.form.object.set(session, job)
+
+ def do_exit(self, session, job):
+ self.app.main_page.main.grid.negotiator.view.show(session)
+
+ def get_title(self, session):
+ return "Stop"
+
+ def do_invoke(self, completion, session, negotiator):
+ assert isinstance(negotiator, Negotiator)
+
+ system_name = negotiator.System
+ try:
+ master = Master.select("System = '%s'" % system_name)[0]
+ except IndexError:
+ raise Exception("Master daemon not running")
+ master.Stop(self.app.model.mint.model, completion, "NEGOTIATOR")
+
+class NegotiatorSetStopTask(SetTask):
+ def __init__(self, app, cls):
+ super(NegotiatorSetStopTask, self).__init__(app, cls)
+
+ self.form = NegotiatorSetTaskForm(app, "negotiator_set_stop", self)
+ self.item_task = NegotiatorStopTask(app, cls)
+
+ def do_enter(self, session, objects):
+ self.form.object.set(session, objects)
+
+class CollectorStartTask(QmfTask):
+ def __init__(self, app, cls):
+ super(CollectorStartTask, self).__init__(app, cls)
+
+ self.form = CollectorStartForm(app, "collector_start", self)
+
+ def do_enter(self, session, job):
+ self.form.object.set(session, job)
+
+ def do_exit(self, session, job):
+ self.app.main_page.main.grid.collector.view.show(session)
+
+ def get_title(self, session):
+ return "Start"
+
+ def do_invoke(self, completion, session, collector):
+ assert isinstance(collector, Collector)
+
+ system_name = collector.System
+ try:
+ master = Master.select("System = '%s'" % system_name)[0]
+ except IndexError:
+ raise Exception("Master daemon not running")
+ master.Start(self.app.model.mint.model, completion, "COLLECTOR")
+
+class CollectorSetStartTask(SetTask):
+ def __init__(self, app, cls):
+ super(CollectorSetStartTask, self).__init__(app, cls)
+
+ self.form = CollectorSetTaskForm(app, "collector_set_start", self)
+ self.item_task = CollectorStartTask(app, cls)
+
+ def do_enter(self, session, objects):
+ self.form.object.set(session, objects)
+
+class CollectorStopTask(QmfTask):
+ def __init__(self, app, cls):
+ super(CollectorStopTask, self).__init__(app, cls)
+
+ self.form = CollectorStopForm(app, "collector_stop", self)
+
+ def do_enter(self, session, job):
+ self.form.object.set(session, job)
+
+ def do_exit(self, session, job):
+ self.app.main_page.main.grid.collector.view.show(session)
+
+ def get_title(self, session):
+ return "Stop"
+
+ def do_invoke(self, completion, session, collector):
+ assert isinstance(collector, Collector)
+
+ system_name = collector.System
+ try:
+ master = Master.select("System = '%s'" % system_name)[0]
+ except IndexError:
+ raise Exception("Master daemon not running")
+ master.Stop(self.app.model.mint.model, completion, "COLLECTOR")
+
+class CollectorSetStopTask(SetTask):
+ def __init__(self, app, cls):
+ super(CollectorSetStopTask, self).__init__(app, cls)
+
+ self.form = CollectorSetTaskForm(app, "collector_set_stop", self)
+ self.item_task = CollectorStopTask(app, cls)
+
+ def do_enter(self, session, objects):
+ self.form.object.set(session, objects)
+
+class SchedulerStartTask(QmfTask):
+ def __init__(self, app, cls):
+ super(SchedulerStartTask, self).__init__(app, cls)
+
+ self.form = SchedulerStartForm(app, "scheduler_start", self)
+
+ def do_enter(self, session, job):
+ self.form.object.set(session, job)
+
+ def do_exit(self, session, job):
+ self.app.main_page.main.grid.scheduler.view.show(session)
+
+ def get_title(self, session):
+ return "Start"
+
+ def do_invoke(self, completion, session, scheduler):
+ assert isinstance(scheduler, Scheduler)
+
+ system_name = scheduler.System
+ try:
+ master = Master.select("System = '%s'" % system_name)[0]
+ except IndexError:
+ raise Exception("Master daemon not running")
+ master.Start(self.app.model.mint.model, completion, "SCHEDD")
+
+class SchedulerSetStartTask(SetTask):
+ def __init__(self, app, cls):
+ super(SchedulerSetStartTask, self).__init__(app, cls)
+
+ self.form = SchedulerSetTaskForm(app, "scheduler_set_start", self)
+ self.item_task = SchedulerStartTask(app, cls)
+
+ def do_enter(self, session, objects):
+ self.form.object.set(session, objects)
+
+class SchedulerStopTask(QmfTask):
+ def __init__(self, app, cls):
+ super(SchedulerStopTask, self).__init__(app, cls)
+
+ self.form = SchedulerStopForm(app, "scheduler_stop", self)
+
+ def do_enter(self, session, job):
+ self.form.object.set(session, job)
+
+ def do_exit(self, session, job):
+ self.app.main_page.main.grid.scheduler.view.show(session)
+
+ def get_title(self, session):
+ return "Stop"
+
+ def do_invoke(self, completion, session, scheduler):
+ assert isinstance(scheduler, Scheduler)
+
+ system_name = scheduler.System
+ try:
+ master = Master.select("System = '%s'" % system_name)[0]
+ except IndexError:
+ raise Exception("Master daemon not running")
+ master.Stop(self.app.model.mint.model, completion, "SCHEDD")
+
+class SchedulerSetStopTask(SetTask):
+ def __init__(self, app, cls):
+ super(SchedulerSetStopTask, self).__init__(app, cls)
+
+ self.form = SchedulerSetTaskForm(app, "scheduler_set_stop", self)
+ self.item_task = SchedulerStopTask(app, cls)
+
+ def do_enter(self, session, objects):
+ self.form.object.set(session, objects)
+
+class JobBaseTask(QmfTask):
+ def __init__(self, app, cls, form, verb):
+ super(JobBaseTask, self).__init__(app, cls)
+
+ self.form = form
+ self.verb = verb
+
+ def do_enter(self, session, job):
+ self.form.object.set(session, job)
+
+ def do_exit(self, session, job):
+ self.app.main_page.main.grid.job.view.show(session)
+
+ def get_title(self, session):
+ return self.verb
+
+class JobSetBaseTask(SetTask):
+ def do_enter(self, session, jobs):
+ self.form.object.set(session, jobs)
+
+class JobHoldTask(JobBaseTask):
+ def __init__(self, app, cls):
+ form = JobTaskForm(app, "job_hold", self, "Hold")
+ super(JobHoldTask, self).__init__(app, cls, form, "Hold")
+
+ def do_invoke(self, completion, session, job, reason):
+ assert isinstance(job, Job)
+
+ job.Hold(self.app.model.mint.model, completion, reason)
+
+class JobSetHoldTask(JobSetBaseTask):
+ def __init__(self, app, cls):
+ super(JobSetHoldTask, self).__init__(app, cls)
+
+ self.form = JobSetTaskForm(app, "job_set_hold", self,
"Hold")
+ self.item_task = JobHoldTask(app, cls)
+
+class JobReleaseTask(JobBaseTask):
+ def __init__(self, app, cls):
+ form = JobTaskForm(app, "job_release", self, "Release")
+ super(JobReleaseTask, self).__init__(app, cls, form, "Release")
+
+ def do_invoke(self, completion, session, job, reason):
+ assert isinstance(job, Job)
+
+ job.Release(self.app.model.mint.model, completion, reason)
+
+class JobSetReleaseTask(JobSetBaseTask):
+ def __init__(self, app, cls):
+ super(JobSetReleaseTask, self).__init__(app, cls)
+
+ self.form = JobSetTaskForm(app, "job_set_release", self,
"Release")
+ self.item_task = JobReleaseTask(app, cls)
+
+class JobRemoveTask(JobBaseTask):
+ def __init__(self, app, cls):
+ form = JobTaskForm(app, "job_remove", self, "Remove")
+ super(JobRemoveTask, self).__init__(app, cls, form, "Remove")
+
+ def do_invoke(self, completion, session, job, reason):
+ assert isinstance(job, Job)
+
+ job.Remove(self.app.model.mint.model, completion, reason)
+
+class JobSetRemoveTask(JobSetBaseTask):
+ def __init__(self, app, cls):
+ super(JobSetRemoveTask, self).__init__(app, cls)
+
+ self.form = JobSetTaskForm(app, "job_set_remove", self,
"Remove")
+ self.item_task = JobRemoveTask(app, cls)
+
Modified: mgmt/trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/negotiator.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/grid/negotiator.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -7,20 +7,21 @@
from wooly.tables import *
from cumin.stat import *
from cumin.widgets import *
+from cumin.modelwidgets import *
from cumin.parameters import *
from cumin.formats import *
from cumin.util import *
+import main
+
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.negotiator")
-class NegotiatorSet(CuminTable, Form):
+class NegotiatorSet(CuminSelectionTable):
def __init__(self, app, name):
- super(NegotiatorSet, self).__init__(app, name)
+ item = NegotiatorParameter(app, "item")
+ super(NegotiatorSet, self).__init__(app, name, item)
- self.ids = CheckboxIdColumn(app, "id")
- self.add_column(self.ids)
-
col = self.NameColumn(app, "name")
self.add_column(col)
self.set_default_column(col)
@@ -28,20 +29,19 @@
col = self.SystemColumn(app, "system")
self.add_column(col)
- self.__start = self.StartButton(app, "start")
- self.add_child(self.__start)
+ task = main.module.negotiator_set_start
+ button = TaskButton(app, "start", task, self.selection)
+ self.buttons.add_child(button)
- self.__stop = self.StopButton(app, "stop")
- self.add_child(self.__stop)
+ task = main.module.negotiator_set_stop
+ button = TaskButton(app, "stop", task, self.selection)
+ self.buttons.add_child(button)
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def render_title(self, session, negotiator):
- count = self.get_item_count(session, negotiator)
+ def render_title(self, session):
+ count = self.get_item_count(session)
return "Negotiators %s" % fmt_count(count)
- def render_sql_where(self, session, negotiator):
+ def render_sql_where(self, session):
sql = "((c.qmf_update_time is not null and " + \
"c.qmf_update_time > now() - interval '10 minutes')" +
\
" and qmf_delete_time is null)"
@@ -71,32 +71,6 @@
href = self.page.main.inventory.system.get_href(session, sys)
return fmt_link(href, data["system_name"])
- class StartButton(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
-
- branch = session.branch()
- frame = self.frame.show_negs_start(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
-
- def render_content(self, session):
- return "Start"
-
- class StopButton(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
-
- branch = session.branch()
- frame = self.frame.show_negs_stop(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
-
- def render_content(self, session):
- return "Stop"
-
class NegotiatorFrame(CuminFrame):
def __init__(self, app, name):
super(NegotiatorFrame, self).__init__(app, name)
@@ -129,34 +103,25 @@
def render_title(self, session, *args):
return "Negotiator Status"
-class NegStart(CuminBulkActionForm):
- def render_title(self, session, *args):
- return "Start Negotiator"
+class NegotiatorStartForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(NegotiatorStartForm, self).__init__(app, name, task)
- def render_form_heading(self, session, *args):
- return ""
+ self.object = NegotiatorParameter(app, "negotiator")
+ self.add_parameter(self.object)
- def render_item_content(self, session, id):
- return "Start Negotiator '%s'" % Negotiator.get(id).Name
+class NegotiatorStopForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(NegotiatorStopForm, self).__init__(app, name, task)
- def process_item(self, session, item):
- negotiator = Negotiator.get(item)
- action = self.app.model.master.start
- action.invoke(negotiator, {"subsystem": "NEGOTIATOR"})
- self.process_cancel(session)
+ self.object = NegotiatorParameter(app, "negotiator")
+ self.add_parameter(self.object)
-class NegStop(CuminBulkActionForm):
- def render_title(self, session, *args):
- return "Stop Negotiator"
+class NegotiatorSetTaskForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(NegotiatorSetTaskForm, self).__init__(app, name, task)
- def render_form_heading(self, session, *args):
- return ""
+ item = NegotiatorParameter(app, "item")
- def render_item_content(self, session, id):
- return "Stop Negotiator '%s'" % Negotiator.get(id).Name
-
- def process_item(self, session, item):
- negotiator = Negotiator.get(item)
- action = self.app.model.master.stop
- action.invoke(negotiator, {"subsystem": "NEGOTIATOR"})
- self.process_cancel(session)
+ self.object = ListParameter(app, "negotiator", item)
+ self.add_parameter(self.object)
Modified: mgmt/trunk/cumin/python/cumin/grid/negotiator.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/negotiator.strings 2009-06-18 17:41:14 UTC (rev
3461)
+++ mgmt/trunk/cumin/python/cumin/grid/negotiator.strings 2009-06-22 17:02:23 UTC (rev
3462)
@@ -15,26 +15,3 @@
select count(1) from negotiator as n
left outer join negotiator_stats as c on c.id = n.stats_curr_id
{sql_where}
-
-[NegotiatorSet.html]
-<form id="{id}" method="post" action="?">
-
- <div class="sactions">
- <h2>Act on Selected Negotiators:</h2>
- {start} {stop}
- </div>
-
- <table class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -12,11 +12,11 @@
from cumin.visualizations import SlotMap
from job import *
-from scheduler import SchedulerSet, SchedulerFrame, SchedulerStart, SchedulerStop
+from scheduler import SchedulerSet, SchedulerFrame
from submission import SubmissionSet
from submitter import SubmitterSet, SubmitterFrame
-from collector import CollectorSet, CollectorFrame, CollectorStart, CollectorStop
-from negotiator import NegotiatorSet, NegotiatorFrame, NegStart, NegStop
+from collector import CollectorSet, CollectorFrame
+from negotiator import NegotiatorSet, NegotiatorFrame
from limit import LimitsSet, LimitsFrame
from slot import SlotSet, SlotFrame
@@ -77,19 +77,19 @@
self.object = PoolParameter(app, "id")
self.add_parameter(self.object)
- self.view = PoolView(app, "view")
+ self.view = PoolView(app, "view", self.object)
self.add_mode(self.view)
self.job = JobFrame(app, "job")
self.add_mode(self.job)
- self.job_group = JobGroupFrame(app, "jobgroup")
+ self.job_group = JobGroupFrame(app, "jobgroup", self.object)
self.add_mode(self.job_group)
- self.scheduler = SchedulerFrame(app, "sched")
+ self.scheduler = SchedulerFrame(app, "sched", self.object)
self.add_mode(self.scheduler)
- self.submitter = SubmitterFrame(app, "sub")
+ self.submitter = SubmitterFrame(app, "sub", self.object)
self.add_mode(self.submitter)
self.slot = SlotFrame(app, "slot")
@@ -98,78 +98,18 @@
self.collector = CollectorFrame(app, "coll")
self.add_mode(self.collector)
- self.limit = LimitsFrame(app, "limit")
+ self.limit = LimitsFrame(app, "limit", self.object)
self.add_mode(self.limit)
self.negotiator = NegotiatorFrame(app, "neg")
self.add_mode(self.negotiator)
- self.__startneg = NegStart(app, "startneg")
- self.add_mode(self.__startneg)
-
- self.__stopneg = NegStop(app, "stopneg")
- self.add_mode(self.__stopneg)
-
- self.__startcoll = CollectorStart(app, "startcoll")
- self.add_mode(self.__startcoll)
-
- self.__stopcoll = CollectorStop(app, "stopcoll")
- self.add_mode(self.__stopcoll)
-
- self.__startsched = SchedulerStart(app, "startsched")
- self.add_mode(self.__startsched)
-
- self.__stopsched = SchedulerStop(app, "stopsched")
- self.add_mode(self.__stopsched)
-
- self.jobs_hold = JobSetHold(app, "jobshold")
- self.add_mode(self.jobs_hold)
-
- self.jobs_release = JobSetRelease(app, "jobsrelease")
- self.add_mode(self.jobs_release)
-
- self.jobs_remove = JobSetRemove(app, "jobsremove")
- self.add_mode(self.jobs_remove)
-
- self.job_group_hold = JobGroupHold(app, "jobgrouphold")
- self.add_mode(self.job_group_hold)
-
- self.job_group_release = JobGroupRelease(app, "jobgrouprelease")
- self.add_mode(self.job_group_release)
-
- self.job_group_remove = JobGroupRemove(app, "jobgroupremove")
- self.add_mode(self.job_group_remove)
-
def show_job_frame(self, session):
self.page.set_frame(session, self.job)
return self.job.show(session)
- def show_negs_start(self, session):
- self.page.set_frame(session, self.__startneg)
- return self.__startneg.show(session)
-
- def show_negs_stop(self, session):
- self.page.set_frame(session, self.__stopneg)
- return self.__stopneg.show(session)
-
- def show_scheds_start(self, session):
- self.page.set_frame(session, self.__startsched)
- return self.__startsched.show(session)
-
- def show_scheds_stop(self, session):
- self.page.set_frame(session, self.__stopsched)
- return self.__stopsched.show(session)
-
- def show_colls_start(self, session):
- self.page.set_frame(session, self.__startcoll)
- return self.__startcoll.show(session)
-
- def show_colls_stop(self, session):
- self.page.set_frame(session, self.__stopcoll)
- return self.__stopcoll.show(session)
-
class PoolView(CuminView):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(PoolView, self).__init__(app, name)
self.__tabs = TabbedModeSet(app, "tabs")
@@ -178,25 +118,25 @@
stats = PoolStats(app, "stats")
self.__tabs.add_tab(stats)
- self.jobs = JobsAndGroupsTab(app, "jobs")
+ self.jobs = JobsAndGroupsTab(app, "jobs", pool)
self.__tabs.add_tab(self.jobs)
self.submissions = SubmissionSet(app, "submissions")
self.__tabs.add_tab(self.submissions)
- self.scheds = PoolSchedulerSet(app, "scheds")
+ self.scheds = PoolSchedulerSet(app, "scheds", pool)
self.__tabs.add_tab(self.scheds)
subs = PoolSubmitterSet(app, "subs")
self.__tabs.add_tab(subs)
- self.colls = PoolCollectorSet(app, "colls")
+ self.colls = PoolCollectorSet(app, "colls", pool)
self.__tabs.add_tab(self.colls)
self.slots = PoolSlotSet(app, "slots")
self.__tabs.add_tab(self.slots)
- self.negs = PoolNegotiatorSet(app, "negs")
+ self.negs = PoolNegotiatorSet(app, "negs", pool)
self.__tabs.add_tab(self.negs)
self.limits = LimitsSet(app, "limits")
@@ -216,19 +156,17 @@
self.scheds.show(session)
class PoolSchedulerSet(SchedulerSet):
- def get_args(self, session):
- return self.frame.get_args(session)
+ def render_sql_where(self, session):
+ return "where s.pool = %(pool)s"
- def get_sql_values(self, session, pool):
+ def get_sql_values(self, session):
+ pool = self.frame.object.get(session)
return {"pool": pool.id}
- def render_title(self, session, pool):
- count = self.get_item_count(session, pool)
+ def render_title(self, session):
+ count = self.get_item_count(session)
return "Schedulers %s" % fmt_count(count)
- def render_sql_where(self, session, pool):
- return "where s.pool = %(pool)s"
-
class PoolSubmitterSet(SubmitterSet):
def get_args(self, session):
return self.frame.get_args(session)
@@ -244,33 +182,39 @@
return "where d.pool = %(pool)s"
class PoolCollectorSet(CollectorSet):
- def get_args(self, session):
- return self.frame.get_args(session)
+ def __init__(self, app, name, pool):
+ super(PoolCollectorSet, self).__init__(app, name)
- def get_sql_values(self, session, pool):
+ self.pool = pool
+
+ def render_sql_where(self, session):
+ return "where c.pool = %(pool)s"
+
+ def get_sql_values(self, session):
+ pool = self.pool.get(session)
return {"pool": pool.id}
- def render_title(self, session, pool):
- count = self.get_item_count(session, pool)
+ def render_title(self, session):
+ count = self.get_item_count(session)
return "Collectors %s" % fmt_count(count)
- def render_sql_where(self, session, pool):
- return "where c.pool = %(pool)s"
-
class PoolNegotiatorSet(NegotiatorSet):
- def get_args(self, session):
- return self.frame.get_args(session)
+ def __init__(self, app, name, pool):
+ super(PoolNegotiatorSet, self).__init__(app, name)
- def get_sql_values(self, session, pool):
+ self.pool = pool
+
+ def render_sql_where(self, session):
+ return "where n.pool = %(pool)s"
+
+ def get_sql_values(self, session):
+ pool = self.pool.get(session)
return {"pool": pool.id}
- def render_title(self, session, pool):
- count = self.get_item_count(session, pool)
+ def render_title(self, session):
+ count = self.get_item_count(session)
return "Negotiators %s" % fmt_count(count)
- def render_sql_where(self, session, pool):
- return "where n.pool = %(pool)s"
-
class PoolSlotSet(SlotSet):
def get_args(self, session):
return self.frame.get_args(session)
Modified: mgmt/trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/scheduler.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/grid/scheduler.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -16,13 +16,11 @@
log = logging.getLogger("cumin.scheduler")
-class SchedulerSet(CuminTable, Form):
- def __init__(self, app, name):
- super(SchedulerSet, self).__init__(app, name)
+class SchedulerSet(CuminSelectionTable):
+ def __init__(self, app, name, pool):
+ item = SchedulerParameter(app, "item")
+ super(SchedulerSet, self).__init__(app, name, item)
- self.ids = CheckboxIdColumn(app, "id")
- self.add_column(self.ids)
-
col = self.NameColumn(app, "name")
self.add_column(col)
self.set_default_column(col)
@@ -42,11 +40,13 @@
col.alignment = "right"
self.add_column(col)
- self.__start = self.StartButton(app, "start")
- self.add_child(self.__start)
+ task = main.module.scheduler_set_start
+ button = TaskButton(app, "start", task, self.selection)
+ self.buttons.add_child(button)
- self.__stop = self.StopButton(app, "stop")
- self.add_child(self.__stop)
+ task = main.module.scheduler_set_stop
+ button = TaskButton(app, "stop", task, self.selection)
+ self.buttons.add_child(button)
def render_title(self, session, *args):
return "Schedulers %s" % fmt_count(Scheduler.select().count())
@@ -84,44 +84,18 @@
href = self.page.main.inventory.system.get_href(session, sys)
return fmt_link(href, data["system_name"])
- class StartButton(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
-
- branch = session.branch()
- frame = self.frame.show_scheds_start(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
-
- def render_content(self, session):
- return "Start"
-
- class StopButton(FormButton):
- def process_submit(self, session):
- ids = self.parent.ids.get(session)
- self.parent.ids.clear(session)
-
- branch = session.branch()
- frame = self.frame.show_scheds_stop(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
-
- def render_content(self, session):
- return "Stop"
-
class SchedulerFrame(CuminFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(SchedulerFrame, self).__init__(app, name)
self.object = SchedulerParameter(app, "id")
self.add_parameter(self.object)
- self.view = SchedulerView(app, "view")
+ self.view = SchedulerView(app, "view", pool)
self.add_mode(self.view)
class SchedulerView(CuminView):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(SchedulerView, self).__init__(app, name)
status = self.SchedulerStatus(app, "status")
@@ -133,7 +107,7 @@
stats = SchedulerStats(app, "stats")
self.__tabs.add_tab(stats)
- jobs = SchedulerJobSet(app, "jobs")
+ jobs = SchedulerJobSet(app, "jobs", pool)
self.__tabs.add_tab(jobs)
details = CuminDetails(app, "details")
@@ -186,49 +160,43 @@
return "Jobs"
class SchedulerJobSet(JobTab):
- def __init__(self, app, name):
- super(SchedulerJobSet, self).__init__(app, name)
+ def __init__(self, app, name, pool):
+ super(SchedulerJobSet, self).__init__(app, name, pool)
def get_visible_columns(self, session):
return self.get_request_visible_columns(session, ["custom_group",
"submitter"])
- def render_sql_where(self, session, scheduler):
+ def render_sql_where(self, session):
+ scheduler = self.frame.object.get(session)
phase_sql = self.get_phase_sql(session)
scheduler_sql = "j.scheduler_id = %i" % scheduler.id
return "where %s" % " and ".join([phase_sql, scheduler_sql])
- def render_title(self, session, scheduler):
+ def render_title(self, session):
+ scheduler = self.frame.object.get(session)
where_scheduler = "scheduler_id = %i" % scheduler.id
return "Jobs %s" % fmt_count(Job.select(where_scheduler).count())
-class SchedulerStart(CuminBulkActionForm):
- def render_title(self, session, *args):
- return "Start Scheduler"
+class SchedulerStartForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(SchedulerStartForm, self).__init__(app, name, task)
- def render_form_heading(self, session, *args):
- return ""
+ self.object = SchedulerParameter(app, "scheduler")
+ self.add_parameter(self.object)
- def render_item_content(self, session, id):
- return "Start Scheduler '%s'" % Scheduler.get(id).Name
+class SchedulerStopForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(SchedulerStopForm, self).__init__(app, name, task)
- def process_item(self, session, item):
- scheduler = Scheduler.get(item)
- action = self.app.model.master.start
- action.invoke(scheduler, {"subsystem": "SCHEDD"})
- self.process_cancel(session)
+ self.object = SchedulerParameter(app, "scheduler")
+ self.add_parameter(self.object)
-class SchedulerStop(CuminBulkActionForm):
- def render_title(self, session, *args):
- return "Stop Scheduler"
+class SchedulerSetTaskForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(SchedulerSetTaskForm, self).__init__(app, name, task)
- def render_form_heading(self, session, *args):
- return ""
+ item = SchedulerParameter(app, "item")
- def render_item_content(self, session, id):
- return "Stop Scheduler '%s'" % Scheduler.get(id).Name
+ self.object = ListParameter(app, "scheduler", item)
+ self.add_parameter(self.object)
- def process_item(self, session, item):
- scheduler = Scheduler.get(item)
- action = self.app.model.master.stop
- action.invoke(scheduler, {"subsystem": "SCHEDD"})
- self.process_cancel(session)
Modified: mgmt/trunk/cumin/python/cumin/grid/scheduler.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/scheduler.strings 2009-06-18 17:41:14 UTC (rev
3461)
+++ mgmt/trunk/cumin/python/cumin/grid/scheduler.strings 2009-06-22 17:02:23 UTC (rev
3462)
@@ -18,28 +18,6 @@
select count(1) from scheduler as s
{sql_where}
-[SchedulerSet.html]
-<form id="{id}" method="post" action="?">
- <div class="sactions">
- <h2>Act on Selected Schedulers:</h2>
- {start} {stop}
- </div>
-
- <table class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
-
[SchedulerStats.html]
<table class="twocol">
<tbody>
@@ -55,27 +33,3 @@
</tr>
</tbody>
</table>
-
-[SchedulerJobSet.html]
-<form id="{id}" method="post" action="?"
update="{id}.table">
-<div class="rfloat">{phase}</div>
- <div class="sactions" style="clear:right;">
- {job_search}
- <h2>Act on Selected Jobs:</h2>
- {hold} {release} {remove}
- </div>
-
- <table id="{id}.table" class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
Modified: mgmt/trunk/cumin/python/cumin/grid/submitter.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/submitter.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/grid/submitter.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -38,17 +38,17 @@
return fmt_link(href, data["name"])
class SubmitterFrame(CuminFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(SubmitterFrame, self).__init__(app, name)
self.object = SubmitterParameter(app, "id")
self.add_parameter(self.object)
- self.view = SubmitterView(app, "view")
+ self.view = SubmitterView(app, "view", pool)
self.add_mode(self.view)
class SubmitterView(CuminView):
- def __init__(self, app, name):
+ def __init__(self, app, name, pool):
super(SubmitterView, self).__init__(app, name)
status = SubmitterStatus(app, "status")
@@ -60,14 +60,14 @@
stats = SubmitterStats(app, "stats")
self.__tabs.add_tab(stats)
- jobs = SubmitterJobSet(app, "jobs")
+ jobs = SubmitterJobSet(app, "jobs", pool)
self.__tabs.add_tab(jobs)
details = CuminDetails(app, "details")
self.__tabs.add_tab(details)
class SubmitterStatus(CuminStatus):
- def render_title(self, session, submitter):
+ def render_title(self, session):
return "Submitter Status"
class SubmitterStats(Widget):
@@ -94,17 +94,19 @@
return "Jobs"
class SubmitterJobSet(JobTab):
- def __init__(self, app, name):
- super(SubmitterJobSet, self).__init__(app, name)
+ def __init__(self, app, name, pool):
+ super(SubmitterJobSet, self).__init__(app, name, pool)
def get_visible_columns(self, session):
return self.get_request_visible_columns(session, ["custom_group",
"scheduler"])
- def render_sql_where(self, session, submitter):
+ def render_sql_where(self, session):
+ submitter = self.frame.object.get(session)
phase_sql = self.get_phase_sql(session)
submitter_sql = "j.submitter_id = %i" % submitter.id
return "where %s" % " and ".join([phase_sql, submitter_sql])
- def render_title(self, session, submitter):
+ def render_title(self, session):
+ submitter = self.frame.object.get(session)
submitter_sql = "submitter_id = %i" % submitter.id
return "Jobs %s" % fmt_count(Job.select(submitter_sql).count())
Modified: mgmt/trunk/cumin/python/cumin/grid/submitter.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/submitter.strings 2009-06-18 17:41:14 UTC (rev
3461)
+++ mgmt/trunk/cumin/python/cumin/grid/submitter.strings 2009-06-22 17:02:23 UTC (rev
3462)
@@ -27,28 +27,3 @@
</tr>
</tbody>
</table>
-
-[SubmitterJobSet.html]
-<form id="{id}" method="post" action="?"
update="{id}.table">
-
- <div class="rfloat">{phase}</div>
- <div class="sactions" style="clear:right;">
- {job_search}
- <h2>Act on Selected Jobs:</h2>
- {hold} {release} {remove}
- </div>
-
- <table id="{id}.table" class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
Modified: mgmt/trunk/cumin/python/cumin/inventory/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/inventory/system.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/inventory/system.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -175,7 +175,7 @@
self.add_child(self.__tabs)
self.__tabs.add_tab(SystemStats(app, "stats"))
- self.__tabs.add_tab(SystemJobSet(app, "jobs"))
+ self.__tabs.add_tab(SystemJobSet(app, "jobs", None))
self.__tabs.add_tab(SystemSlotSet(app, "slots"))
self.__tabs.add_tab(SystemServices(app, "services"))
self.__tabs.add_tab(CuminDetails(app, "details"))
@@ -183,16 +183,17 @@
from cumin.grid.job import JobTab
class SystemJobSet(JobTab):
- def render_title(self, session, system):
- return "Grid Jobs %s" % fmt_count(self.get_item_count(session,
system))
+ def render_title(self, session):
+ return "Grid Jobs %s" % fmt_count(self.get_item_count(session))
- def render_sql_where(self, session, system):
+ def render_sql_where(self, session):
elems = list()
elems.append("s.system = %(nodeName)s")
elems.append(self.get_phase_sql(session))
return "where %s" % " and ".join(elems)
- def get_sql_values(self, session, system):
+ def get_sql_values(self, session):
+ system = self.frame.get_object(session)
return {"nodeName": system.nodeName}
from cumin.grid.slot import SlotSet
Modified: mgmt/trunk/cumin/python/cumin/inventory/system.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/inventory/system.strings 2009-06-18 17:41:14 UTC (rev
3461)
+++ mgmt/trunk/cumin/python/cumin/inventory/system.strings 2009-06-22 17:02:23 UTC (rev
3462)
@@ -82,24 +82,6 @@
// ]]>
</script>
-[SystemJobSet.html]
-<form id="{id}" method="post" action="?">
- <div class="rfloat">{phase}</div>
- <table class="mobjects" style="clear:right;">
- <thead>
- <tr>
- <th class="setnav" colspan="{column_count}">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
- </table>
- <div>{hidden_inputs}</div>
-</form>
-
[SystemServices.html]
<h2>Services</h2>
<table class="PropertySet">
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2009-06-18 17:41:14 UTC (rev 3461)
+++ mgmt/trunk/cumin/python/cumin/model.py 2009-06-22 17:02:23 UTC (rev 3462)
@@ -9,9 +9,6 @@
from wooly.parameters import *
from wooly.widgets import *
-from grid.job import *
-from grid.pool import PoolJobStats
-from grid.slot import SlotStatSet
from formats import *
from parameters import *
from util import *
@@ -1690,18 +1687,9 @@
prop.title = "Collector"
prop.summary = True
- stat = self.StatusStat(self, "idl")
- stat.category = "status"
-
- stat = self.StatusStat(self, "all")
- stat.category = "status"
-
action = self.SeeAllPools(self, "allpools")
action.summary = True
- self.status = self.PoolStatus(self, "poolstatus")
- self.status.navigable = False
-
def init(self):
super(CuminPool, self).init()
@@ -1730,17 +1718,6 @@
self.model.frame.grid.view.show(branch)
return branch.marshal()
- def write_stat_xml(self, session, writer, object):
- record = self.fake_stats.get_stat_record(session, object)
- for stat in self.stats:
- if stat.category == "general":
- stat.write_xml(writer, record)
-
- record = self.status.get_stat_record(session, object)
- for stat in self.stats:
- if stat.category == "status":
- stat.write_xml(writer, record)
-
class StatusStat(CuminStat):
def value_text(self, record):
if record:
@@ -1752,32 +1729,6 @@
def rate_text(self, record):
return ""
- class PoolStatus(CuminAction):
- def __init__(self, cls, name):
- super(CuminPool.PoolStatus, self).__init__(cls, name)
-
- self.itemset = self.StatusPoolSlotSet(cls.model.app, "stats")
- self.itemset.items.path = "CuminPool.PoolStatus.stats"
-
- def get_stat_record(self, session, pool):
- rows = self.itemset.get_items(session, pool)
- if len(rows):
- return rows[0]
-
- class StatusPoolSlotSet(SlotStatSet):
- def render_sql_where(self, session, pool):
- elems = list()
- elems.append("s.pool = %(pool)s")
- recent = self.get_recent_sql_where(session)
- if recent:
- elems.append(recent)
-
- return "where %s" % " and ".join(elems)
-
- def get_sql_values(self, session, pool):
- values = {"pool": pool.id}
- return values
-
class CuminLimit(CuminClass):
def __init__(self, model):
super(CuminLimit, self).__init__ \
@@ -1854,18 +1805,6 @@
stat = CuminStat(self, "Jobs")
stat.title = "Total Jobs"
- action = self.Hold(self, "hold")
- action.title = "Hold"
- action.summary = True
-
- action = self.Release(self, "release")
- action.title = "Release"
- action.summary = True
-
- action = self.Remove(self, "remove")
- action.title = "Remove"
- action.summary = True
-
def init(self):
super(CuminJobGroup, self).init()
@@ -1882,24 +1821,6 @@
def get_icon_href(self, session):
return "resource?name=group-36.png"
- class Hold(CuminAction):
- def show(self, session, group):
- frame = self.model.frame.grid.pool.job_group_hold.show(session)
- frame.ids.set(session, [group.id])
- return frame
-
- class Release(CuminAction):
- def show(self, session, group):
- frame = self.model.frame.grid.pool.job_group_release.show(session)
- frame.ids.set(session, [group.id])
- return frame
-
- class Remove(CuminAction):
- def show(self, session, group):
- frame = self.model.frame.grid.pool.job_group_remove.show(session)
- frame.ids.set(session, [group.id])
- return frame
-
class CuminJob(RemoteClass):
def __init__(self, model):
super(CuminJob, self).__init__(model, "job", Job, JobStats)
@@ -2071,16 +1992,6 @@
prop = CuminProperty(self, "HoldReason")
prop.title = "Hold Reason"
- ######## Actions
- action = self.Hold(self, "hold")
- action.summary = True
-
- action = self.Release(self, "release")
- action.summary = True
-
- action = self.Remove(self, "remove")
- action.summary = True
-
action = self.SetAttribute(self, "setattribute")
action.navigable = False
@@ -2309,12 +2220,6 @@
stat = CuminStat(self, "TotalRemovedJobs")
stat.title = "Removed Jobs"
- action = self.Start(self, "start")
- action.summary = True
-
- action = self.Stop(self, "stop")
- action.summary = True
-
action = GetStartedAction(self, "GetStarted")
action.navigable = False
@@ -2329,24 +2234,6 @@
def get_object_name(self, sched):
return sched.Name
- class Start(CuminAction):
- def show(self, session, sched):
- frame = self.model.frame.grid.pool.show_scheds_start(session)
- frame.ids.set(session, [sched.id])
- return frame
-
- def get_title(self, session):
- return "Start"
-
- class Stop(CuminAction):
- def show(self, session, sched):
- frame = self.model.frame.grid.pool.show_scheds_stop(session)
- frame.ids.set(session, [sched.id])
- return frame
-
- def get_title(self, session):
- return "Stop"
-
class CuminSubmitter(RemoteClass):
def __init__(self, model):
super(CuminSubmitter, self).__init__(model, "submitter",
@@ -2395,12 +2282,6 @@
prop = CuminProperty(self, "PublicNetworkIpAddr")
prop.title = "IP Address"
- action = self.Start(self, "start")
- action.summary = True
-
- action = self.Stop(self, "stop")
- action.summary = True
-
action = GetStartedAction(self, "GetStarted")
action.navigable = False
@@ -2433,26 +2314,6 @@
def get_object_name(self, coll):
return coll.Name
- class Start(CuminAction):
- def show(self, session, collector):
- frame = self.model.frame.grid.pool.show_colls_start(session)
- ids = [collector.id]
- frame.ids.set(session, ids)
- return frame
-
- def get_title(self, session):
- return "Start"
-
- class Stop(CuminAction):
- def show(self, session, collector):
- frame = self.model.frame.grid.pool.show_colls_stop(session)
- ids = [collector.id]
- frame.ids.set(session, ids)
- return frame
-
- def get_title(self, session):
- return "Stop"
-
class CuminNegotiator(RemoteClass):
def __init__(self, model):
super(CuminNegotiator, self).__init__(model, "negotiator",
@@ -2490,12 +2351,6 @@
stat.title = "Resident Set Size"
stat.category = "general"
- action = self.Start(self, "start")
- action.summary = True
-
- action = self.Stop(self, "stop")
- action.summary = True
-
action = self.GetLimits(self, "GetLimits")
action.navigable = False
@@ -2513,24 +2368,6 @@
def get_object_name(self, neg):
return neg.Name
- class Start(CuminAction):
- def show(self, session, neg):
- frame = self.model.frame.grid.pool.show_negs_start(session)
- frame.ids.set(session, [neg.id])
- return frame
-
- def get_title(self, session):
- return "Start"
-
- class Stop(CuminAction):
- def show(self, session, neg):
- frame = self.model.frame.grid.pool.show_negs_stop(session)
- frame.ids.set(session, [neg.id])
- return frame
-
- def get_title(self, session):
- return "Stop"
-
class GetLimits(CuminAction):
def do_invoke(self, negotiator):
self.lim = dict()