-
Notifications
You must be signed in to change notification settings - Fork 301
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
handle existing sagemaker deployments gracefully #2400
Conversation
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
I think a complementary approach is to create a task @workflow
def wf():
(
if_(SagemakerEndpointExists(name="my-model")
.then_(create_endpoint(..., override=True)) # delete then create
.else(create_endpoint(...)) # create
) I guess once conditionals in imperative workflows is implemented this pattern wouldn't be necessary |
plugins/flytekit-aws-sagemaker/flytekitplugins/awssagemaker_inference/workflow.py
Outdated
Show resolved
Hide resolved
@cosmicBboy i think we can create a workflow to handle this case as we need to use the list API to check if the endpoint's available. i'll work on it. |
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2400 +/- ##
==========================================
- Coverage 76.27% 76.26% -0.02%
==========================================
Files 183 183
Lines 18716 18728 +12
Branches 3694 3695 +1
==========================================
+ Hits 14275 14282 +7
- Misses 3804 3811 +7
+ Partials 637 635 -2 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
* add support to override model deployment Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix task chaining Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix task chaining Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * nit Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * add is deployment exists function Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * add override Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * mutable fix Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * nit Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * update workflow Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * add idempotence token and deployment exists check Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix init Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix workflow output Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix wf output Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * idempotence token as task output Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * move try catch to mixin Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix wf code Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * move try catch to agents Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fixed all bugs Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix tests Signed-off-by: Samhita Alla <aallasamhita@gmail.com> --------- Signed-off-by: Samhita Alla <aallasamhita@gmail.com> Signed-off-by: Jan Fiedler <jan@union.ai>
* add support to override model deployment Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix task chaining Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix task chaining Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * nit Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * add is deployment exists function Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * add override Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * mutable fix Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * nit Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * update workflow Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * add idempotence token and deployment exists check Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix init Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix workflow output Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix wf output Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * idempotence token as task output Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * move try catch to mixin Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix wf code Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * move try catch to agents Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fixed all bugs Signed-off-by: Samhita Alla <aallasamhita@gmail.com> * fix tests Signed-off-by: Samhita Alla <aallasamhita@gmail.com> --------- Signed-off-by: Samhita Alla <aallasamhita@gmail.com> Signed-off-by: mao3267 <chenvincent610@gmail.com>
Tracking issue
Why are the changes needed?
This can be useful for generating deterministic names for sagemaker entities with an "idempotence token", and to avoid raising an error if the deployment already exists, instead returning the existing deployment.
An idempotence token is useful for generating different tokens given different configurations. It avoids name collisions when updating the configuration.
What changes were proposed in this pull request?
UX:
idempotence_token
corresponds to the config hashinputs.idempotence_token
corresponds to the idempotence token of the previous task. Sincecreate_sagemaker_deployment
is a workflow, it injects the previous task's idempotence token into the current task as an input.If the deployment already exists, here's how the result might look:
[{'result': 'Entity already exists: arn:aws:sagemaker:us-east-2:123456789:model/stable-diffusion-model-0b2634d258f999f6'}, {'result': 'Entity already exists: arn:aws:sagemaker:us-east-2:123456789:endpoint-config/stable-diffusion-model-bc3afab2046ae0df'}, {'EndpointArn': 'arn:aws:sagemaker:us-east-2:123456789:endpoint/stable-diffusion-model-3cfe9fbf5941f3c2'}]
If only some entities exist, such as the model and endpoint configuration, the plugin detects that these two entities exist and only creates an endpoint to complete the deployment.
How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link