-
Notifications
You must be signed in to change notification settings - Fork 76
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
Shutdown more gracefully #633
Comments
Part of this is based on some of my work developing an event source for RabbitMQ, where we have work that is placed in a queue, where each message is a piece of work that needs to be done. Ideally, if we do an upgrade or make a change to the system, we need a way to have Obviously there's a chance that I have just not written the event source plugin for RabbitMQ well enough to handle this, but I coded it while following the Kafka and Amazon SQS examples of event sources and it appears that those event sources would suffer from the same issue. |
Here's an example log:
|
Here's a log of the webhook rule matching to run the shutdown action, and then another event being received from RabbitMQ that matches another rule in the ruleset and starts a playbook run after the shutdown action has been called.
|
Rulebook: ---
- name: Rulebook for webhook
hosts: all
sources:
- ansible.eda.rabbitmq:
host: localhost
port: 5672
queue: openstack-tsf-network-controller
user: guest
password: guest
routing_key: 'platform.openstack.*.tsf.rendering.network.*'
exchange: "platform_requests"
- ansible.eda.webhook:
port: 5000
rules:
- name: "tsf network create rabbitmq event"
condition: event.body.event == 'createOpenStackNetwork'
actions:
- print_event:
pretty: true
- run_playbook:
name: controller/create_tsf_tenant_network.yml
verbosity: 3
- name: "shutdown via webhook"
condition: event.payload.action == "shutdown"
action:
shutdown:
delay: 15
message: "Shutting down" |
This is an attempt to address ansible#633 but it's very ham-fisted.
This is an attempt to address ansible#633 but it's very ham-fisted.
Please confirm the following
Feature type
Enhancement to Existing Feature
Feature Summary
Currently, there doesn't seem to be a way to get
ansible-rulebook
to stop processing new events from event sources and allow all existing work to complete. Even using theshutdown
action and a webhook, other rules will continue to pull work from the even sources and start kicking off playbook runs. This means that there's a high likelihood thatansible-rulebook
will exit while a playbook is still executing.There needs to be a way to have
ansible-rulebook
stop all the event sources, allow all work to complete, and then exit.This would also be useful when handling SIGTERM signals. Allow the work to complete, then exit, instead of just exiting hard with work still in progress.
Steps to reproduce
Create a rulebook that contains an event source that is a queue, like the Kafka event source or Amazon SQS, and also has a webhook source that has a rule that matches the webhook and does a shutdown action.
Put an event into the Kafa or SQS queue, watch the playbook start running. Send an event to the webhook
Current results
Work continues up until the shutdown happens, with no real "graceful" behavior
Sugested feature result
Ability to stop
ansible-rulebook
cleanly, where all work that has been pulled from an event source has completed, while stopping pulling from an event source and allow work to queue up in event sources where this construct exists (SQS queue, etc).Additional information
No response
The text was updated successfully, but these errors were encountered: