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

service waiting logic #2

Merged
merged 3 commits into from
Aug 26, 2020
Merged

service waiting logic #2

merged 3 commits into from
Aug 26, 2020

Conversation

ppanero
Copy link
Member

@ppanero ppanero commented Aug 25, 2020

Example execution with ES7 (slowest):

$ docker-services-cli up  es postgresql redis mysql
Creating network "docker_services_cli_default" with the default driver
Creating docker_services_cli_redis_1      ... done
Creating docker_services_cli_es_1         ... done
Creating docker_services_cli_mysql_1      ... done
Creating docker_services_cli_postgresql_1 ... done
es not ready at 1 retries, waiting 2s
es not ready at 2 retries, waiting 4s
es not ready at 3 retries, waiting 8s
es up and running!
postgresql up and running!
redis up and running!
mysql up and running!
Services up!

@ppanero ppanero force-pushed the wait branch 4 times, most recently from 09d14f6 to 3f45a3c Compare August 26, 2020 07:09
@ppanero ppanero changed the title [WIP] service waiting logic service waiting logic Aug 26, 2020
Comment on lines 96 to 98
READYNESS_CHECKS = {
"es": es_healthcheck,
"postgresql": postgresql_healthcheck,
"mysql": mysql_healthcheck,
"redis": redis_healthcheck,
}
"""Readyness check functions module path, as string."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, I think that this code belongs to the wait_for_services implementation, it is just what in other languages would be a switch/case etc.. so no need for the comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine. I am still not convinced because by that line of thought we should have the services configuration (e.g. MYSQL) also in the services.py file.

In any case to be able to keep going I opened an question issue #4 and removed the comment.

@ppanero
Copy link
Member Author

ppanero commented Aug 26, 2020

@diegodelemos sample of usage running here: https://travis-ci.org/github/ppanero/invenio-records-rest/builds/721264883 (I checked the devel failing ones and is because some issue with the Flask-Login version - i.e. out of scope of this PR)



def services_up(services, filepath=DOCKER_SERVICES_FILEPATH):
def services_up(services, filepath=DOCKER_SERVICES_FILEPATH, wait=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

services needs a default (which should be all services). If one does:

$ docker-services-cli up

The wait_for_services doesn't do anything because services is an empty list.

Copy link
Member

@diegodelemos diegodelemos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, solution for #2 (comment) discussed over videocall.

@ppanero ppanero merged commit 25dc1a9 into inveniosoftware:master Aug 26, 2020
@ppanero ppanero deleted the wait branch August 26, 2020 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants