|
|
|
# Verify async jobs run in a new process.
|
|
|
|
|
|
|
|
- name: integration/async/runner_new_process.yml
|
|
|
|
hosts: test-targets
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: get process ID.
|
|
|
|
custom_python_detect_environment:
|
|
|
|
register: sync_proc1
|
|
|
|
|
|
|
|
- name: get process ID again.
|
|
|
|
custom_python_detect_environment:
|
|
|
|
register: sync_proc2
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- sync_proc1.pid == sync_proc2.pid
|
|
|
|
fail_msg: |
|
|
|
|
sync_proc1={{ sync_proc1 }}
|
|
|
|
sync_proc2={{ sync_proc2 }}
|
|
|
|
when: is_mitogen
|
|
|
|
|
|
|
|
- name: get async process ID.
|
|
|
|
custom_python_detect_environment:
|
|
|
|
register: async_proc1
|
|
|
|
async: 1000
|
|
|
|
poll: 0
|
|
|
|
|
|
|
|
- name: busy-poll up to 100000 times
|
|
|
|
async_status:
|
|
|
|
jid: "{{async_proc1.ansible_job_id}}"
|
|
|
|
register: async_result1
|
|
|
|
until: async_result1.finished
|
|
|
|
retries: 100000
|
|
|
|
delay: 0
|
|
|
|
|
|
|
|
- name: get async process ID again.
|
|
|
|
custom_python_detect_environment:
|
|
|
|
register: async_proc2
|
|
|
|
async: 1000
|
|
|
|
poll: 0
|
|
|
|
|
|
|
|
- name: busy-poll up to 100000 times
|
|
|
|
async_status:
|
|
|
|
jid: "{{async_proc2.ansible_job_id}}"
|
|
|
|
register: async_result2
|
|
|
|
until: async_result2.finished
|
|
|
|
retries: 100000
|
|
|
|
delay: 0
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
# FIXME should this be async_proc1, and async_proc2?
|
|
|
|
- sync_proc1.pid == sync_proc2.pid
|
|
|
|
- async_result1.pid != sync_proc1.pid
|
|
|
|
- async_result1.pid != async_result2.pid
|
|
|
|
fail_msg: |
|
|
|
|
async_result1={{ async_result1 }}
|
|
|
|
async_result2={{ async_result2 }}
|
|
|
|
when: is_mitogen
|
|
|
|
tags:
|
|
|
|
- runner_new_process
|