> On Sept. 12, 2017, 9:07 a.m., Dmytro Grinenko wrote:
> > ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
> > Lines 125 (patched)
> > <https://reviews.apache.org/r/62226/diff/2/?file=1819598#file1819598line125>
> >
> >     According to code below, this function would be called 
> > "get_supported_packages" each time in for cycle and would do/return the 
> > same. Can we optimize this?
> 
> Jonathan Hurley wrote:
>     Yes, I thought about the fact it's called a lot. The problem is that 
> caching the result wouldn't work since we don't know when to clear the cache. 
> How would you recommend that we optimize this?
> 
> Dmytro Grinenko wrote:
>     No need to cache it in the script-life cycle, it is enough only for 
> function-call lifetime, as i dont see any change, which may cause output 
> change per function call.
>     
>     so it could be like:
>     
>     def is_package_supported(package, pkgs=None):
>       if not pkgs:
>         pkgs = get_supported_packages()
>     
>       ..........
>     
>     
>     def get_packages():
>     
>      ...
>     
>      pkgs = get_supported_packages()
>     
>      for .........:
>           if not is_package_supported(package, pkgs)
>              .........

Ah, I see - fair enough. I'll make the change.


- Jonathan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62226/#review185174
-----------------------------------------------------------


On Sept. 11, 2017, 3:43 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62226/
> -----------------------------------------------------------
> 
> (Updated Sept. 11, 2017, 3:43 p.m.)
> 
> 
> Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.
> 
> 
> Bugs: AMBARI-21931
>     https://issues.apache.org/jira/browse/AMBARI-21931
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> There are several "INVALID" types listed in the stack_packages.json file. 
> These were placeholders that need to be updated with the packages exposed by 
> the stack-select tool. 
> 
> {code}
> ...
>         "HDFS_CLIENT": {
>           "STACK-SELECT-PACKAGE": "hadoop-client",
>           "INSTALL": [
>             "hadoop-client"
>           ],
>           "PATCH": [
>             "INVALID"
>           ],
>           "STANDARD": [
>             "hadoop-client"
>           ]
>         },
> ...
> {code}
> 
> 
> Diffs
> -----
> 
>   
> ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
>  eac1bef13c 
>   
> ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
>  704fb54293 
>   ambari-server/src/test/python/TestStackSelect.py 3d4e5b6a43 
>   ambari-server/src/test/python/stacks/utils/RMFTestCase.py 0341092b69 
> 
> 
> Diff: https://reviews.apache.org/r/62226/diff/2/
> 
> 
> Testing
> -------
> 
> ----------------------------------------------------------------------
> Total run:1191
> Total errors:0
> Total failures:0
> OK
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 58.379 s
> [INFO] Finished at: 2017-09-11T16:25:26-04:00
> [INFO] Final Memory: 21M/619M
> [INFO] 
> ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>

Reply via email to