Hello,


I am trying to use the Async capabilities of ansible to "fire and forget" a
job and then check it later and wait till its end.
I have followed the example mentioned here
: http://docs.ansible.com/playbooks_async.html

But I am facing an issue and I don't really understand what's happening.


The playbook looks like

   - name: 'MyPlay | Fire and Forget'
     command: "/opt/PROGRAM/bin/gremlin -e
/opt/PROGRAM/scripts/load_graph.grm ..."
     async: 1000
     poll: 0
     register: load_graph_async


   - name: 'MyPlay | Check Job'
     async_status: jid={{ load_graph_async.ansible_job_id }}
     register: job_result
     until: job_result.finished
     retries: 30



The playbook logs look like :

TASK: [MyPlay | Fire and forget] *************************
<job 759951815367.27671> finished on Host1


TASK: [MyPlay | Check Job] *************************************
fatal: [Host1] => error while evaluating conditional: job_result.finished



What I do understand is :
  job 759951815367.27671

* 759951815367 is the JobID
* 27671 is the PID of the wrapper process


But when I go on the Host after the failed run, I saw

root 27674 0.0 0.0 136548 3672 ? S 21:15 0:00 /usr/bin/python
/home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
759951815367 1000 /home/USER/.ansibl
root 27675 0.0 0.0 136548 3900 ? S 21:15 0:00 \_ /usr/
bin/python /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
759951815367 1000 /home/USER/.an
root 27676 0.1 0.0 138008 7320 ? S 21:15 0:00 \_ /
usr/bin/python /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-
13577669747697/command /home/USER/.ansible/tmp/ansible-tm
root 27677 0.0 0.0 115504 1544 ? S 21:15 0:00 \_
/bin/bash /opt/PROGRAM/bin/gremlin -e /opt/PROGRAM/scripts/load_graph.grm
...
root 27727 84.0 14.4 4875920 1187256 ? Sl 21:15 0:21
    \_ /usr/lib/jvm/java-7-oracle/bin/java -server -Xms4g -Xmx4g -cp /opt/
PROGRAM/conf:/opt/PROGRAM


So any ideas ?


