Implement job-types endpoint support methods for MapR plugin

This change implements the optional methods in the Plugins SPI
to support the job-types endpoint for the MapR plugin.

Config hints at this point are unchanged. Additional work may be
needed to provide config-hints specific to MapR plugin versions.

Partial-Implements: blueprint edp-job-types-endpoint
Change-Id: I8e3919060f12769ffa26d755cf3d8f7d2c839b2f
This commit is contained in:
Trevor McKay 2015-03-24 11:50:31 -04:00
parent d7297357fc
commit d49398cc97
5 changed files with 38 additions and 0 deletions

View File

@ -56,6 +56,14 @@ class AbstractVersionHandler(object):
def get_edp_engine(self, cluster, job_type):
return
@abc.abstractmethod
def get_edp_job_types(self):
return []
@abc.abstractmethod
def get_edp_config_hints(self, job_type):
return {}
@abc.abstractmethod
def get_context(self, cluster, added=None, removed=None):
return

View File

@ -40,6 +40,12 @@ class BaseVersionHandler(vh.AbstractVersionHandler):
return edp.MapROozieJobEngine(cluster)
return None
def get_edp_job_types(self):
return edp.MapROozieJobEngine.get_supported_job_types()
def get_edp_config_hints(self, job_type):
return edp.MapROozieJobEngine.get_possible_job_config(job_type)
def get_services(self):
return self._services

View File

@ -68,6 +68,18 @@ class MapRPlugin(p.ProvisioningPluginBase):
v_handler = self._get_handler(cluster.hadoop_version)
return v_handler.get_edp_engine(cluster, job_type)
def get_edp_job_types(self, versions=[]):
res = {}
for vers in self.get_versions():
if not versions or vers in versions:
vh = self._get_handler(vers)
res[vers] = vh.get_edp_job_types()
return res
def get_edp_config_hints(self, job_type, version):
v_handler = self._get_handler(version)
return v_handler.get_edp_config_hints(job_type)
def get_open_ports(self, node_group):
v_handler = self._get_handler(node_group.cluster.hadoop_version)
return v_handler.get_open_ports(node_group)

View File

@ -48,3 +48,9 @@ class VersionHandler(bvh.BaseVersionHandler):
if job_type in edp_engine.MapRSparkEngine.get_supported_job_types():
return edp_engine.MapRSparkEngine(cluster)
return None
def get_edp_job_types(self):
return edp_engine.MapRSparkEngine.get_supported_job_types()
def get_edp_config_hints(self, job_type):
return edp_engine.MapRSparkEngine.get_possible_job_config(job_type)

View File

@ -73,3 +73,9 @@ class VersionHandler(bvh.BaseVersionHandler):
if job_type in edp.MapR3OozieJobEngine.get_supported_job_types():
return edp.MapR3OozieJobEngine(cluster)
return None
def get_edp_job_types(self):
return edp.MapR3OozieJobEngine.get_supported_job_types()
def get_edp_config_hints(self, job_type):
return edp.MapR3OozieJobEngine.get_possible_job_config(job_type)