Repository navigation
Commit 37d2b09
Rohan Gujarathi
fix: propagate deploy tags on the model-customization endpoint paths
Tags passed to ModelBuilder.deploy() were accepted but never reached the
endpoints created on the model-customization paths, so they could not be used
for tag-based resource association.
deploy() branches into _deploy_model_customization() for fine-tuned and Nova
models and returns before reaching _deploy_core_endpoint(), which is the only
place that applies the deploy-time tags kwarg. Those paths built their endpoint
tags from self._tags alone, so they saw only the tags ModelBuilder had added
itself. Resolve the endpoint tags once on entry from both sources and use them
for whichever path creates the endpoint.
The restricted-model-package path created its endpoint with no tags at all; it
now receives them like the other two.
Adds _tags_as_key_value_list() to normalize tags into the lowercase key/value
list the sagemaker.core.resources create() calls are typed for. self._tags can
hold either casing, Tag objects, or a bare {key: value} mapping, and the
previous inline reads indexed tag["Key"] directly after format_tags(), which
returns a list unchanged whatever its casing -- so a lowercase list raised
KeyError. That was already reachable through build(tags=...) and add_tags().
The merge deliberately does not go through add_tags(): tag_exists() compares
tags as tag["Key"] == curr_tag["Key"], so writing the lowercase form these
create() calls require back onto the accumulator raises KeyError as soon as
self._tags is non-empty, which is the normal state after build(). Resolving
into a local list instead also keeps deploy() from mutating builder state as a
side effect. SageMaker rejects duplicate tag keys, so on a collision the tag
ModelBuilder manages is kept and the caller's duplicate is dropped rather than
displacing a tag the SDK relies on.1 parent a7bf7ea commit 37d2b09
2 files changed
Lines changed: 247 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
| |||
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
183 | 239 | | |
184 | 240 | | |
185 | 241 | | |
| |||
6185 | 6241 | | |
6186 | 6242 | | |
6187 | 6243 | | |
| 6244 | + | |
| 6245 | + | |
| 6246 | + | |
| 6247 | + | |
| 6248 | + | |
| 6249 | + | |
| 6250 | + | |
| 6251 | + | |
6188 | 6252 | | |
6189 | 6253 | | |
6190 | 6254 | | |
| |||
6201 | 6265 | | |
6202 | 6266 | | |
6203 | 6267 | | |
| 6268 | + | |
6204 | 6269 | | |
6205 | 6270 | | |
6206 | 6271 | | |
| |||
6226 | 6291 | | |
6227 | 6292 | | |
6228 | 6293 | | |
6229 | | - | |
| 6294 | + | |
| 6295 | + | |
| 6296 | + | |
6230 | 6297 | | |
6231 | 6298 | | |
6232 | 6299 | | |
| |||
6266 | 6333 | | |
6267 | 6334 | | |
6268 | 6335 | | |
6269 | | - | |
6270 | | - | |
6271 | | - | |
6272 | | - | |
6273 | 6336 | | |
6274 | 6337 | | |
6275 | 6338 | | |
| |||
6500 | 6563 | | |
6501 | 6564 | | |
6502 | 6565 | | |
| 6566 | + | |
6503 | 6567 | | |
6504 | 6568 | | |
6505 | 6569 | | |
| |||
6528 | 6592 | | |
6529 | 6593 | | |
6530 | 6594 | | |
6531 | | - | |
| 6595 | + | |
6532 | 6596 | | |
6533 | 6597 | | |
6534 | 6598 | | |
6535 | 6599 | | |
6536 | 6600 | | |
6537 | 6601 | | |
6538 | | - | |
6539 | | - | |
6540 | | - | |
6541 | | - | |
6542 | | - | |
6543 | | - | |
6544 | | - | |
6545 | | - | |
6546 | | - | |
6547 | | - | |
6548 | | - | |
| 6602 | + | |
| 6603 | + | |
| 6604 | + | |
| 6605 | + | |
| 6606 | + | |
| 6607 | + | |
| 6608 | + | |
| 6609 | + | |
| 6610 | + | |
| 6611 | + | |
6549 | 6612 | | |
6550 | 6613 | | |
6551 | 6614 | | |
6552 | 6615 | | |
6553 | | - | |
| 6616 | + | |
6554 | 6617 | | |
6555 | 6618 | | |
6556 | 6619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
0 commit comments