Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Kirill Zaitsev
FYI: we’re in the process of doing almost that =)  Here is a link for yaql doc commits  https://review.openstack.org/#/q/status:open+project:openstack/yaql+branch:master+topic:yaqldocs We plan to have it finished and published in time for N release and Barcelona =) --  Kirill Zaitsev Murano

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Zane Bitter
On 30/08/16 12:18, Jiří Stránský wrote: Hmm yea that's strange, because YAQL has a test case for reduce() with 5 items: https://github.com/openstack/yaql/blob/f71a0305089997cbfa5ff00f660920711b04f39e/yaql/tests/test_queries.py#L337-L339 If YAQL people are reading this, I suggest you should

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Stan Lagun
There is a bug in how yaql interprets its 3rd argument (aggregator). It was supposed to be a function to aggregate values within each group but instead was applied to the outcome of groupBy. I submitted a fix for this: https://review.openstack.org/363191. Though I'm not sure we can release new

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Thomas Herve
On Tue, Aug 30, 2016 at 6:02 PM, Steven Hardy wrote: > On Tue, Aug 30, 2016 at 04:10:47PM +0200, Jiří Stránský wrote: >> >> On 30.8.2016 10:17, Steven Hardy wrote: >> >> >> >> > Yeah, that gets us closer, but we do need to handle more than one value >> > (list entry) per key,

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Jiří Stránský
On 30.8.2016 18:16, Zane Bitter wrote: On 30/08/16 12:02, Steven Hardy wrote: debug_tripleo2: value: yaql: expression: $.data.l.reduce($1.mergeWith($2)) data: l: - "gnocchi_metricd_node_names": ["overcloud-controller-0",

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Jiří Stránský
On 30.8.2016 18:02, Steven Hardy wrote: On Tue, Aug 30, 2016 at 04:10:47PM +0200, Jiří Stránský wrote: On 30.8.2016 10:17, Steven Hardy wrote: Yeah, that gets us closer, but we do need to handle more than one value (list entry) per key, e.g: data: l: -

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Zane Bitter
On 30/08/16 12:02, Steven Hardy wrote: debug_tripleo2: value: yaql: expression: $.data.l.reduce($1.mergeWith($2)) data: l: - "gnocchi_metricd_node_names": ["overcloud-controller-0", "overcloud-controller-1",

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Steven Hardy
On Tue, Aug 30, 2016 at 04:10:47PM +0200, Jiří Stránský wrote: > > On 30.8.2016 10:17, Steven Hardy wrote: > > > > > Yeah, that gets us closer, but we do need to handle more than one value > > (list entry) per key, e.g: > > > > data: > >l: > > -

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Jiří Stránský
expression: $.data.l.reduce($1.mergeWith($2)) Or maybe it's better with seed value for reduce, just in case: $.data.l.reduce($1.mergeWith($2), {}) Jirka __ OpenStack Development Mailing List (not for usage

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Jiří Stránský
On 30.8.2016 10:17, Steven Hardy wrote: Yeah, that gets us closer, but we do need to handle more than one value (list entry) per key, e.g: data: l: - "gnocchi_metricd_node_names": ["a0", "a1", "a2"] "tripleo_packages_node_names": ["a0", "a1",

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-30 Thread Steven Hardy
On Mon, Aug 29, 2016 at 04:03:27PM +0200, Thomas Herve wrote: > On Mon, Aug 29, 2016 at 3:16 PM, Steven Hardy wrote: > > On Mon, Aug 29, 2016 at 07:07:09AM +0200, Thomas Herve wrote: > >> dict($.groupBy($.keys().toList()[0], $.values().toList()[0][0])) > >> > >> ought to work,

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-29 Thread Thomas Herve
On Mon, Aug 29, 2016 at 3:16 PM, Steven Hardy wrote: > On Mon, Aug 29, 2016 at 07:07:09AM +0200, Thomas Herve wrote: >> dict($.groupBy($.keys().toList()[0], $.values().toList()[0][0])) >> >> ought to work, I believe? > > So, as it turns out, my example above was bad, and

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-29 Thread Steven Hardy
On Mon, Aug 29, 2016 at 07:07:09AM +0200, Thomas Herve wrote: > On Sun, Aug 28, 2016 at 11:58 PM, Steven Hardy wrote: > > Hi all, > > > > I have a need to merge a list of maps of lists: > > > > heat_template_version: 2016-10-14 > > > > outputs: > > debug: > > value: > >

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-29 Thread Steven Hardy
On Mon, Aug 29, 2016 at 07:07:09AM +0200, Thomas Herve wrote: > On Sun, Aug 28, 2016 at 11:58 PM, Steven Hardy wrote: > > Hi all, > > > > I have a need to merge a list of maps of lists: > > > > heat_template_version: 2016-10-14 > > > > outputs: > > debug: > > value: > >

Re: [openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-28 Thread Thomas Herve
On Sun, Aug 28, 2016 at 11:58 PM, Steven Hardy wrote: > Hi all, > > I have a need to merge a list of maps of lists: > > heat_template_version: 2016-10-14 > > outputs: > debug: > value: > yaql: > # dict(vms=>dict($.vms.select([$.name, $]))) >

[openstack-dev] [heat][yaql] Deep merge map of lists?

2016-08-28 Thread Steven Hardy
Hi all, I have a need to merge a list of maps of lists: heat_template_version: 2016-10-14 outputs: debug: value: yaql: # dict(vms=>dict($.vms.select([$.name, $]))) expression: dict($.data.l.select([$.keys().toList()[0], $.values().toList()[0]])) data: