-
Notifications
You must be signed in to change notification settings - Fork 134
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
Enable delayed microservices spawning based on dependencies #772
base: main
Are you sure you want to change the base?
Conversation
…pea-project#764 Signed-off-by: Foong, Khang Sheong <[email protected]>
for more information, see https://pre-commit.ci
|
||
# Make sure LLM/Microservice endpoint are ready | ||
logger.info(f"Init microservice - {name}") | ||
if llm_endpoint is not None: |
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.
instead of just waiting for LLM microservice. Should we make it more general to wait for all dependency? maybe just traverse through DAG and make sure next node available first?
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.
In fact it does wait for the other dependency if they are not LLM related. This is what we observed when we tested this:
- Microservice will wait for LLMs to be up
- Megaservice will wait for the microservice to be up
GenAIComps/comps/cores/mega/micro_service.py
Lines 66 to 93 in b611385
else: | |
url = f"{host}:{port}{endpoint}" | |
if protocol.upper() == "HTTP": | |
url = f"http://{url}" | |
elif protocol.upper() == "HTTPS": | |
url = f"https://{url}" | |
# enable future support for gRPC? | |
logger.info(f"Endpoint requested for microservice @ {url}") | |
success = False | |
while success is False: | |
try: | |
for item in methods: | |
# Do we want to cater for GET request? | |
# if yes, how to make it clean | |
if item.upper() == "POST": | |
response = requests.post(url) | |
if response.status_code == 200: | |
logger.info(f"Microservice endpoint is ready - {url}") | |
else: | |
logger.info(f"Microservice endpoint is ready - but error status code - {url}") | |
success = True | |
else: | |
logger.info(f"Microservice endpoint method not supported - Skipping - {url}") | |
success = True | |
except requests.exceptions.RequestException as e: | |
logger.info(f"Error: {e} - {url}") | |
time.sleep(2.5) |
Description
This PR enables delayed spawning of the micrservices and megaservices from OPEA to wait for the dependencies (LLMs/microservices) to be up.
Issues
#764
Type of change
List the type of change like below. Please delete options that are not relevant.
Dependencies
N/A
Tests
We tested the code changes with the Translation example.