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

Add autoscaling agent rest api #130

Merged
merged 9 commits into from
Dec 11, 2024
Merged

Conversation

rpurdel
Copy link
Collaborator

@rpurdel rpurdel commented Dec 6, 2024

No description provided.

Copy link
Member

@saghul saghul left a comment

Choose a reason for hiding this comment

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

Some comments!

skynet/agent.py Outdated

log = get_logger(__name__)
app = FastAPI()
Copy link
Member

Choose a reason for hiding this comment

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

Since we are mounting a new app, I reckon we'd want to contain it in its own file perhaps, rather than together with this agent code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They need to communicate with one another (that was initially the reason for the temp file as they were in separate modules). I dropped the temp file as they can share a global. If the autoscaler sets the app's state to drain, that state needs to be reflected in the HAProxy agent response. So the LB can stop sending new connections to this machine. No need to stop accepting connections from Skynet itself as HAProxy will handle it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I also addressed the rest of the concerns, please have another look

@rpurdel rpurdel requested a review from saghul December 9, 2024 10:08
Copy link
Member

@saghul saghul left a comment

Choose a reason for hiding this comment

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

LGTM! Left 2 non-blocking questions, feel free to land it as-is.

except Exception as ex:
log.warning('TCP exception during haproxy-agent check.', ex)
finally:
await writer.drain()
Copy link
Member

Choose a reason for hiding this comment

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

If the TCP connection is broken, won't this fail?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nope

# bound to the REST API server as the latter will inform HAProxy if the system was set to drain mode.

autoscaler_rest_app = FastAPI()
TRANSCRIBE_GRACEFUL_SHUTDOWN.set(0)
Copy link
Member

Choose a reason for hiding this comment

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

Is it necwesssary to initialize it?

@rpurdel rpurdel merged commit bf96344 into master Dec 11, 2024
@rpurdel rpurdel deleted the add-autoscaling-agent-rest-api branch December 11, 2024 10:56
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