> On Sept. 12, 2017, 1:07 p.m., Dmytro Grinenko wrote:
> > ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
> > Lines 145 (patched)
> > <https://reviews.apache.org/r/62226/diff/2/?file=1819598#file1819598line145>
> >
> >     while map function is present in python, using generators is more 
> > prefferable
> 
> Jonathan Hurley wrote:
>     I've never used generators before - the syntax looks a bit cumbersome for 
> what's needed here. Can you provide an example of what a generator to trim a 
> string would look like?
> 
> Dmytro Grinenko wrote:
>     return (s.strip() for s in stdout.splitlines())    # this would return 
> gerator, which supports iterative interface
>     
>     pros:
>      - actuall method execution would be issues only when you will call 
> iterator, each result would return via "yield" (code would run only once)
>     
>     cons:
>      - this would be not list, so no index accessing and only one cycle
>     
>     return [s.strip() for s in stdout.splitlines()]    # this would return 
> list
>      - this will return list

however for python36, it looks that map is faster that list comphersation :)


- Dmytro


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


On Sept. 11, 2017, 7: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, 7: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