Implement job-types endpoint support methods for Vanilla plugin

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

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

Partial-Implements: blueprint edp-job-types-endpoint
Change-Id: I462541a538e668bc371213598b623ebc67a58fd0
This commit is contained in:
Trevor McKay 2015-03-17 17:01:13 -04:00
parent 456c559c7d
commit 5bdae31f8e
4 changed files with 31 additions and 0 deletions

View File

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

View File

@ -72,6 +72,19 @@ class VanillaProvider(p.ProvisioningPluginBase):
return self._get_version_handler(
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):
return self._get_version_handler(
node_group.cluster.hadoop_version).get_open_ports(node_group)

View File

@ -549,6 +549,12 @@ class VersionHandler(avm.AbstractVersionHandler):
return edp_engine.EdpOozieEngine(cluster)
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):
cluster = node_group.cluster

View File

@ -182,5 +182,11 @@ class VersionHandler(avm.AbstractVersionHandler):
return edp_engine.EdpOozieEngine(cluster)
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):
return c.get_open_ports(node_group)