Implement job-types endpoint support methods for CDH plugin

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

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

Partial-Implements: blueprint edp-job-types-endpoint
Change-Id: I7cc9ab01d8e23bdd3c240a2962140460bad2d33a
This commit is contained in:
Trevor McKay 2015-03-17 18:14:28 -04:00
parent 456c559c7d
commit 08233d358b
4 changed files with 33 additions and 0 deletions

View File

@ -57,6 +57,14 @@ class AbstractVersionHandler(object):
def get_edp_engine(self, cluster, job_type): def get_edp_engine(self, cluster, job_type):
return return
@abc.abstractmethod
def get_edp_job_types(self):
return []
@abc.abstractmethod
def get_edp_config_hints(self, job_type):
return {}
@abc.abstractmethod @abc.abstractmethod
def get_open_ports(self, node_group): def get_open_ports(self, node_group):
return return

View File

@ -71,6 +71,19 @@ class CDHPluginProvider(p.ProvisioningPluginBase):
return self._get_version_handler( return self._get_version_handler(
cluster.hadoop_version).get_edp_engine(cluster, job_type) cluster.hadoop_version).get_edp_engine(cluster, job_type)
def get_edp_job_types(self, versions=[]):
res = {}
for vers in self.version_factory.get_versions():
if not versions or vers in versions:
vh = self.version_factory.get_version_handler(vers)
res[vers] = vh.get_edp_job_types()
return res
def get_edp_config_hints(self, job_type, version):
version_handler = (
self.version_factory.get_version_handler(version))
return version_handler.get_edp_config_hints(job_type)
def get_open_ports(self, node_group): def get_open_ports(self, node_group):
return self._get_version_handler( return self._get_version_handler(
node_group.cluster.hadoop_version).get_open_ports(node_group) node_group.cluster.hadoop_version).get_open_ports(node_group)

View File

@ -100,5 +100,11 @@ class VersionHandler(avm.AbstractVersionHandler):
return edp_engine.EdpOozieEngine(cluster) return edp_engine.EdpOozieEngine(cluster)
return None return None
def get_edp_job_types(self):
return edp_engine.EdpOozieEngine.get_supported_job_types()
def get_edp_config_hints(self, job_type):
return edp_engine.EdpOozieEngine.get_possible_job_config(job_type)
def get_open_ports(self, node_group): def get_open_ports(self, node_group):
return dp.get_open_ports(node_group) return dp.get_open_ports(node_group)

View File

@ -109,5 +109,11 @@ class VersionHandler(avm.AbstractVersionHandler):
return edp_engine.EdpOozieEngine(cluster) return edp_engine.EdpOozieEngine(cluster)
return None return None
def get_edp_job_types(self):
return edp_engine.EdpOozieEngine.get_supported_job_types()
def get_edp_config_hints(self, job_type):
return edp_engine.EdpOozieEngine.get_possible_job_config(job_type)
def get_open_ports(self, node_group): def get_open_ports(self, node_group):
return dp.get_open_ports(node_group) return dp.get_open_ports(node_group)