-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] [Ansible::Runner] wait on artifacts/ to exist #20667
Conversation
The only advantage to this PR I see is that it will be easier to backport, since there isn't a gem dependency. However, I think that #20666 probably makes sense for the long term. |
Do we want to wait on the artifacts dir or the |
@Fryguy maybe more accurate, but seems like also more ephemeral, so it could exist then not within the time period of Figured it would be better to catch something that would remain after the run instead of something that could go away based off an error. |
Before returning a result, wait on the `artifacts/` directory to be created before returning a response object. This will ensure that calling `.running?` will return `false` properly when the `ansible-runner` has ended, and not before it has even had a chance to start. Thanks for Jason for the find on this bug.
1cb36ed
to
764d71d
Compare
Checked commit NickLaMuro@764d71d with ruby 2.6.3, rubocop 0.69.0, haml-lint 0.28.0, and yamllint |
We may want to use this one for backport...let's discuss in #20666 |
|
||
def wait_on(dir) | ||
100.times do | ||
Dir.exist?(dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you wanted break if Dir.exist?
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are correct... how did I miss that...
Anyway, thanks, will change in the new PR.
Edit: This is what I get for having to re-write something I tested in-place as a POC... without the raise
though, it ✌️ technically ✌️ had the same effect...
👍 As long as |
|
The
But I think inotify was reporting |
so 👍 from me |
@agrare okay... tl; dr: Yes, it is created after... Long answer...So, to start, the (and is created in the same fashion in 1.4.6 as well, as opposed to the That library is the On the The code that creates the https://github.com/ansible/ansible-runner/blob/stable/1.4.x/ansible_runner/runner.py#L89-L99 When that, the runner daemon https://github.com/ansible/ansible-runner/blob/stable/1.4.x/ansible_runner/__main__.py#L559 it will create the |
Before returning a result, wait on the
artifacts/
directory to be created before returning a response object.This will ensure that calling
.running?
will returnfalse
properly when theansible-runner
has ended, and not before it has even had a chance to start.Thanks for Jason for the find on this bug.
Note: This should only really be a problem in a
docker
/podified
environment, where launching the process and waiting for a response happens within the same background job. This isn't something that can happen on an Appliance, since it will have an inherent delay when monitoring the result via a new background job.TODO
raise
an error if we get through the entire loop...Links
Steps for Testing/QA
I was using a test script for this in
docker
to run this.true
values first... thenfalse
false values.false
values, followed by sometrue
values, and thenfalse
values.The idea is that
true
equals the process is running. If we getfalse
prior to receiving sometrue
values, we can reliably expect that.running?
is a good indicator that theansible-runner
process was ever running properly.The example run above shows it not working properly, and a correct run would be when the first to
false
output values are omitted.