Re: [ansible-devel] Do we need StrageyBase._results_lock?

2021-03-22 Thread Matt Martz
I'll honestly say I was surprised too. I expected the opposite. These are
questions that chew away at my days; Running endless performance profiling.

On Mon, Mar 22, 2021 at 2:41 PM Alex Willmer  wrote:

> Huh, I would not have guessed that. Thanks, I'll try that next time I
> can't explain the presence of some code.
>
> On Mon, 22 Mar 2021 at 15:39, Matt Martz  wrote:
>
>> I did some basic performance testing here, and the lock as currently
>> implemented provides a decent performance improvement.
>>
>> On my machine with 100 hosts, 100 debug tasks, and 25 forks, I found that
>> removing the lock increased execution time by close to 60 seconds.
>>
>> Based on that, I'd be hesitant to remove it.
>>
>> On Fri, Mar 19, 2021 at 5:41 PM al...@moreati.org.uk 
>> wrote:
>>
>>>
>>> ansible.plugins.strategy.StrategyBase._results_lock is acquired to
>>> control access to StrategyBase._results and StrategyBase._handler_results.
>>> Specifically
>>>
>>> - in ansible.plugins.strategy.results_thread_main() before append() ing
>>> a result
>>> - in StrategyBase_process_pending_results() before popleft() ing
>>>
>>> However StrategyBase._results & _handler_results are both
>>> collections.deque objects. From the Python docs
>>>
>>> > Deques support thread-safe, memory efficient appends and pops from
>>> either side of the deque.
>>>
>>> Thus AFAICT the lock isn't needed for the deque operations, and could
>>> possibly be removed. Have I missed something? Is the lock providing another
>>> protection I've not noticed? Is it there as a belt and braces measure?
>>>
>>> If there's no  reason to have it, and interest in removing it, I'll
>>> submit a PR. Alternatively maybe there's benefit in keeping the lock and
>>> using wait()/notify() instead of some of the polling.
>>>
>>> Regards, Alex
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Development" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ansible-devel+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-devel/3a309938-189d-4b8b-b9c4-539afea81984n%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Matt Martz
>> @sivel
>> sivel.net
>>
>
>
> --
> Alex Willmer 
>


-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CAD8N0v8uiCKSzwk0Rixu7PJALcvVqaHe3L%2BJJtjLm5NLbK0ZSw%40mail.gmail.com.


Re: [ansible-devel] Do we need StrageyBase._results_lock?

2021-03-22 Thread Alex Willmer
Huh, I would not have guessed that. Thanks, I'll try that next time I can't
explain the presence of some code.

On Mon, 22 Mar 2021 at 15:39, Matt Martz  wrote:

> I did some basic performance testing here, and the lock as currently
> implemented provides a decent performance improvement.
>
> On my machine with 100 hosts, 100 debug tasks, and 25 forks, I found that
> removing the lock increased execution time by close to 60 seconds.
>
> Based on that, I'd be hesitant to remove it.
>
> On Fri, Mar 19, 2021 at 5:41 PM al...@moreati.org.uk 
> wrote:
>
>>
>> ansible.plugins.strategy.StrategyBase._results_lock is acquired to
>> control access to StrategyBase._results and StrategyBase._handler_results.
>> Specifically
>>
>> - in ansible.plugins.strategy.results_thread_main() before append() ing a
>> result
>> - in StrategyBase_process_pending_results() before popleft() ing
>>
>> However StrategyBase._results & _handler_results are both
>> collections.deque objects. From the Python docs
>>
>> > Deques support thread-safe, memory efficient appends and pops from
>> either side of the deque.
>>
>> Thus AFAICT the lock isn't needed for the deque operations, and could
>> possibly be removed. Have I missed something? Is the lock providing another
>> protection I've not noticed? Is it there as a belt and braces measure?
>>
>> If there's no  reason to have it, and interest in removing it, I'll
>> submit a PR. Alternatively maybe there's benefit in keeping the lock and
>> using wait()/notify() instead of some of the polling.
>>
>> Regards, Alex
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-devel+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-devel/3a309938-189d-4b8b-b9c4-539afea81984n%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Matt Martz
> @sivel
> sivel.net
>


-- 
Alex Willmer 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CABv%3DZQH-LDJWHK8nLP%3D9iTW12ot%3DFh8aLDdnXGRxJzwmHP00jQ%40mail.gmail.com.


Re: [ansible-devel] Do we need StrageyBase._results_lock?

2021-03-22 Thread Matt Martz
I did some basic performance testing here, and the lock as currently
implemented provides a decent performance improvement.

On my machine with 100 hosts, 100 debug tasks, and 25 forks, I found that
removing the lock increased execution time by close to 60 seconds.

Based on that, I'd be hesitant to remove it.

On Fri, Mar 19, 2021 at 5:41 PM al...@moreati.org.uk 
wrote:

>
> ansible.plugins.strategy.StrategyBase._results_lock is acquired to control
> access to StrategyBase._results and StrategyBase._handler_results.
> Specifically
>
> - in ansible.plugins.strategy.results_thread_main() before append() ing a
> result
> - in StrategyBase_process_pending_results() before popleft() ing
>
> However StrategyBase._results & _handler_results are both
> collections.deque objects. From the Python docs
>
> > Deques support thread-safe, memory efficient appends and pops from
> either side of the deque.
>
> Thus AFAICT the lock isn't needed for the deque operations, and could
> possibly be removed. Have I missed something? Is the lock providing another
> protection I've not noticed? Is it there as a belt and braces measure?
>
> If there's no  reason to have it, and interest in removing it, I'll submit
> a PR. Alternatively maybe there's benefit in keeping the lock and using
> wait()/notify() instead of some of the polling.
>
> Regards, Alex
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-devel/3a309938-189d-4b8b-b9c4-539afea81984n%40googlegroups.com
> 
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CAD8N0v8LKs7%2Bb1wgs1zbso3vO251QEEdu4LXcrZ57pXVWj8-Hw%40mail.gmail.com.


[ansible-devel] RE: https://github.com/ansible/ansible/issues/73933 and https://github.com/ansible/ansible/issues/73932#issuecomment-802228667

2021-03-22 Thread jnm27
Hi,

Concerning those two tickets above, please read my last comments.

If nothing else, we would at least like the ability to have variables 
earlier in a dictionary definition referenceable in later variables within 
the same dictionary.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/64ada395-b5bb-4ba0-84f2-a959314fe237n%40googlegroups.com.


[ansible-devel] How get all the containers of a pod

2021-03-22 Thread George Tsoumplekas


 try to get all the containers that are included in a pod using ansible.. I 
have no experience in ansible and kubernetes. It is the first I have worked 
with ansible and kubernetes

I use an iteration through the pods to get name's of the containers that 
are include in a pod. I face two problems . The first is that when the 
script is called , I get an error that *item is undefined* . The second one 
is how I will get containers name, image version?

Below is the script

---

- name: Demmo

  k8s_info:

kind: Pod

namespace: '{{ meta.namespace }}'

  register: pod_list

# tasks file for configmap

- name: Get the  info from pod

  set_fact:

podName : "{{ pod_list | json_query(query) }}"

  vars:

query: 'resources[].{name: metadata.name}'


#use the info from podName and call again kubectl get

- name: Get the container  object 2

  k8s_info:

kind: Pod

k8s_infonamespace: '{{ meta.namespace }}'

name: "{{item.name}}"

loop: "{{podName}}"

loop_control:

  label: "{{ item.name }}"

  register: pod_list2


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/02df6950-be56-4327-90ed-72967bf1ac9en%40googlegroups.com.