-
Notifications
You must be signed in to change notification settings - Fork 148
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 async notification support in active-active topo; refactor code for ycable tasks for change events #327
Conversation
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
…daemons into add-async-noti
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
5b63143
to
83c709c
Compare
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@vdahiya12 merge conflict |
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@vdahiya12 description says "GracefulRestartClient" class, i didnot find in the code |
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
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.
If I understand it correctly, the graceful restart notification is implemented by looping below?
fetch ToR side from request queue -> send request to server -> process response -> sleep if there is a restart period -> put ToR in request queue -> ...
|
||
await self.response_queue.put(response) | ||
|
||
async def process_response(self): |
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.
Will response ever be written to DBs for other processes to consume? Or the only action item is to sleep gRPC client for now?
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.
Currently the plan is to log it, if its going to be used later on for more purposes, we will put it to DB
if response is not None: | ||
await asyncio.sleep(response.period) | ||
else: | ||
await asyncio.sleep(20) |
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.
Will server respond when there isn't a graceful restart?
How is 20s determined here? If ToR doesn't get graceful restart notification before the scheduled restart, will SoC go ahead and restart?
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.
Discussed offline, as mentioned 20seconds sleep is when there is no soc connectivity, otherwise once the notification for service start comes, we would sleep for advertised period.
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.
Discussed offline. @prgeor can you also review this PR?
…355) This change onboards refactor of various redis DB opens in y_cable_table-helper.py file and is required to onboard y_cable_async_client PR #327 Basically it has changes for all the table to be now exclusively opened once per class instance . It also accommodates refactor for getting async channels open given the params to open it. Description Motivation and Context refactor ycabled How Has This Been Tested? UT and deploy changes on test DUT Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
…355) This change onboards refactor of various redis DB opens in y_cable_table-helper.py file and is required to onboard y_cable_async_client PR #327 Basically it has changes for all the table to be now exclusively opened once per class instance . It also accommodates refactor for getting async channels open given the params to open it. Description Motivation and Context refactor ycabled How Has This Been Tested? UT and deploy changes on test DUT Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
…or ycable tasks for change events (#327) Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com This PR adds an enhancement to ycabled when if and whenever a notification arrives from SoC or server that it is going to be serviced. The notification can come at anytime and hence it must be listened to or awaited by the client at all times. For this we use asyncio lib and avail the async functionality in python. the added code defines a GracefulRestartClient class that can be used to send requests to a gRPC server for graceful restart. The class has three async methods: send_request, receive_response, and notify_graceful_restart_start. send_request method retrieves tor from request_queue, creates a request with the ToR, and sends it to the server using the stub's NotifyGracefulRestartStart method. It then reads the response from the server and prints the details of the response. receive_response method retrieves response from response_queue, prints/puts the the response in DB, sleeps for the period mentioned in the response, and then puts the tor of the response back in the request_queue We follow the existing ycabled pattern and instantiate the task_worker which contains all these tasks in a seperate thread Description Motivation and Context How Has This Been Tested? UT and using this server to validate
Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com
This PR adds an enhancement to ycabled when if and whenever a notification arrives from SoC or server that it is going to be serviced. The notification can come at anytime and hence it must be listened to or awaited by the client at all times. For this we use asyncio lib and avail the async functionality in python.
the added code defines a GracefulRestartClient class that can be used to send requests to a gRPC server for graceful restart. The class has three async methods: send_request, receive_response, and notify_graceful_restart_start.
send_request method retrieves tor from request_queue, creates a request with the ToR, and sends it to the server using the stub's NotifyGracefulRestartStart method. It then reads the response from the server and prints the details of the response.
receive_response method retrieves response from response_queue, prints/puts the the response in DB, sleeps for the period mentioned in the response, and then puts the tor of the response back in the request_queue
We follow the existing ycabled pattern and instantiate the task_worker which contains all these tasks in a seperate thread
Description
Motivation and Context
How Has This Been Tested?
UT and using this server to validate
Additional Information (Optional)