Thanks a lot for your help every one :)


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4c29214f-ce7d-4c30-8bdd-4107736a92eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Adam Miller at Dec 19, 2014 at 9:11 pm

    On Fri, Dec 19, 2014 at 2:30 PM, Xavier Krantz wrote:
    Hello,


    I am trying to use the Async capabilities of ansible to "fire and forget" a
    job and then check it later and wait till its end.
    I have followed the example mentioned here :
    http://docs.ansible.com/playbooks_async.html
    Async "fire and forget" was a new feature in Ansible 1.8 so you'll
    need to update to get that functionality.

    -AdamM
    But I am facing an issue and I don't really understand what's happening.


    The playbook looks like

    - name: 'MyPlay | Fire and Forget'
    command: "/opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm ..."
    async: 1000
    poll: 0
    register: load_graph_async


    - name: 'MyPlay | Check Job'
    async_status: jid={{ load_graph_async.ansible_job_id }}
    register: job_result
    until: job_result.finished
    retries: 30



    The playbook logs look like :

    TASK: [MyPlay | Fire and forget] *************************
    <job 759951815367.27671> finished on Host1


    TASK: [MyPlay | Check Job] *************************************
    fatal: [Host1] => error while evaluating conditional: job_result.finished



    What I do understand is :
    job 759951815367.27671

    * 759951815367 is the JobID
    * 27671 is the PID of the wrapper process


    But when I go on the Host after the failed run, I saw

    root 27674 0.0 0.0 136548 3672 ? S 21:15 0:00
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.ansibl
    root 27675 0.0 0.0 136548 3900 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.an
    root 27676 0.1 0.0 138008 7320 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/command
    /home/USER/.ansible/tmp/ansible-tm
    root 27677 0.0 0.0 115504 1544 ? S 21:15 0:00 \_
    /bin/bash /opt/PROGRAM/bin/gremlin -e /opt/PROGRAM/scripts/load_graph.grm
    ...
    root 27727 84.0 14.4 4875920 1187256 ? Sl 21:15 0:21
    \_ /usr/lib/jvm/java-7-oracle/bin/java -server -Xms4g -Xmx4g -cp
    /opt/PROGRAM/conf:/opt/PROGRAM


    So any ideas ?


    Thanks a lot for your help every one :)


    --
    You received this message because you are subscribed to the Google Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/4c29214f-ce7d-4c30-8bdd-4107736a92eb%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAA_4i2EGV9fBrwCS3HeN8eoQ_7Axe7Cj-ZTYcnFhkjX-RPJcKg%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael DeHaan at Dec 20, 2014 at 12:57 am
    Well, it wasn't a new feature in 1.8, though there was a bug fixed in the
    fire and forget operation when you don't specify a lifetime of the process,
    IIRC - I remember you filing it, all the same :)

    Let us know if you have the same problem in 1.8, regardless.

    On Fri, Dec 19, 2014 at 4:11 PM, Adam Miller wrote:
    On Fri, Dec 19, 2014 at 2:30 PM, Xavier Krantz wrote:
    Hello,


    I am trying to use the Async capabilities of ansible to "fire and forget" a
    job and then check it later and wait till its end.
    I have followed the example mentioned here :
    http://docs.ansible.com/playbooks_async.html
    Async "fire and forget" was a new feature in Ansible 1.8 so you'll
    need to update to get that functionality.

    -AdamM
    But I am facing an issue and I don't really understand what's happening.


    The playbook looks like

    - name: 'MyPlay | Fire and Forget'
    command: "/opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm ..."
    async: 1000
    poll: 0
    register: load_graph_async


    - name: 'MyPlay | Check Job'
    async_status: jid={{ load_graph_async.ansible_job_id }}
    register: job_result
    until: job_result.finished
    retries: 30



    The playbook logs look like :

    TASK: [MyPlay | Fire and forget] *************************
    <job 759951815367.27671> finished on Host1


    TASK: [MyPlay | Check Job] *************************************
    fatal: [Host1] => error while evaluating conditional: job_result.finished



    What I do understand is :
    job 759951815367.27671

    * 759951815367 is the JobID
    * 27671 is the PID of the wrapper process


    But when I go on the Host after the failed run, I saw

    root 27674 0.0 0.0 136548 3672 ? S 21:15 0:00
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.ansibl
    root 27675 0.0 0.0 136548 3900 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.an
    root 27676 0.1 0.0 138008 7320 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/command
    /home/USER/.ansible/tmp/ansible-tm
    root 27677 0.0 0.0 115504 1544 ? S 21:15 0:00 \_
    /bin/bash /opt/PROGRAM/bin/gremlin -e /opt/PROGRAM/scripts/load_graph.grm
    ...
    root 27727 84.0 14.4 4875920 1187256 ? Sl 21:15 0:21
    \_ /usr/lib/jvm/java-7-oracle/bin/java -server -Xms4g -Xmx4g -cp
    /opt/PROGRAM/conf:/opt/PROGRAM


    So any ideas ?


    Thanks a lot for your help every one :)


    --
    You received this message because you are subscribed to the Google Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/4c29214f-ce7d-4c30-8bdd-4107736a92eb%40googlegroups.com
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/CAA_4i2EGV9fBrwCS3HeN8eoQ_7Axe7Cj-ZTYcnFhkjX-RPJcKg%40mail.gmail.com
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzzzSqKtv1ZgGAkP8y29D4O5jGMErh1X51cD5LjqLFAsQ%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Xavier Krantz at Dec 22, 2014 at 6:47 pm
    Ok, thanks all for your responses.

    I will upgrade to Ansible 1.8. and be back to you.
    On Friday, December 19, 2014 4:57:06 PM UTC-8, Michael DeHaan wrote:

    Well, it wasn't a new feature in 1.8, though there was a bug fixed in the
    fire and forget operation when you don't specify a lifetime of the process,
    IIRC - I remember you filing it, all the same :)

    Let us know if you have the same problem in 1.8, regardless.


    On Fri, Dec 19, 2014 at 4:11 PM, Adam Miller <maxam...@fedoraproject.org
    <javascript:>> wrote:
    On Fri, Dec 19, 2014 at 2:30 PM, Xavier Krantz <xak...@gmail.com
    <javascript:>> wrote:
    Hello,


    I am trying to use the Async capabilities of ansible to "fire and forget" a
    job and then check it later and wait till its end.
    I have followed the example mentioned here :
    http://docs.ansible.com/playbooks_async.html
    Async "fire and forget" was a new feature in Ansible 1.8 so you'll
    need to update to get that functionality.

    -AdamM
    But I am facing an issue and I don't really understand what's happening.


    The playbook looks like

    - name: 'MyPlay | Fire and Forget'
    command: "/opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm ..."
    async: 1000
    poll: 0
    register: load_graph_async


    - name: 'MyPlay | Check Job'
    async_status: jid={{ load_graph_async.ansible_job_id }}
    register: job_result
    until: job_result.finished
    retries: 30



    The playbook logs look like :

    TASK: [MyPlay | Fire and forget] *************************
    <job 759951815367.27671> finished on Host1


    TASK: [MyPlay | Check Job] *************************************
    fatal: [Host1] => error while evaluating conditional:
    job_result.finished


    What I do understand is :
    job 759951815367.27671

    * 759951815367 is the JobID
    * 27671 is the PID of the wrapper process


    But when I go on the Host after the failed run, I saw

    root 27674 0.0 0.0 136548 3672 ? S 21:15 0:00
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.ansibl
    root 27675 0.0 0.0 136548 3900 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.an
    root 27676 0.1 0.0 138008 7320 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/command
    /home/USER/.ansible/tmp/ansible-tm
    root 27677 0.0 0.0 115504 1544 ? S 21:15 0:00 \_
    /bin/bash /opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm
    ...
    root 27727 84.0 14.4 4875920 1187256 ? Sl 21:15 0:21
    \_ /usr/lib/jvm/java-7-oracle/bin/java -server -Xms4g -Xmx4g -cp
    /opt/PROGRAM/conf:/opt/PROGRAM


    So any ideas ?


    Thanks a lot for your help every one :)


    --
    You received this message because you are subscribed to the Google Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to ansible-proje...@googlegroups.com <javascript:>.
    To post to this group, send email to ansible...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/4c29214f-ce7d-4c30-8bdd-4107736a92eb%40googlegroups.com
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to ansible-proje...@googlegroups.com <javascript:>.
    To post to this group, send email to ansible...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/CAA_4i2EGV9fBrwCS3HeN8eoQ_7Axe7Cj-ZTYcnFhkjX-RPJcKg%40mail.gmail.com
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6609a833-1d10-4fc3-a7c0-b98c81443f0a%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Xavier Krantz at Dec 22, 2014 at 7:50 pm
    No luck ... it still does not work


    $ pip install Ansible
    $ pip list
      ansible (1.8.2)
      ecdsa (0.11)
      Jinja2 (2.7.3)
      MarkupSafe (0.23)
      paramiko (1.15.2)
      pip (1.5.6)
      pycrypto (2.6.1)
      PyYAML (3.11)
      setuptools (3.6)
      wsgiref (0.1.2)


    $ ansible-playbook -i inventories/demo playbooks/run/load-graph.yml


    PLAY [VNG-Bootstrap | create-graph]
    *******************************************


    GATHERING FACTS
    ***************************************************************
    ok: [Host1]
    Host1: importing ../../../vars/demo.yml


    TASK: [Creating Titan graph schema] ***************************
    changed: [Host1]


    TASK: [Loading data into Titan graph] *************************
    <job 356642401411.12344> finished on Host1


    TASK: [Check Loading data Status] *****************************
    fatal: [Host1] => error while evaluating conditional: load_graph_result.
    finished


    FATAL: all hosts have already failed -- aborting


    PLAY RECAP
    ********************************************************************
                to retry, use: --limit @/Users/USER/create-load-graph.retry


    Host1 : ok=10 changed=2 unreachable=1 failed=0


    Playbook changes

      diff --git a/deployment/ansible/playbooks/run/create-load-graph.yml b/
    deployment/ansible/'playbooks/run/create-load-graph.yml'
      index 86a4fac..246f820 100644
      --- a/deployment/ansible/playbooks/run/create-load-graph.yml
      +++ b/deployment/ansible/playbooks/run/create-load-graph.yml
      @@ -38,8 +38,15 @@
      - async: 14400
      - poll: 60
      + async: 1000
      + poll: 0
      + register: load_graph
      +
      + - name: 'Check Loading data Status'
      + async_status: jiid={{ load_graph.ansible_job_id }}
      + register: load_graph_result
      + until: load_graph_result.finished
      + retries: 60

    On Monday, December 22, 2014 10:47:47 AM UTC-8, Xavier Krantz wrote:

    Ok, thanks all for your responses.

    I will upgrade to Ansible 1.8. and be back to you.
    On Friday, December 19, 2014 4:57:06 PM UTC-8, Michael DeHaan wrote:

    Well, it wasn't a new feature in 1.8, though there was a bug fixed in the
    fire and forget operation when you don't specify a lifetime of the process,
    IIRC - I remember you filing it, all the same :)

    Let us know if you have the same problem in 1.8, regardless.


    On Fri, Dec 19, 2014 at 4:11 PM, Adam Miller <maxam...@fedoraproject.org>
    wrote:
    On Fri, Dec 19, 2014 at 2:30 PM, Xavier Krantz wrote:
    Hello,


    I am trying to use the Async capabilities of ansible to "fire and forget" a
    job and then check it later and wait till its end.
    I have followed the example mentioned here :
    http://docs.ansible.com/playbooks_async.html
    Async "fire and forget" was a new feature in Ansible 1.8 so you'll
    need to update to get that functionality.

    -AdamM
    But I am facing an issue and I don't really understand what's
    happening.

    The playbook looks like

    - name: 'MyPlay | Fire and Forget'
    command: "/opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm ..."
    async: 1000
    poll: 0
    register: load_graph_async


    - name: 'MyPlay | Check Job'
    async_status: jid={{ load_graph_async.ansible_job_id }}
    register: job_result
    until: job_result.finished
    retries: 30



    The playbook logs look like :

    TASK: [MyPlay | Fire and forget] *************************
    <job 759951815367.27671> finished on Host1


    TASK: [MyPlay | Check Job] *************************************
    fatal: [Host1] => error while evaluating conditional:
    job_result.finished


    What I do understand is :
    job 759951815367.27671

    * 759951815367 is the JobID
    * 27671 is the PID of the wrapper process


    But when I go on the Host after the failed run, I saw

    root 27674 0.0 0.0 136548 3672 ? S 21:15 0:00
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.ansibl
    root 27675 0.0 0.0 136548 3900 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.an
    root 27676 0.1 0.0 138008 7320 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/command
    /home/USER/.ansible/tmp/ansible-tm
    root 27677 0.0 0.0 115504 1544 ? S 21:15 0:00 \_
    /bin/bash /opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm
    ...
    root 27727 84.0 14.4 4875920 1187256 ? Sl 21:15 0:21
    \_ /usr/lib/jvm/java-7-oracle/bin/java -server -Xms4g -Xmx4g -cp
    /opt/PROGRAM/conf:/opt/PROGRAM


    So any ideas ?


    Thanks a lot for your help every one :)


    --
    You received this message because you are subscribed to the Google Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/4c29214f-ce7d-4c30-8bdd-4107736a92eb%40googlegroups.com
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/CAA_4i2EGV9fBrwCS3HeN8eoQ_7Axe7Cj-ZTYcnFhkjX-RPJcKg%40mail.gmail.com
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/37311759-1f1d-4504-8feb-34b01360e508%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Xavier Krantz at Dec 22, 2014 at 8:02 pm
    Hello,

    Gist is here it some body wants to give a look :
    https://gist.github.com/xakraz/2ec7086d04630b833d23


    Thanks again
    On Monday, December 22, 2014 11:50:19 AM UTC-8, Xavier Krantz wrote:

    No luck ... it still does not work


    $ pip install Ansible
    $ pip list
    ansible (1.8.2)
    ecdsa (0.11)
    Jinja2 (2.7.3)
    MarkupSafe (0.23)
    paramiko (1.15.2)
    pip (1.5.6)
    pycrypto (2.6.1)
    PyYAML (3.11)
    setuptools (3.6)
    wsgiref (0.1.2)


    $ ansible-playbook -i inventories/demo playbooks/run/load-graph.yml


    PLAY [VNG-Bootstrap | create-graph]
    *******************************************


    GATHERING FACTS
    ***************************************************************
    ok: [Host1]
    Host1: importing ../../../vars/demo.yml


    TASK: [Creating Titan graph schema] ***************************
    changed: [Host1]


    TASK: [Loading data into Titan graph] *************************
    <job 356642401411.12344> finished on Host1


    TASK: [Check Loading data Status] *****************************
    fatal: [Host1] => error while evaluating conditional: load_graph_result.
    finished


    FATAL: all hosts have already failed -- aborting


    PLAY RECAP
    ********************************************************************
    to retry, use: --limit @/Users/USER/create-load-graph.retry


    Host1 : ok=10 changed=2 unreachable=1 failed=0


    Playbook changes

    diff --git a/deployment/ansible/playbooks/run/create-load-graph.yml b/
    deployment/ansible/'playbooks/run/create-load-graph.yml'
    index 86a4fac..246f820 100644
    --- a/deployment/ansible/playbooks/run/create-load-graph.yml
    +++ b/deployment/ansible/playbooks/run/create-load-graph.yml
    @@ -38,8 +38,15 @@
    - async: 14400
    - poll: 60
    + async: 1000
    + poll: 0
    + register: load_graph
    +
    + - name: 'Check Loading data Status'
    + async_status: jiid={{ load_graph.ansible_job_id }}
    + register: load_graph_result
    + until: load_graph_result.finished
    + retries: 60

    On Monday, December 22, 2014 10:47:47 AM UTC-8, Xavier Krantz wrote:

    Ok, thanks all for your responses.

    I will upgrade to Ansible 1.8. and be back to you.
    On Friday, December 19, 2014 4:57:06 PM UTC-8, Michael DeHaan wrote:

    Well, it wasn't a new feature in 1.8, though there was a bug fixed in
    the fire and forget operation when you don't specify a lifetime of the
    process, IIRC - I remember you filing it, all the same :)

    Let us know if you have the same problem in 1.8, regardless.


    On Fri, Dec 19, 2014 at 4:11 PM, Adam Miller <maxam...@fedoraproject.org
    wrote:
    On Fri, Dec 19, 2014 at 2:30 PM, Xavier Krantz <xak...@gmail.com>
    wrote:
    Hello,


    I am trying to use the Async capabilities of ansible to "fire and forget" a
    job and then check it later and wait till its end.
    I have followed the example mentioned here :
    http://docs.ansible.com/playbooks_async.html
    Async "fire and forget" was a new feature in Ansible 1.8 so you'll
    need to update to get that functionality.

    -AdamM
    But I am facing an issue and I don't really understand what's
    happening.

    The playbook looks like

    - name: 'MyPlay | Fire and Forget'
    command: "/opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm ..."
    async: 1000
    poll: 0
    register: load_graph_async


    - name: 'MyPlay | Check Job'
    async_status: jid={{ load_graph_async.ansible_job_id }}
    register: job_result
    until: job_result.finished
    retries: 30



    The playbook logs look like :

    TASK: [MyPlay | Fire and forget] *************************
    <job 759951815367.27671> finished on Host1


    TASK: [MyPlay | Check Job] *************************************
    fatal: [Host1] => error while evaluating conditional:
    job_result.finished


    What I do understand is :
    job 759951815367.27671

    * 759951815367 is the JobID
    * 27671 is the PID of the wrapper process


    But when I go on the Host after the failed run, I saw

    root 27674 0.0 0.0 136548 3672 ? S 21:15 0:00
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.ansibl
    root 27675 0.0 0.0 136548 3900 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.an
    root 27676 0.1 0.0 138008 7320 ? S 21:15 0:00 \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/command
    /home/USER/.ansible/tmp/ansible-tm
    root 27677 0.0 0.0 115504 1544 ? S 21:15 0:00 \_
    /bin/bash /opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm
    ...
    root 27727 84.0 14.4 4875920 1187256 ? Sl 21:15 0:21
    \_ /usr/lib/jvm/java-7-oracle/bin/java -server -Xms4g -Xmx4g -cp
    /opt/PROGRAM/conf:/opt/PROGRAM


    So any ideas ?


    Thanks a lot for your help every one :)


    --
    You received this message because you are subscribed to the Google Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/4c29214f-ce7d-4c30-8bdd-4107736a92eb%40googlegroups.com
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/CAA_4i2EGV9fBrwCS3HeN8eoQ_7Axe7Cj-ZTYcnFhkjX-RPJcKg%40mail.gmail.com
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d369aaf4-32be-4d55-87d7-58039abe5863%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Adam Miller at Dec 22, 2014 at 11:10 pm

    On Mon, Dec 22, 2014 at 2:02 PM, Xavier Krantz wrote:
    Hello,

    Gist is here it some body wants to give a look :
    https://gist.github.com/xakraz/2ec7086d04630b833d23

    I think the problem is here:
         https://gist.github.com/xakraz/2ec7086d04630b833d23#file-create-load-graph-yml-L46

    Where the variable is 'jiid':

         async_status: jiid={{ load_graph.ansible_job_id }}

    But should be 'jid'

         async_status: jid={{ load_graph.ansible_job_id }}

    Hopefully that works.

    -AdamM

    Thanks again
    On Monday, December 22, 2014 11:50:19 AM UTC-8, Xavier Krantz wrote:

    No luck ... it still does not work


    $ pip install Ansible
    $ pip list
    ansible (1.8.2)
    ecdsa (0.11)
    Jinja2 (2.7.3)
    MarkupSafe (0.23)
    paramiko (1.15.2)
    pip (1.5.6)
    pycrypto (2.6.1)
    PyYAML (3.11)
    setuptools (3.6)
    wsgiref (0.1.2)


    $ ansible-playbook -i inventories/demo playbooks/run/load-graph.yml


    PLAY [VNG-Bootstrap | create-graph]
    *******************************************


    GATHERING FACTS
    ***************************************************************
    ok: [Host1]
    Host1: importing ../../../vars/demo.yml


    TASK: [Creating Titan graph schema] ***************************
    changed: [Host1]


    TASK: [Loading data into Titan graph] *************************
    <job 356642401411.12344> finished on Host1


    TASK: [Check Loading data Status] *****************************
    fatal: [Host1] => error while evaluating conditional:
    load_graph_result.finished


    FATAL: all hosts have already failed -- aborting


    PLAY RECAP
    ********************************************************************
    to retry, use: --limit @/Users/USER/create-load-graph.retry


    Host1 : ok=10 changed=2 unreachable=1 failed=0


    Playbook changes

    diff --git a/deployment/ansible/playbooks/run/create-load-graph.yml
    b/deployment/ansible/'playbooks/run/create-load-graph.yml'
    index 86a4fac..246f820 100644
    --- a/deployment/ansible/playbooks/run/create-load-graph.yml
    +++ b/deployment/ansible/playbooks/run/create-load-graph.yml
    @@ -38,8 +38,15 @@
    - async: 14400
    - poll: 60
    + async: 1000
    + poll: 0
    + register: load_graph
    +
    + - name: 'Check Loading data Status'
    + async_status: jiid={{ load_graph.ansible_job_id }}
    + register: load_graph_result
    + until: load_graph_result.finished
    + retries: 60

    On Monday, December 22, 2014 10:47:47 AM UTC-8, Xavier Krantz wrote:

    Ok, thanks all for your responses.

    I will upgrade to Ansible 1.8. and be back to you.
    On Friday, December 19, 2014 4:57:06 PM UTC-8, Michael DeHaan wrote:

    Well, it wasn't a new feature in 1.8, though there was a bug fixed in
    the fire and forget operation when you don't specify a lifetime of the
    process, IIRC - I remember you filing it, all the same :)

    Let us know if you have the same problem in 1.8, regardless.


    On Fri, Dec 19, 2014 at 4:11 PM, Adam Miller
    wrote:
    On Fri, Dec 19, 2014 at 2:30 PM, Xavier Krantz <xak...@gmail.com>
    wrote:
    Hello,


    I am trying to use the Async capabilities of ansible to "fire and
    forget" a
    job and then check it later and wait till its end.
    I have followed the example mentioned here :
    http://docs.ansible.com/playbooks_async.html
    Async "fire and forget" was a new feature in Ansible 1.8 so you'll
    need to update to get that functionality.

    -AdamM
    But I am facing an issue and I don't really understand what's
    happening.


    The playbook looks like

    - name: 'MyPlay | Fire and Forget'
    command: "/opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm ..."
    async: 1000
    poll: 0
    register: load_graph_async


    - name: 'MyPlay | Check Job'
    async_status: jid={{ load_graph_async.ansible_job_id }}
    register: job_result
    until: job_result.finished
    retries: 30



    The playbook logs look like :

    TASK: [MyPlay | Fire and forget] *************************
    <job 759951815367.27671> finished on Host1


    TASK: [MyPlay | Check Job] *************************************
    fatal: [Host1] => error while evaluating conditional:
    job_result.finished



    What I do understand is :
    job 759951815367.27671

    * 759951815367 is the JobID
    * 27671 is the PID of the wrapper process


    But when I go on the Host after the failed run, I saw

    root 27674 0.0 0.0 136548 3672 ? S 21:15 0:00
    /usr/bin/python

    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.ansibl
    root 27675 0.0 0.0 136548 3900 ? S 21:15 0:00 \_
    /usr/bin/python

    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.an
    root 27676 0.1 0.0 138008 7320 ? S 21:15 0:00
    \_
    /usr/bin/python

    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/command
    /home/USER/.ansible/tmp/ansible-tm
    root 27677 0.0 0.0 115504 1544 ? S 21:15 0:00
    \_
    /bin/bash /opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm
    ...
    root 27727 84.0 14.4 4875920 1187256 ? Sl 21:15 0:21
    \_ /usr/lib/jvm/java-7-oracle/bin/java -server -Xms4g -Xmx4g -cp
    /opt/PROGRAM/conf:/opt/PROGRAM


    So any ideas ?


    Thanks a lot for your help every one :)


    --
    You received this message because you are subscribed to the Google
    Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an
    email to ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.
    To view this discussion on the web visit

    https://groups.google.com/d/msgid/ansible-project/4c29214f-ce7d-4c30-8bdd-4107736a92eb%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/CAA_4i2EGV9fBrwCS3HeN8eoQ_7Axe7Cj-ZTYcnFhkjX-RPJcKg%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/d369aaf4-32be-4d55-87d7-58039abe5863%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAA_4i2GRkJhUTCRD%2B0FHVBYgE392uHHVOAH9k8PAxvbeYH2%2B1w%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Xavier Krantz at Dec 23, 2014 at 12:26 am
    Shame on me ... I was spitting against ansible whereas I made a dummy typo
    in the YAML playbook file.

    Thanks Adam.


    But by the way, what is the cleanest manner to
    - launch a long running task with Ansible
    - check it is still running
    - display progress

    Do I have to use the async / poll statement and adjust their values to have
    a limit and fail if it was too long to run ?



    Thanks again for your help !

    On Monday, December 22, 2014 3:10:12 PM UTC-8, Adam Miller wrote:

    On Mon, Dec 22, 2014 at 2:02 PM, Xavier Krantz <xak...@gmail.com
    <javascript:>> wrote:
    Hello,

    Gist is here it some body wants to give a look :
    https://gist.github.com/xakraz/2ec7086d04630b833d23

    I think the problem is here:

    https://gist.github.com/xakraz/2ec7086d04630b833d23#file-create-load-graph-yml-L46

    Where the variable is 'jiid':

    async_status: jiid={{ load_graph.ansible_job_id }}

    But should be 'jid'

    async_status: jid={{ load_graph.ansible_job_id }}

    Hopefully that works.

    -AdamM

    Thanks again
    On Monday, December 22, 2014 11:50:19 AM UTC-8, Xavier Krantz wrote:

    No luck ... it still does not work


    $ pip install Ansible
    $ pip list
    ansible (1.8.2)
    ecdsa (0.11)
    Jinja2 (2.7.3)
    MarkupSafe (0.23)
    paramiko (1.15.2)
    pip (1.5.6)
    pycrypto (2.6.1)
    PyYAML (3.11)
    setuptools (3.6)
    wsgiref (0.1.2)


    $ ansible-playbook -i inventories/demo playbooks/run/load-graph.yml


    PLAY [VNG-Bootstrap | create-graph]
    *******************************************


    GATHERING FACTS
    ***************************************************************
    ok: [Host1]
    Host1: importing ../../../vars/demo.yml


    TASK: [Creating Titan graph schema] ***************************
    changed: [Host1]


    TASK: [Loading data into Titan graph] *************************
    <job 356642401411.12344> finished on Host1


    TASK: [Check Loading data Status] *****************************
    fatal: [Host1] => error while evaluating conditional:
    load_graph_result.finished


    FATAL: all hosts have already failed -- aborting


    PLAY RECAP
    ********************************************************************
    to retry, use: --limit @/Users/USER/create-load-graph.retry


    Host1 : ok=10 changed=2 unreachable=1 failed=0


    Playbook changes

    diff --git a/deployment/ansible/playbooks/run/create-load-graph.yml
    b/deployment/ansible/'playbooks/run/create-load-graph.yml'
    index 86a4fac..246f820 100644
    --- a/deployment/ansible/playbooks/run/create-load-graph.yml
    +++ b/deployment/ansible/playbooks/run/create-load-graph.yml
    @@ -38,8 +38,15 @@
    - async: 14400
    - poll: 60
    + async: 1000
    + poll: 0
    + register: load_graph
    +
    + - name: 'Check Loading data Status'
    + async_status: jiid={{ load_graph.ansible_job_id }}
    + register: load_graph_result
    + until: load_graph_result.finished
    + retries: 60

    On Monday, December 22, 2014 10:47:47 AM UTC-8, Xavier Krantz wrote:

    Ok, thanks all for your responses.

    I will upgrade to Ansible 1.8. and be back to you.
    On Friday, December 19, 2014 4:57:06 PM UTC-8, Michael DeHaan wrote:

    Well, it wasn't a new feature in 1.8, though there was a bug fixed in
    the fire and forget operation when you don't specify a lifetime of
    the
    process, IIRC - I remember you filing it, all the same :)

    Let us know if you have the same problem in 1.8, regardless.


    On Fri, Dec 19, 2014 at 4:11 PM, Adam Miller
    wrote:
    On Fri, Dec 19, 2014 at 2:30 PM, Xavier Krantz <xak...@gmail.com>
    wrote:
    Hello,


    I am trying to use the Async capabilities of ansible to "fire and
    forget" a
    job and then check it later and wait till its end.
    I have followed the example mentioned here :
    http://docs.ansible.com/playbooks_async.html
    Async "fire and forget" was a new feature in Ansible 1.8 so you'll
    need to update to get that functionality.

    -AdamM
    But I am facing an issue and I don't really understand what's
    happening.


    The playbook looks like

    - name: 'MyPlay | Fire and Forget'
    command: "/opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm ..."
    async: 1000
    poll: 0
    register: load_graph_async


    - name: 'MyPlay | Check Job'
    async_status: jid={{ load_graph_async.ansible_job_id }}
    register: job_result
    until: job_result.finished
    retries: 30



    The playbook logs look like :

    TASK: [MyPlay | Fire and forget] *************************
    <job 759951815367.27671> finished on Host1


    TASK: [MyPlay | Check Job] *************************************
    fatal: [Host1] => error while evaluating conditional:
    job_result.finished



    What I do understand is :
    job 759951815367.27671

    * 759951815367 is the JobID
    * 27671 is the PID of the wrapper process


    But when I go on the Host after the failed run, I saw

    root 27674 0.0 0.0 136548 3672 ? S 21:15 0:00
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.ansibl
    root 27675 0.0 0.0 136548 3900 ? S 21:15 0:00
    \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/async_wrapper
    759951815367 1000 /home/USER/.an
    root 27676 0.1 0.0 138008 7320 ? S 21:15 0:00
    \_
    /usr/bin/python
    /home/USER/.ansible/tmp/ansible-tmp-1419020105.57-13577669747697/command
    /home/USER/.ansible/tmp/ansible-tm
    root 27677 0.0 0.0 115504 1544 ? S 21:15 0:00
    \_
    /bin/bash /opt/PROGRAM/bin/gremlin -e
    /opt/PROGRAM/scripts/load_graph.grm
    ...
    root 27727 84.0 14.4 4875920 1187256 ? Sl 21:15 0:21
    \_ /usr/lib/jvm/java-7-oracle/bin/java -server -Xms4g -Xmx4g -cp
    /opt/PROGRAM/conf:/opt/PROGRAM


    So any ideas ?


    Thanks a lot for your help every one :)


    --
    You received this message because you are subscribed to the Google
    Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an
    email to ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/4c29214f-ce7d-4c30-8bdd-4107736a92eb%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it,
    send
    an email to ansible-proje...@googlegroups.com.
    To post to this group, send email to ansible...@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/CAA_4i2EGV9fBrwCS3HeN8eoQ_7Axe7Cj-ZTYcnFhkjX-RPJcKg%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups
    "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to ansible-proje...@googlegroups.com <javascript:>.
    To post to this group, send email to ansible...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/d369aaf4-32be-4d55-87d7-58039abe5863%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/15456710-4d37-4991-9b46-6e4ef59e8e36%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupansible-project @
postedDec 19, '14 at 8:34p
activeDec 23, '14 at 12:26a
posts8
users3

People

Translate

site design / logo © 2022 Grokbase