Skip to content
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

Using s6 service ready notification instead of sleep #6469

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .docker/aiida-core-base/s6-assets/init/aiida-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ verdi config set warnings.development_version False
# If the environment variable `SETUP_DEFAULT_AIIDA_PROFILE` is not set, set it to `true`.
if [[ ${SETUP_DEFAULT_AIIDA_PROFILE:-true} == true ]] && ! verdi profile show ${AIIDA_PROFILE_NAME} &> /dev/null; then

# For the container that includes the services, this script is called as soon as the RabbitMQ startup script has
# been launched, but it can take a while for the service to come up. If ``verdi presto`` is called straight away
# it is possible it tries to connect to the service before that and it will configure the profile without a broker.
sleep 5

# Create AiiDA profile.
verdi presto \
--verbosity info \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec rabbitmq-diagnostics is_running > /dev/null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
13 changes: 11 additions & 2 deletions .docker/aiida-core-with-services/s6-assets/s6-rc.d/rabbitmq/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@

with-contenv

foreground { s6-echo "Calling /etc/init/rabbitmq.sh" }
rabbitmq-server
foreground { s6-echo "Starting RMQ server and notifying back when the service is ready" }


# For the container that includes the services, aiida-prepare.sh script is called as soon as the RabbitMQ startup script has
# been launched, but it can take a while for the RMQ service to come up. If ``verdi presto`` is called straight away
# it is possible it tries to connect to the service before that and it will configure the profile without a broker.
# Here we use s6-notifyoncheck to do the polling healthy check of the readyness of RMQ service.
#
# -w 1000: 1000 ms between two invocations of ./data/check

s6-notifyoncheck -w 1000 rabbitmq-server
Loading