r5645 - trunk/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-01-09 14:53:37 +0000 (Wed, 09 Jan 2013)
New Revision: 5645
Modified:
trunk/cumin/bin/cumin-data
trunk/cumin/bin/cumin-report
trunk/cumin/bin/cumin-web
Log:
Not properly testing for "-h" option in exception handling.
Not testing for early exit (mint == None) in cumin-data shutdown code.
BZ893389
BZ893396
BZ893400
Modified: trunk/cumin/bin/cumin-data
===================================================================
--- trunk/cumin/bin/cumin-data 2013-01-07 21:26:31 UTC (rev 5644)
+++ trunk/cumin/bin/cumin-data 2013-01-09 14:53:37 UTC (rev 5645)
@@ -264,7 +264,7 @@
log.info("Received shutdown signal")
except SystemExit:
- if "--help" not in sys.argv:
+ if "-h" not in sys.argv and "--help" not in sys.argv:
log.error("Error in options")
return_code = CuminErrors.PARSE_ERROR
@@ -317,7 +317,8 @@
# Vacuum is not interruptable and could take a while.
# This call to stop will wait for vacuum to exit
- mint.vacuum_thread.stop()
+ if mint:
+ mint.vacuum_thread.stop()
log.info("about to call logging shutdown")
logging.shutdown()
Modified: trunk/cumin/bin/cumin-report
===================================================================
--- trunk/cumin/bin/cumin-report 2013-01-07 21:26:31 UTC (rev 5644)
+++ trunk/cumin/bin/cumin-report 2013-01-09 14:53:37 UTC (rev 5645)
@@ -241,7 +241,7 @@
log.info("Received shutdown signal")
except SystemExit:
- if "--help" not in sys.argv:
+ if "-h" not in sys.argv and "--help" not in sys.argv:
log.error("Error in options")
return_code = CuminErrors.PARSE_ERROR
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2013-01-07 21:26:31 UTC (rev 5644)
+++ trunk/cumin/bin/cumin-web 2013-01-09 14:53:37 UTC (rev 5645)
@@ -277,7 +277,7 @@
pass
except SystemExit:
- if "--help" not in sys.argv:
+ if "-h" not in sys.argv and "--help" not in sys.argv:
log.error("Error in options")
return_code = CuminErrors.PARSE_ERROR
11 years, 4 months
r5644 - branches/elephant/cumin/python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-01-07 21:26:31 +0000 (Mon, 07 Jan 2013)
New Revision: 5644
Added:
branches/elephant/cumin/python/cumin/module.py
Log:
Ooops, here it is
Added: branches/elephant/cumin/python/cumin/module.py
===================================================================
--- branches/elephant/cumin/python/cumin/module.py (rev 0)
+++ branches/elephant/cumin/python/cumin/module.py 2013-01-07 21:26:31 UTC (rev 5644)
@@ -0,0 +1,23 @@
+import logging
+
+from parsley.loggingex import *
+
+log = logging.getLogger("cumin")
+
+class CuminModule(object):
+ def __init__(self, app, name):
+ self.app = app
+ self.name = name
+ self.tasks = list()
+ log.debug("Init cumin module %s", name )
+ assert not hasattr(app, self.name), self.name
+
+ self.app.modules.append(self)
+ setattr(self.app, self.name, self)
+
+ def init(self):
+ for task in self.tasks:
+ task.init()
+
+ def init_test(self, test):
+ pass
11 years, 4 months
r5643 - in branches/elephant/cumin/python/cumin/user: . grid hadoop
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-01-07 19:56:37 +0000 (Mon, 07 Jan 2013)
New Revision: 5643
Modified:
branches/elephant/cumin/python/cumin/user/grid/main.py
branches/elephant/cumin/python/cumin/user/hadoop/main.py
branches/elephant/cumin/python/cumin/user/main.py
Log:
Fix up the module inclusion code a little more
Modified: branches/elephant/cumin/python/cumin/user/grid/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/user/grid/main.py 2013-01-07 16:17:53 UTC (rev 5642)
+++ branches/elephant/cumin/python/cumin/user/grid/main.py 2013-01-07 19:56:37 UTC (rev 5643)
@@ -1,3 +1,4 @@
+import logging
from cumin.module import CuminModule
from wooly.util import StringCatalog
@@ -11,16 +12,31 @@
def init(self):
super(Module, self).init()
-
- if hasattr(self.app, "user_grid_page") and self.app.user_grid_page:
- page = self.app.user_grid_page
+ # This module (user.grid) requires that the "user" module has been
+ # imported and initialized with a call to user.Module()
+ # CuminModule classes will add themselves to "app" as an attribute
+ # during intialization so we can use that to check...
+ if hasattr(self.app, "user") and self.app.user:
+ user_attr = self.app.user.get_user_attribute()
- o = OverviewFrame(self.app, "overview", page.user)
- page.main.overview = o
- page.main.add_tab(o)
+ o = OverviewFrame(self.app, "overview", user_attr)
+ o.cumin_module = self.name
+ self.app.user.add_to_view(o)
- s = SubmissionsFrame(self.app, "submissions", page.user)
- page.main.submissions = s
- page.main.add_tab(s)
+ s = SubmissionsFrame(self.app, "submissions", user_attr)
+ s.cumin_module = self.name
+ self.app.user.add_to_view(s)
+
+ # The explict setting of frame path values makes this necessary
+ # (search for "main.submissions.submission")
+ # There has to be a way to set those paths programmatically
+ self.app.user.page.main.submissions = s
+
+ else:
+ msg = "Module %s requires that the 'user' module be imported and"\
+ " initialized." % self.name
+ log.error(msg)
+ raise Exception(msg)
+
Modified: branches/elephant/cumin/python/cumin/user/hadoop/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/user/hadoop/main.py 2013-01-07 16:17:53 UTC (rev 5642)
+++ branches/elephant/cumin/python/cumin/user/hadoop/main.py 2013-01-07 19:56:37 UTC (rev 5643)
@@ -1,3 +1,4 @@
+import logging
from cumin.module import CuminModule
from wooly.util import StringCatalog
@@ -5,17 +6,27 @@
from cumin.gridhadoop import GridHadoopFrame
+log = logging.getLogger("cumin")
+
class Module(CuminModule):
def __init__(self, app, name):
super(Module, self).__init__(app, name)
def init(self):
super(Module, self).init()
-
- if hasattr(self.app, "user_grid_page") and self.app.user_grid_page:
+
+ # This module (user.hadoop) requires that the "user" module has been
+ # imported and initialized with a call to user.Module()
+ # CuminModule classes will add themselves to "app" as an attribute
+ # during intialization so we can use that to check...
+ if hasattr(self.app, "user") and self.app.user:
self.frame = GridHadoopFrame(self.app, "userhadoop", check_owner=True)
self.frame.cumin_module = self.name
-
- self.app.user_grid_page.main.gridhadoop = self.frame
- self.app.user_grid_page.main.add_tab(self.frame)
+ self.app.user.add_to_view(self.frame)
+ else:
+ msg = "Module %s requires that the 'user' module be imported and"\
+ " initialized." % self.name
+ log.error(msg)
+ raise Exception(msg)
+
Modified: branches/elephant/cumin/python/cumin/user/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/user/main.py 2013-01-07 16:17:53 UTC (rev 5642)
+++ branches/elephant/cumin/python/cumin/user/main.py 2013-01-07 19:56:37 UTC (rev 5643)
@@ -9,6 +9,12 @@
def init(self):
super(Module, self).init()
- self.app.user_grid_page = MainPage(self.app, "user.html")
- self.app.add_page(self.app.user_grid_page, add_to_link_set=True)
- self.app.user_grid_page.cumin_module = self.name
+ self.page = MainPage(self.app, "user.html")
+ self.page.cumin_module = self.name
+ self.app.add_page(self.page, add_to_link_set=True)
+
+ def add_to_view(self, widget):
+ self.page.main.add_tab(widget)
+
+ def get_user_attribute(self):
+ return self.page.user
11 years, 4 months
r5642 - in branches/elephant/cumin: bin model/access python/cumin python/cumin/account python/cumin/grid python/cumin/gridhadoop python/cumin/inventory python/cumin/messaging python/cumin/user python/cumin/user/grid python/cumin/user/hadoop
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-01-07 16:17:53 +0000 (Mon, 07 Jan 2013)
New Revision: 5642
Added:
branches/elephant/cumin/python/cumin/user/
Removed:
branches/elephant/cumin/python/cumin/usergrid/
Modified:
branches/elephant/cumin/bin/cumin-web
branches/elephant/cumin/model/access/persona.xml
branches/elephant/cumin/python/cumin/account/main.py
branches/elephant/cumin/python/cumin/grid/main.py
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
branches/elephant/cumin/python/cumin/gridhadoop/main.py
branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
branches/elephant/cumin/python/cumin/inventory/main.py
branches/elephant/cumin/python/cumin/main.py
branches/elephant/cumin/python/cumin/messaging/main.py
branches/elephant/cumin/python/cumin/user/grid/main.py
branches/elephant/cumin/python/cumin/user/hadoop/main.py
branches/elephant/cumin/python/cumin/user/main.py
branches/elephant/cumin/python/cumin/user/widgets.py
branches/elephant/cumin/python/cumin/widgets.py
Log:
Move "usergrid" module to "user"
Change app.user to app.default_user to avoid conflict from the module name
Move the module class to its own file
Modified: branches/elephant/cumin/bin/cumin-web
===================================================================
--- branches/elephant/cumin/bin/cumin-web 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/bin/cumin-web 2013-01-07 16:17:53 UTC (rev 5642)
@@ -235,7 +235,7 @@
set_authorize_config(cumin, values, config.get_access_root())
cumin.debug = opts.debug
- cumin.user = values.user
+ cumin.default_user = values.user
cumin.update_interval = values.update_interval
cumin.max_qmf_table_sort = values.max_qmf_table_sort
Modified: branches/elephant/cumin/model/access/persona.xml
===================================================================
--- branches/elephant/cumin/model/access/persona.xml 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/model/access/persona.xml 2013-01-07 16:17:53 UTC (rev 5642)
@@ -5,18 +5,18 @@
<Module name="messaging"/>
<Module name="grid"/>
<Module name="inventory"/>
- <Module name="usergrid"/>
- <Module name="usergrid.grid"/>
+ <Module name="user"/>
+ <Module name="user.grid"/>
<GroupAccess name="nogroup">
<MainPage name="login.html"/>
</GroupAccess>
<GroupAccess name="user">
- <MainPage name="usergrid.html"/>
+ <MainPage name="user.html"/>
<ModuleAccess name="account"/>
- <ModuleAccess name="usergrid"/>
- <ModuleAccess name="usergrid.grid"/>
+ <ModuleAccess name="user"/>
+ <ModuleAccess name="user.grid"/>
</GroupAccess>
<GroupAccess name="admin">
@@ -30,18 +30,18 @@
<Module name="configuration"/>
<Module name="grid"/>
<Module name="inventory"/>
- <Module name="usergrid"/>
- <Module name="usergrid.grid"/>
+ <Module name="user"/>
+ <Module name="user.grid"/>
<GroupAccess name="nogroup">
<MainPage name="login.html"/>
</GroupAccess>
<GroupAccess name="user">
- <MainPage name="usergrid.html"/>
+ <MainPage name="user.html"/>
<ModuleAccess name="account"/>
- <ModuleAccess name="usergrid"/>
- <ModuleAccess name="usergrid.grid"/>
+ <ModuleAccess name="user"/>
+ <ModuleAccess name="user.grid"/>
</GroupAccess>
<GroupAccess name="admin">
@@ -56,20 +56,20 @@
<Module name="grid"/>
<Module name="inventory"/>
<Module name="gridhadoop"/>
- <Module name="usergrid"/>
- <Module name="usergrid.grid"/>
- <Module name="usergrid.hadoop"/>
+ <Module name="user"/>
+ <Module name="user.grid"/>
+ <Module name="user.hadoop"/>
<GroupAccess name="nogroup">
<MainPage name="login.html"/>
</GroupAccess>
<GroupAccess name="user">
- <MainPage name="usergrid.html"/>
+ <MainPage name="user.html"/>
<ModuleAccess name="account"/>
- <ModuleAccess name="usergrid"/>
- <ModuleAccess name="usergrid.grid"/>
- <ModuleAccess name="usergrid.hadoop"/>
+ <ModuleAccess name="user"/>
+ <ModuleAccess name="user.grid"/>
+ <ModuleAccess name="user.hadoop"/>
</GroupAccess>
<GroupAccess name="admin">
@@ -83,18 +83,18 @@
<Module name="configuration"/>
<Module name="inventory"/>
<Module name="gridhadoop"/>
- <Module name="usergrid"/>
- <Module name="usergrid.hadoop"/>
+ <Module name="user"/>
+ <Module name="user.hadoop"/>
<GroupAccess name="nogroup">
<MainPage name="login.html"/>
</GroupAccess>
<GroupAccess name="user">
- <MainPage name="usergrid.html"/>
+ <MainPage name="user.html"/>
<ModuleAccess name="account"/>
- <ModuleAccess name="usergrid"/>
- <ModuleAccess name="usergrid.hadoop"/>
+ <ModuleAccess name="user"/>
+ <ModuleAccess name="user.hadoop"/>
</GroupAccess>
<GroupAccess name="admin">
Modified: branches/elephant/cumin/python/cumin/account/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/account/main.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/account/main.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -1,4 +1,4 @@
-from cumin.main import CuminModule
+from cumin.module import CuminModule
from widgets import LoginPage, AccountPage
class Module(CuminModule):
Modified: branches/elephant/cumin/python/cumin/grid/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/grid/main.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/grid/main.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -2,7 +2,7 @@
from wooly.widgets import *
from wooly.resources import *
-from cumin.main import CuminModule
+from cumin.module import CuminModule
from cumin.objecttask import *
from cumin.util import *
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -152,7 +152,7 @@
if not self.errors.get(session):
binfile = self.binfile.get(session)
- owner = session.app.user
+ owner = session.app.default_user
hadoophost = self.hadoophost.get(session)
count = self.count.get(session)
name_node = self.nameNode.get(session)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -148,7 +148,7 @@
if not self.errors.get(session):
binfile = self.binfile.get(session)
- owner = session.app.user
+ owner = session.app.default_user
hadoophost = self.hadoophost.get(session)
name_node = self.nameNode.get(session)
count = 1
Modified: branches/elephant/cumin/python/cumin/gridhadoop/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/main.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/gridhadoop/main.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -2,7 +2,7 @@
from wooly.widgets import *
from wooly.resources import *
-from cumin.main import CuminModule
+from cumin.module import CuminModule
from cumin.widgets import *
from cumin.util import *
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -102,7 +102,7 @@
if not self.errors.get(session):
binfile = self.binfile.get(session)
hadoophost = self.hadoophost.get(session)
- owner = session.app.user
+ owner = session.app.default_user
self.task.invoke(session, None, (binfile, owner, hadoophost))
self.task.exit_with_redirect(session, url)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -148,7 +148,7 @@
if not self.errors.get(session):
binfile = self.binfile.get(session)
- owner = session.app.user
+ owner = session.app.default_user
hadoophost = self.hadoophost.get(session)
count = self.count.get(session)
job_tracker = self.jobTracker.get(session)
Modified: branches/elephant/cumin/python/cumin/inventory/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/inventory/main.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/inventory/main.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -2,7 +2,7 @@
from wooly.widgets import *
from wooly.resources import *
-from cumin.main import CuminModule
+from cumin.module import CuminModule
from cumin.widgets import *
from cumin.util import *
Modified: branches/elephant/cumin/python/cumin/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/main.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/main.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -17,7 +17,6 @@
from server import *
from session import *
from sqladapter import *
-from user import *
from util import *
from widgets import *
from authenticator import *
@@ -51,7 +50,9 @@
self.ldap_tls_cacertdir = ""
self.ldap_tls_cacertfile = ""
- model_dir = [os.path.join(self.home, x) for x in ("model/admin", "model", "model/plumage")]
+ model_dir = [os.path.join(self.home, x) for x in ("model/admin",
+ "model",
+ "model/plumage")]
self.model = CuminModel(self, model_dir)
self.session = CuminSession(self, broker_uris)
@@ -77,7 +78,7 @@
self.tasks = list()
- self.user = None
+ self.default_user = None
self.operator_email = None
self.update_interval = 10
self.max_qmf_table_sort = 1000
@@ -340,24 +341,6 @@
self.request_disk = 0
self.request_disk_vm = 0
-class CuminModule(object):
- def __init__(self, app, name):
- self.app = app
- self.name = name
- self.tasks = list()
- log.debug("Init cumin module %s", name )
- assert not hasattr(app, self.name), self.name
-
- self.app.modules.append(self)
- setattr(self.app, self.name, self)
-
- def init(self):
- for task in self.tasks:
- task.init()
-
- def init_test(self, test):
- pass
-
class GridMainView(CuminMainView):
def __init__(self, app, name):
super(GridMainView, self).__init__(app, name)
Modified: branches/elephant/cumin/python/cumin/messaging/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/messaging/main.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/messaging/main.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -2,7 +2,7 @@
from wooly.widgets import *
from wooly.resources import *
-from cumin.main import CuminModule
+from cumin.module import CuminModule
from cumin.util import *
from broker import *
Modified: branches/elephant/cumin/python/cumin/user/grid/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/usergrid/grid/main.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/user/grid/main.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -1,9 +1,9 @@
-from cumin.main import CuminModule
+from cumin.module import CuminModule
from wooly.util import StringCatalog
strings = StringCatalog(__file__)
-from cumin.usergrid.widgets import *
+from cumin.user.widgets import *
class Module(CuminModule):
def __init__(self, app, name):
Modified: branches/elephant/cumin/python/cumin/user/hadoop/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/usergrid/hadoop/main.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/user/hadoop/main.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -1,4 +1,4 @@
-from cumin.main import CuminModule
+from cumin.module import CuminModule
from wooly.util import StringCatalog
strings = StringCatalog(__file__)
@@ -13,7 +13,7 @@
super(Module, self).init()
if hasattr(self.app, "user_grid_page") and self.app.user_grid_page:
- self.frame = GridHadoopFrame(self.app, "usergridhadoop", check_owner=True)
+ self.frame = GridHadoopFrame(self.app, "userhadoop", check_owner=True)
self.frame.cumin_module = self.name
self.app.user_grid_page.main.gridhadoop = self.frame
Modified: branches/elephant/cumin/python/cumin/user/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/usergrid/main.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/user/main.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -1,4 +1,4 @@
-from cumin.main import CuminModule
+from cumin.module import CuminModule
from cumin.util import *
from widgets import *
@@ -9,6 +9,6 @@
def init(self):
super(Module, self).init()
- self.app.user_grid_page = MainPage(self.app, "usergrid.html")
+ self.app.user_grid_page = MainPage(self.app, "user.html")
self.app.add_page(self.app.user_grid_page, add_to_link_set=True)
self.app.user_grid_page.cumin_module = self.name
Modified: branches/elephant/cumin/python/cumin/user/widgets.py
===================================================================
--- branches/elephant/cumin/python/cumin/usergrid/widgets.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/user/widgets.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -18,7 +18,7 @@
import main
strings = StringCatalog(__file__)
-log = logging.getLogger("cumin.usergrid.widgets")
+log = logging.getLogger("cumin.user.widgets")
class MainPage(CuminPage, ModeSet):
def __init__(self, app, name):
Modified: branches/elephant/cumin/python/cumin/widgets.py
===================================================================
--- branches/elephant/cumin/python/cumin/widgets.py 2013-01-04 23:30:15 UTC (rev 5641)
+++ branches/elephant/cumin/python/cumin/widgets.py 2013-01-07 16:17:53 UTC (rev 5642)
@@ -12,7 +12,6 @@
from widgets import *
from formats import *
from task import *
-from user import *
from util import *
import time
@@ -1318,8 +1317,8 @@
if login.created > when:
return True
- elif self.app.auth_proxy or self.app.user:
- username = self.app.user
+ elif self.app.auth_proxy or self.app.default_user:
+ username = self.app.default_user
# proxy user overrides app defined user
if self.app.auth_proxy:
try:
11 years, 4 months
r5641 - in branches/elephant/cumin: model/access python/cumin/usergrid python/cumin/usergrid/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-01-04 23:30:15 +0000 (Fri, 04 Jan 2013)
New Revision: 5641
Added:
branches/elephant/cumin/python/cumin/usergrid/grid/
branches/elephant/cumin/python/cumin/usergrid/grid/__init__.py
branches/elephant/cumin/python/cumin/usergrid/grid/main.py
Modified:
branches/elephant/cumin/model/access/persona.xml
branches/elephant/cumin/python/cumin/usergrid/widgets.py
Log:
Modify usergrid module to just set up an empty page.
Add usergrid.grid as a submodule that adds user grid ui,
distinct from usergrid.hadoop to set up hadoop ui.
More refinement comming..likely rename usergrid to "user"
and add auto initialization of "package" when a persona
imports "package.module".
Modified: branches/elephant/cumin/model/access/persona.xml
===================================================================
--- branches/elephant/cumin/model/access/persona.xml 2013-01-04 21:47:12 UTC (rev 5640)
+++ branches/elephant/cumin/model/access/persona.xml 2013-01-04 23:30:15 UTC (rev 5641)
@@ -6,6 +6,7 @@
<Module name="grid"/>
<Module name="inventory"/>
<Module name="usergrid"/>
+ <Module name="usergrid.grid"/>
<GroupAccess name="nogroup">
<MainPage name="login.html"/>
@@ -15,6 +16,7 @@
<MainPage name="usergrid.html"/>
<ModuleAccess name="account"/>
<ModuleAccess name="usergrid"/>
+ <ModuleAccess name="usergrid.grid"/>
</GroupAccess>
<GroupAccess name="admin">
@@ -29,6 +31,7 @@
<Module name="grid"/>
<Module name="inventory"/>
<Module name="usergrid"/>
+ <Module name="usergrid.grid"/>
<GroupAccess name="nogroup">
<MainPage name="login.html"/>
@@ -38,6 +41,7 @@
<MainPage name="usergrid.html"/>
<ModuleAccess name="account"/>
<ModuleAccess name="usergrid"/>
+ <ModuleAccess name="usergrid.grid"/>
</GroupAccess>
<GroupAccess name="admin">
@@ -53,6 +57,7 @@
<Module name="inventory"/>
<Module name="gridhadoop"/>
<Module name="usergrid"/>
+ <Module name="usergrid.grid"/>
<Module name="usergrid.hadoop"/>
<GroupAccess name="nogroup">
@@ -63,6 +68,7 @@
<MainPage name="usergrid.html"/>
<ModuleAccess name="account"/>
<ModuleAccess name="usergrid"/>
+ <ModuleAccess name="usergrid.grid"/>
<ModuleAccess name="usergrid.hadoop"/>
</GroupAccess>
Added: branches/elephant/cumin/python/cumin/usergrid/grid/__init__.py
===================================================================
--- branches/elephant/cumin/python/cumin/usergrid/grid/__init__.py (rev 0)
+++ branches/elephant/cumin/python/cumin/usergrid/grid/__init__.py 2013-01-04 23:30:15 UTC (rev 5641)
@@ -0,0 +1 @@
+from main import Module
Added: branches/elephant/cumin/python/cumin/usergrid/grid/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/usergrid/grid/main.py (rev 0)
+++ branches/elephant/cumin/python/cumin/usergrid/grid/main.py 2013-01-04 23:30:15 UTC (rev 5641)
@@ -0,0 +1,26 @@
+from cumin.main import CuminModule
+from wooly.util import StringCatalog
+
+strings = StringCatalog(__file__)
+
+from cumin.usergrid.widgets import *
+
+class Module(CuminModule):
+ def __init__(self, app, name):
+ super(Module, self).__init__(app, name)
+
+ def init(self):
+ super(Module, self).init()
+
+ if hasattr(self.app, "user_grid_page") and self.app.user_grid_page:
+
+ page = self.app.user_grid_page
+
+ o = OverviewFrame(self.app, "overview", page.user)
+ page.main.overview = o
+ page.main.add_tab(o)
+
+ s = SubmissionsFrame(self.app, "submissions", page.user)
+ page.main.submissions = s
+ page.main.add_tab(s)
+
Modified: branches/elephant/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- branches/elephant/cumin/python/cumin/usergrid/widgets.py 2013-01-04 21:47:12 UTC (rev 5640)
+++ branches/elephant/cumin/python/cumin/usergrid/widgets.py 2013-01-04 23:30:15 UTC (rev 5641)
@@ -40,12 +40,6 @@
def __init__(self, app, name, user):
super(MainView, self).__init__(app, name)
- self.overview = OverviewFrame(app, "overview", user)
- self.add_tab(self.overview)
-
- self.submissions = SubmissionsFrame(app, "submissions", user)
- self.add_tab(self.submissions)
-
class OverviewFrame(CuminFrame):
def __init__(self, app, name, user):
super(OverviewFrame, self).__init__(app, name)
11 years, 4 months
r5640 - in branches/elephant/cumin: model/access python/cumin python/cumin/gridhadoop python/cumin/usergrid python/cumin/usergrid/hadoop
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-01-04 21:47:12 +0000 (Fri, 04 Jan 2013)
New Revision: 5640
Added:
branches/elephant/cumin/python/cumin/usergrid/hadoop/
branches/elephant/cumin/python/cumin/usergrid/hadoop/__init__.py
branches/elephant/cumin/python/cumin/usergrid/hadoop/main.py
Modified:
branches/elephant/cumin/model/access/persona.xml
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
branches/elephant/cumin/python/cumin/gridhadoop/main.py
branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
branches/elephant/cumin/python/cumin/main.py
branches/elephant/cumin/python/cumin/task.py
Log:
Add a persona for "hadoop" only.
Add the hadoop tab under the "user" interface.
For the user interface, filter nodes by user.
Allow dynamic imports associated with persona to import submodules for better organization.
Note, hadoop-only user interface doesn't quite work, it needs subsequent module reorg.
Modified: branches/elephant/cumin/model/access/persona.xml
===================================================================
--- branches/elephant/cumin/model/access/persona.xml 2013-01-04 14:27:56 UTC (rev 5639)
+++ branches/elephant/cumin/model/access/persona.xml 2013-01-04 21:47:12 UTC (rev 5640)
@@ -51,8 +51,34 @@
<Module name="configuration"/>
<Module name="grid"/>
<Module name="inventory"/>
+ <Module name="gridhadoop"/>
<Module name="usergrid"/>
+ <Module name="usergrid.hadoop"/>
+
+ <GroupAccess name="nogroup">
+ <MainPage name="login.html"/>
+ </GroupAccess>
+
+ <GroupAccess name="user">
+ <MainPage name="usergrid.html"/>
+ <ModuleAccess name="account"/>
+ <ModuleAccess name="usergrid"/>
+ <ModuleAccess name="usergrid.hadoop"/>
+ </GroupAccess>
+
+ <GroupAccess name="admin">
+ <MainPage name="index.html"/>
+ <ModuleAccess name="*"/>
+ </GroupAccess>
+ </Persona>
+
+ <Persona name="hadoop" auth="True">
+ <Module name="account"/>
+ <Module name="configuration"/>
+ <Module name="inventory"/>
<Module name="gridhadoop"/>
+ <Module name="usergrid"/>
+ <Module name="usergrid.hadoop"/>
<GroupAccess name="nogroup">
<MainPage name="login.html"/>
@@ -62,6 +88,7 @@
<MainPage name="usergrid.html"/>
<ModuleAccess name="account"/>
<ModuleAccess name="usergrid"/>
+ <ModuleAccess name="usergrid.hadoop"/>
</GroupAccess>
<GroupAccess name="admin">
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-04 14:27:56 UTC (rev 5639)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -18,15 +18,15 @@
return results
class DataNodeSelector(ObjectSelector):
- def __init__(self, app, name):
+ def __init__(self, app, name, check_owner=False):
cls = app.model.com_redhat_cumin_grid_hadoop.DataNode
super(DataNodeSelector, self).__init__(app, name, cls)
self.add_search_filter(self.table.id_col)
- self.table.adapter = DataNodeAdapter(app, cls)
+ self.table.adapter = DataNodeAdapter(app, cls, check_owner)
- task = DataNodeCreate(app)
+ task = DataNodeCreate(app, name + ".create")
link = TaskLink(app, "dataNode_create", task)
self.links.add_child(link)
@@ -93,8 +93,8 @@
return "Remove data nodes"
class DataNodeCreate(Task):
- def __init__(self, app):
- super(DataNodeCreate, self).__init__(app)
+ def __init__(self, app, name):
+ super(DataNodeCreate, self).__init__(app, name)
cls = app.model.com_redhat_cumin_grid_hadoop.DataNode
self.form = DataNodeCreateForm(app, self.name, self, cls)
@@ -172,4 +172,4 @@
return "Number of data nodes to start"
-
\ No newline at end of file
+
Modified: branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2013-01-04 14:27:56 UTC (rev 5639)
+++ branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -19,10 +19,11 @@
return int(float(x.id) - float(y.id))
class HadoopAdapter(ObjectQmfAdapter):
- def __init__(self, app, cls):
+ def __init__(self, app, cls, check_owner=False):
super(HadoopAdapter, self).__init__(app, cls)
self.cls = cls
-
+ self.check_owner = check_owner
+
def get_count(self, values):
data = self.do_get_data(values)
return len(data)
@@ -55,10 +56,10 @@
return field_data
def get_owner_filter(self, session):
- login = session.client_session.attributes["login_session"]
- owner_list = None
- if "admin" not in login.group:
- owner_list = ["condor", self.app.user] #condor is a temporary hack
+ if self.check_owner:
+ owner_list = ["condor", session.get_user().name] #condor is a temporary hack
+ else:
+ owner_list = None
return owner_list
class HadoopNodeDeleteForm(ObjectSelectorTaskForm):
@@ -237,4 +238,4 @@
days = value / 86400
hours = (value / 3600) - (days * 24)
minutes = (value / 60) - (days * 1440) - (hours * 60)
- return '%02d:%02d:%02d' % (days, hours, minutes)
\ No newline at end of file
+ return '%02d:%02d:%02d' % (days, hours, minutes)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-04 14:27:56 UTC (rev 5639)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -18,15 +18,15 @@
return results
class JobTrackerSelector(ObjectSelector):
- def __init__(self, app, name):
+ def __init__(self, app, name, check_owner=False):
cls = app.model.com_redhat_cumin_grid_hadoop.JobTracker
super(JobTrackerSelector, self).__init__(app, name, cls)
self.add_search_filter(self.table.id_col)
- self.table.adapter = JobTrackerAdapter(app, cls)
+ self.table.adapter = JobTrackerAdapter(app, cls, check_owner)
- task = JobTrackerCreate(app)
+ task = JobTrackerCreate(app, name + ".create")
link = TaskLink(app, "jobTracker_create", task)
self.links.add_child(link)
@@ -94,8 +94,8 @@
return "Remove job trackers"
class JobTrackerCreate(Task):
- def __init__(self, app):
- super(JobTrackerCreate, self).__init__(app)
+ def __init__(self, app, name):
+ super(JobTrackerCreate, self).__init__(app, name)
cls = app.model.com_redhat_cumin_grid_hadoop.JobTracker
self.form = JobTrackerCreateForm(app, self.name, self, cls)
@@ -156,4 +156,4 @@
self.task.exit_with_redirect(session, url)
def render_title(self, session):
- return "Create a job tracker"
\ No newline at end of file
+ return "Create a job tracker"
Modified: branches/elephant/cumin/python/cumin/gridhadoop/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/main.py 2013-01-04 14:27:56 UTC (rev 5639)
+++ branches/elephant/cumin/python/cumin/gridhadoop/main.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -26,18 +26,19 @@
self.app.main_page.main.gridhadoop = self.frame
self.app.main_page.main.add_tab(self.frame)
+
class GridHadoopFrame(CuminFrame):
- def __init__(self, app, name):
+ def __init__(self, app, name, check_owner=False):
super(GridHadoopFrame, self).__init__(app, name)
- self.view = GridHadoopView(app, "view")
+ self.view = GridHadoopView(app, name + ".view", check_owner)
self.add_mode(self.view)
def render_title(self, session):
return "Grid-hadoop"
class GridHadoopView(Widget):
- def __init__(self, app, name):
+ def __init__(self, app, name, check_owner):
super(GridHadoopView, self).__init__(app, name)
# heading = self.Heading(app, "heading")
@@ -46,8 +47,8 @@
self.tabs = TabbedModeSet(app, "childtabs")
self.add_child(self.tabs)
- self.tabs.add_tab(NameNodeSelector(app, "namenodes"))
- self.tabs.add_tab(DataNodeSelector(app, "datanodes"))
- self.tabs.add_tab(JobTrackerSelector(app, "jobtrackers"))
- self.tabs.add_tab(TaskTrackerSelector(app, "tasktrackers"))
-
\ No newline at end of file
+ self.tabs.add_tab(NameNodeSelector(app, name + ".namenodes", check_owner))
+ self.tabs.add_tab(DataNodeSelector(app, name + ".datanodes", check_owner))
+ self.tabs.add_tab(JobTrackerSelector(app, name + ".jobtrackers", check_owner))
+ self.tabs.add_tab(TaskTrackerSelector(app, name + ".tasktrackers", check_owner))
+
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2013-01-04 14:27:56 UTC (rev 5639)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -17,15 +17,15 @@
return results
class NameNodeSelector(ObjectSelector):
- def __init__(self, app, name):
+ def __init__(self, app, name, check_owner=False):
cls = app.model.com_redhat_cumin_grid_hadoop.NameNode
super(NameNodeSelector, self).__init__(app, name, cls)
self.add_search_filter(self.table.id_col)
- self.table.adapter = NameNodeAdapter(app, cls)
+ self.table.adapter = NameNodeAdapter(app, cls, check_owner)
- task = NameNodeCreate(app)
+ task = NameNodeCreate(app, name + ".create")
link = TaskLink(app, "nameNode_create", task)
self.links.add_child(link)
@@ -59,8 +59,8 @@
self.add_column(self.owner_col)
class NameNodeCreate(Task):
- def __init__(self, app):
- super(NameNodeCreate, self).__init__(app)
+ def __init__(self, app, name):
+ super(NameNodeCreate, self).__init__(app, name)
cls = app.model.com_redhat_cumin_grid_hadoop.NameNode
self.form = NameNodeCreateForm(app, self.name, self, cls)
@@ -142,4 +142,4 @@
def render_title(self, session):
return "Remove name nodes"
-
\ No newline at end of file
+
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-04 14:27:56 UTC (rev 5639)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -18,15 +18,15 @@
return results
class TaskTrackerSelector(ObjectSelector):
- def __init__(self, app, name):
+ def __init__(self, app, name, check_owner=False):
cls = app.model.com_redhat_cumin_grid_hadoop.TaskTracker
super(TaskTrackerSelector, self).__init__(app, name, cls)
self.add_search_filter(self.table.id_col)
- self.table.adapter = TaskTrackerAdapter(app, cls)
+ self.table.adapter = TaskTrackerAdapter(app, cls, check_owner)
- task = TaskTrackerCreate(app)
+ task = TaskTrackerCreate(app, name + ".create")
link = TaskLink(app, "taskTracker_create", task)
self.links.add_child(link)
@@ -91,8 +91,8 @@
return "Remove task trackers"
class TaskTrackerCreate(Task):
- def __init__(self, app):
- super(TaskTrackerCreate, self).__init__(app)
+ def __init__(self, app, name):
+ super(TaskTrackerCreate, self).__init__(app, name)
cls = app.model.com_redhat_cumin_grid_hadoop.TaskTracker
self.form = TaskTrackerCreateForm(app, self.name, self, cls)
@@ -233,4 +233,4 @@
def render_item_selected_attr(self, session, item):
if item == self.param.get(session):
- return "selected=\"selected\""
\ No newline at end of file
+ return "selected=\"selected\""
Modified: branches/elephant/cumin/python/cumin/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/main.py 2013-01-04 14:27:56 UTC (rev 5639)
+++ branches/elephant/cumin/python/cumin/main.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -165,7 +165,14 @@
# persona (from persona.py)
for name in modules:
try:
- m = __import__(name, globals())
+ # Note, using the "from" list here really isn't necessary
+ # in order to access m.Module, however the presence of a
+ # "from" list causes __import__ to import submodules
+ # when name contains ".", instead of just the top level
+ # package. In other words, without the from list, an
+ # import of "foo.bar" would just return the "foo" module.
+ # Go figure.
+ m = __import__(name, globals(), locals(), ["Module"])
m.Module(self, name)
except ImportError:
import traceback
@@ -376,7 +383,7 @@
self.main = main_view
self.add_mode(self.main)
self.set_default_frame(self.main)
- self.cumin_module = ["messaging", "grid"]
+ self.cumin_module = ["messaging", "grid", "gridhadoop"]
self.page_html_class = "Cumin"
Modified: branches/elephant/cumin/python/cumin/task.py
===================================================================
--- branches/elephant/cumin/python/cumin/task.py 2013-01-04 14:27:56 UTC (rev 5639)
+++ branches/elephant/cumin/python/cumin/task.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -14,9 +14,12 @@
strings = StringCatalog(__file__)
class Task(object):
- def __init__(self, app):
+ def __init__(self, app, name=None):
self.app = app
- self.name = self.__class__.__name__
+ if name is None:
+ self.name = self.__class__.__name__
+ else:
+ self.name = name
self.form = None
self.app.tasks.append(self)
Added: branches/elephant/cumin/python/cumin/usergrid/hadoop/__init__.py
===================================================================
--- branches/elephant/cumin/python/cumin/usergrid/hadoop/__init__.py (rev 0)
+++ branches/elephant/cumin/python/cumin/usergrid/hadoop/__init__.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -0,0 +1 @@
+from main import Module
Added: branches/elephant/cumin/python/cumin/usergrid/hadoop/main.py
===================================================================
--- branches/elephant/cumin/python/cumin/usergrid/hadoop/main.py (rev 0)
+++ branches/elephant/cumin/python/cumin/usergrid/hadoop/main.py 2013-01-04 21:47:12 UTC (rev 5640)
@@ -0,0 +1,21 @@
+from cumin.main import CuminModule
+from wooly.util import StringCatalog
+
+strings = StringCatalog(__file__)
+
+from cumin.gridhadoop import GridHadoopFrame
+
+class Module(CuminModule):
+ def __init__(self, app, name):
+ super(Module, self).__init__(app, name)
+
+ def init(self):
+ super(Module, self).init()
+
+ if hasattr(self.app, "user_grid_page") and self.app.user_grid_page:
+ self.frame = GridHadoopFrame(self.app, "usergridhadoop", check_owner=True)
+ self.frame.cumin_module = self.name
+
+ self.app.user_grid_page.main.gridhadoop = self.frame
+ self.app.user_grid_page.main.add_tab(self.frame)
+
11 years, 4 months
r5639 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-04 14:27:56 +0000 (Fri, 04 Jan 2013)
New Revision: 5639
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
Log:
Changing width of count field, default of 15 was more than a bit excessive.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-03 21:21:59 UTC (rev 5638)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-04 14:27:56 UTC (rev 5639)
@@ -166,6 +166,7 @@
def __init__(self, app, name):
super(DataNodeCreateForm.CountField, self).__init__(app, name)
self.input.param.default = 1
+ self.input.size = 4
def render_title(self, session):
return "Number of data nodes to start"
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-03 21:21:59 UTC (rev 5638)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-04 14:27:56 UTC (rev 5639)
@@ -162,6 +162,7 @@
def __init__(self, app, name):
super(TaskTrackerCreateForm.CountField, self).__init__(app, name)
self.input.param.default = 1
+ self.input.size = 4
def render_title(self, session):
return "Number of task trackers to start"
11 years, 4 months
r5638 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-03 21:21:59 +0000 (Thu, 03 Jan 2013)
New Revision: 5638
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
Log:
Defaulting count to 1
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-03 20:54:35 UTC (rev 5637)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-03 21:21:59 UTC (rev 5638)
@@ -159,6 +159,10 @@
return "Create task trackers"
class CountField(IntegerField):
+ def __init__(self, app, name):
+ super(TaskTrackerCreateForm.CountField, self).__init__(app, name)
+ self.input.param.default = 1
+
def render_title(self, session):
return "Number of task trackers to start"
11 years, 4 months
r5637 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-03 20:54:35 +0000 (Thu, 03 Jan 2013)
New Revision: 5637
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
Log:
Removing not-yet-ready-for-primetime smart defaulting of form values.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-03 20:46:08 UTC (rev 5636)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-03 20:54:35 UTC (rev 5637)
@@ -155,7 +155,6 @@
owner = session.app.user
hadoophost = self.hadoophost.get(session)
count = self.count.get(session)
- self.count.input.param.default = count
name_node = self.nameNode.get(session)
self.task.invoke(session, None, (binfile, owner, hadoophost, count, name_node))
self.task.exit_with_redirect(session, url)
11 years, 4 months
r5636 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-03 20:46:08 +0000 (Thu, 03 Jan 2013)
New Revision: 5636
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
Log:
Now filtering the get* methods by owner only when the current user is not an admin (still using the "condor" hack for now).
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-03 16:48:40 UTC (rev 5635)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-03 20:46:08 UTC (rev 5636)
@@ -13,7 +13,8 @@
class DataNodeAdapter(HadoopAdapter):
def get_sage_results(self, values):
- results = self.app.remote.get_data_node_list(owner=["condor", self.app.user]) #condor is a temporary hack
+ owner_filter = self.get_owner_filter(values['session'])
+ results = self.app.remote.get_data_node_list(owner=owner_filter)
return results
class DataNodeSelector(ObjectSelector):
@@ -154,6 +155,7 @@
owner = session.app.user
hadoophost = self.hadoophost.get(session)
count = self.count.get(session)
+ self.count.input.param.default = count
name_node = self.nameNode.get(session)
self.task.invoke(session, None, (binfile, owner, hadoophost, count, name_node))
self.task.exit_with_redirect(session, url)
@@ -162,6 +164,10 @@
return "Create data nodes"
class CountField(IntegerField):
+ def __init__(self, app, name):
+ super(DataNodeCreateForm.CountField, self).__init__(app, name)
+ self.input.param.default = 1
+
def render_title(self, session):
return "Number of data nodes to start"
Modified: branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2013-01-03 16:48:40 UTC (rev 5635)
+++ branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2013-01-03 20:46:08 UTC (rev 5636)
@@ -53,6 +53,13 @@
val = record.ref.id
field_data.append(val)
return field_data
+
+ def get_owner_filter(self, session):
+ login = session.client_session.attributes["login_session"]
+ owner_list = None
+ if "admin" not in login.group:
+ owner_list = ["condor", self.app.user] #condor is a temporary hack
+ return owner_list
class HadoopNodeDeleteForm(ObjectSelectorTaskForm):
def __init__(self, app, name, task, cls):
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-03 16:48:40 UTC (rev 5635)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-03 20:46:08 UTC (rev 5636)
@@ -13,7 +13,8 @@
class JobTrackerAdapter(HadoopAdapter):
def get_sage_results(self, values):
- results = self.app.remote.get_job_tracker_list(owner=["condor", self.app.user]) #condor is a temporary hack
+ owner_filter = self.get_owner_filter(values['session'])
+ results = self.app.remote.get_job_tracker_list(owner=owner_filter)
return results
class JobTrackerSelector(ObjectSelector):
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2013-01-03 16:48:40 UTC (rev 5635)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2013-01-03 20:46:08 UTC (rev 5636)
@@ -12,7 +12,8 @@
class NameNodeAdapter(HadoopAdapter):
def get_sage_results(self, values):
- results = self.app.remote.get_name_node_list(owner=["condor", self.app.user]) #condor is a temporary hack
+ owner_filter = self.get_owner_filter(values['session'])
+ results = self.app.remote.get_name_node_list(owner=owner_filter)
return results
class NameNodeSelector(ObjectSelector):
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-03 16:48:40 UTC (rev 5635)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-03 20:46:08 UTC (rev 5636)
@@ -13,7 +13,8 @@
class TaskTrackerAdapter(HadoopAdapter):
def get_sage_results(self, values):
- results = self.app.remote.get_task_tracker_list(owner=["condor", self.app.user]) #condor is a temporary hack
+ owner_filter = self.get_owner_filter(values['session'])
+ results = self.app.remote.get_task_tracker_list(owner=owner_filter)
return results
class TaskTrackerSelector(ObjectSelector):
11 years, 4 months