-
Notifications
You must be signed in to change notification settings - Fork 23
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 router management functions to SDK #155
Add router management functions to SDK #155
Conversation
@gojek/turing-dev a friendly reminder to review this PR |
sdk/samples/router/general.py
Outdated
except TimeoutError: | ||
raise Exception(f"Turing API is taking too long for router {my_router.id} to get undeployed.") | ||
|
||
time.sleep(30) |
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.
This call of sleep
is a little awkward; it's there to somehow prevent this odd case where the deployment of a router fails when it is 1) undeployed and 2) immediately redeployed. Apparently waiting for the status to turn to undeployed is insufficient to prevent the deployment from crashing.
c278e49
to
41b10f1
Compare
24ee1b2
to
158ff88
Compare
sdk/samples/router/general.py
Outdated
f"deployed.") | ||
|
||
# Wait for the dependencies of the first version to be fully undeployed | ||
time.sleep(15) |
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.
What is it for? Can it be done as: ?
my_router.wait_for_version_status(RouterStatus.UNDEPLOYED, first_ver_no)
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.
Actually this is also similar to the issue right below; I was kind of trying to test both 'potential sources' of error (either with something undeploying being undeployed completely/properly, or with something being deployed not being deployed completely/properly) in both places.
@terryyylim @ashwinath any more comments from you? Are you comfortable approving this PR? I haven't reviewed it end-to-end, so I rely on you to get this approved |
I'll re-review it soon. |
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.
Looks good, just address @romanwozniak's comments and it should be good to go
Thanks everyone for the really detailed and in-depth review and comments! |
Context:
Currently the Turing SDK only supports batch experiments by covering only operations related to ensemblers and ensembling jobs, and we are now expanding its scope to cover online experiments by extending the SDK to cover operations involving other Turing components. Previously we've already implemented the SDK to supporting the listing of routers in PR #148, and the setting up of routers in PR #152. This PR introduces 10 additional SDK methods to support the deletion, retrieval, update, deployment, undeployment of routers and router versions, as well as the listing of deployment events involving a router.
Features:
Router
SDK class to support the following methods:RouterVersion
andRouterVersionLogConfig
(from their parentRouterConfig
andLogConfig
classes introduced in PR Add create router SDK functionality #152) to support the read-only operations that returnRouterVersion
objects. In particular the SDKRouterVersion
class allows users to extract an SDKRouterConfig
object (without the read-only elements) lying beneath, which can be reused and manipulated as any otherRouterConfig
objectExample:
Fixes
update
instance method of the SDKRouter
class so that it updates all the attributes of theRouter
instance (monitoring_url
,status
,endpoint
, etc. as opposed to onlyconfig
), according to theRouterDetails
instance returned by Turing APIModifications
sdk/turing/router/config/router_version.py
- newRouterVersion
classsdk/turing/router/config/log_config.py
- addition of a newRouterVersionLogConfig
classsdk/turing/router/config/experiment_config.py
- minor modifications to support the creation of OpenAPIExperimentConfig
instances while havingconfig
set asNone
sdk/turing/router/config/router_config.py
- addition of a new method to convert aRouterConfig
's (private) attributes into a dict, so thatRouterVersion
can use it to instantiate newRouterConfig
objectssdk/turing/router/router.py
- addition of new SDK methods corresponding to the 10 new functions mentioned abovesdk/turing/router/session.py
- addition of new methods to support the 10 new functions mentioned aboveapi/api/openapi-sdk.yaml
- addition of all the other API endpoints for routersapi/api/specs/routers.yaml
- minor modifications to several schemas which were not aligned with the actual Turing API outputsdk/turing/generated/model/*
- autogenerated API classes changed by the OpenAPI generator given the changes made to the OpenAPI specs (~2000 lines)sdk/tests/*
- tests for the new methods and classessdk/samples/router/general.py
- sample file to demonstrate the use of the all the SDK methods developed for routerssdk/samples/router/create_from_existing_router.py
- sample file to demonstrate how a router config can be retrieved from an existing router to create a new router