Repository navigation
Commit b9a0ea7
fix(serve): pass instance_type to _deploy once when creating an inference component (#6203)
Deploying a CustomOrchestrator in InferenceComponent mode through
ModelBuilder.deploy() always raised
TypeError: _deploy() got multiple values for keyword argument 'instance_type'
In _deploy_for_ic the branch that creates a new inference component read
instance_type and initial_instance_count out of kwargs with kwargs.get,
passed them to self._deploy as explicit keyword arguments, and then spread
the unchanged **kwargs into the same call. kwargs.get leaves the key in
place, so Python saw each of those arguments twice. The only caller of
this branch, ModelBuilder.deploy, always supplies both keys, so the
failure was deterministic.
Consume the two keys with kwargs.pop instead so each is forwarded exactly
once. The defaults (self.instance_type and 1) are unchanged and kwargs is
a local dict, so the caller is unaffected. _deploy_core_endpoint reads the
values back through kwargs.get and receives the same data as before.
Add unit tests covering the create branch of _deploy_for_ic with explicit
instance arguments (fails with the TypeError before this change) and with
the default fallbacks.
Fixes #6199
Co-authored-by: lucasjia-aws <lucasjia@amazon.com>1 parent 1f09f26 commit b9a0ea7
2 files changed
Lines changed: 70 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4355 | 4355 | | |
4356 | 4356 | | |
4357 | 4357 | | |
4358 | | - | |
4359 | | - | |
| 4358 | + | |
| 4359 | + | |
4360 | 4360 | | |
4361 | 4361 | | |
4362 | 4362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
517 | 585 | | |
518 | 586 | | |
519 | 587 | | |
| |||
0 commit comments