> On May 3, 2016, 4:09 p.m., Matt wrote:
> > The functionality of ServiceAdvisor works as expected. However more
> > clarification is needed on how to use inheritance and override service
> > advisor defined in common-services.
> > For example:
> > HAWQ200ServiceAdvisor is defined under commmon-services. I'd like to
> > override the method getComponentLayoutScheme with some new logic for HDP
> > 2.3 stack. Followed the documentation in
> > ambari-server/src/main/resources/stacks/service_advisor.py but it did not
> > work as expected.
>
> Tim Thorpe wrote:
> Thanks Matt, for finding that issue. There were actually 2 problems.
> The first was with the advisor class naming convention for stack service's
> that contained the service_advisor.py rather than inherit it from
> common-services. It missed the stack version number in the advisor class
> name. The second issue was with the HAWQ and PXF service_advisor.py files
> which added to the stacks directory to the system path to load the
> stacks/service_advisor.py (for the default service advisor). I have modified
> that code to use the same dynamic loading I recommended for service advisor
> inheritance. In other words, I changed it to this:
>
> SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
> STACKS_DIR = os.path.join(SCRIPT_DIR, '../../../stacks/')
> PARENT_FILE = os.path.join(STACKS_DIR, 'service_advisor.py')
>
> try:
> with open(PARENT_FILE, 'rb') as fp:
> service_advisor = imp.load_module('service_advisor', fp, PARENT_FILE,
> ('.py', 'rb', imp.PY_SOURCE))
> except Exception as e:
> traceback.print_exc()
> print "Failed to load parent"
>
> class HAWQ200ServiceAdvisor(service_advisor.ServiceAdvisor):
>
> I presume the reason this change is required is due to a naming conflict
> because all the files are called service_advisor.py.
>
> Tim Thorpe wrote:
> I have also added a comment in stacks/service_advisor.py to look at the
> HAWQ and PXF service advisors for examples on how to create your own service
> advisor.
Thank you Tim for making the updates. We are testing it at the moment...
- Matt
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/44210/#review131579
-----------------------------------------------------------
On May 4, 2016, 7:17 a.m., Tim Thorpe wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/44210/
> -----------------------------------------------------------
>
> (Updated May 4, 2016, 7:17 a.m.)
>
>
> Review request for Ambari, Alexander Denissov, bhuvnesh chaudhary, Jayush
> Luniya, Oleksandr Diachenko, Sumit Mohanty, Srimanth Gunturi, and Yusaku Sako.
>
>
> Bugs: AMBARI-15226
> https://issues.apache.org/jira/browse/AMBARI-15226
>
>
> Repository: ambari
>
>
> Description
> -------
>
> Currently the stack advisor is defined under each stack version such as
> HDP/2.3. The problem with this is that it restricts the services that can be
> added to the stack. If a custom service is to be added, they would need to
> modify the stack advisor. If the configuration recommendation and validation
> can be done at the service level then the custom service could just include
> their own recommendations and validations separately.
>
>
> Diffs
> -----
>
> ambari-server/src/main/assemblies/server.xml e1a4919
>
> ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
> df65010
>
> ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
> 00c8696
>
> ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
> ca1968e
>
> ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
> 6c6fa91
>
> ambari-server/src/main/java/org/apache/ambari/server/stack/CommonServiceDirectory.java
> 636de37
>
> ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
> 356adb1
>
> ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
> b7e09a9
>
> ambari-server/src/main/java/org/apache/ambari/server/stack/StackServiceDirectory.java
> d27e52a
> ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
> 5a2bf84
>
> ambari-server/src/main/resources/common-services/HAWQ/2.0.0/service_advisor.py
> PRE-CREATION
>
> ambari-server/src/main/resources/common-services/PXF/3.0.0/service_advisor.py
> PRE-CREATION
> ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
> 1680f21
> ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
> f475798
> ambari-server/src/main/resources/stacks/service_advisor.py PRE-CREATION
> ambari-server/src/main/resources/stacks/stack_advisor.py 9979e7e
> ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
> 2080c52
>
> Diff: https://reviews.apache.org/r/44210/diff/
>
>
> Testing
> -------
>
> Ran all the non java unit tests.
>
> Total run:945
> Total errors:0
> Total failures:0
>
> Manually configured HAWQ and PXF as part of the HDP 2.3 stack and made sure
> their service advisors were called.
>
>
> Thanks,
>
> Tim Thorpe
>
>