Skip to content

feat: bedrock-oss-provisioned-throughput-polling#5893

Merged
lucasjia-aws merged 4 commits into
aws:masterfrom
lucasjia-aws:bedrock-oss-provisioned-throughput-polling
Jun 4, 2026
Merged

feat: bedrock-oss-provisioned-throughput-polling#5893
lucasjia-aws merged 4 commits into
aws:masterfrom
lucasjia-aws:bedrock-oss-provisioned-throughput-polling

Conversation

@lucasjia-aws
Copy link
Copy Markdown
Collaborator

@lucasjia-aws lucasjia-aws commented May 26, 2026

Description

Add synchronous polling for Bedrock OSS (non-Nova) model deployments.

Previously, BedrockModelBuilder.deploy() for OSS models would fire off a create_model_import_job call and return immediately, leaving the user to manually wait for the import to complete. This PR adds polling so deploy() waits until the import job completes and the model is ready for on-demand inference, matching the synchronous behavior of the Nova deployment path.

CreateProvisionedModelThroughput is provided as a separate public method (create_provisioned_throughput()) for users who need dedicated throughput, rather than being mandatory in the deploy flow.

Changes

Implementation (bedrock_model_builder.py):

  • Non-Nova deploy() now waits for the import job to complete and returns the job details. Model is ready for on-demand inference after deploy() returns.
  • New public method: create_provisioned_throughput() — creates provisioned throughput for an imported model and polls until InService. This is a standalone method, not called by deploy().
  • New private methods: _wait_for_import_job_complete(), _wait_for_provisioned_throughput_in_service().

Unit tests (test_bedrock_model_builder.py):

  • Updated existing non-Nova deploy tests to verify deploy() waits for import completion and does NOT call PT APIs.
  • Added test classes: TestWaitForImportJobComplete, TestCreateProvisionedThroughput, TestWaitForProvisionedThroughputInService.

Integration test (test_bedrock_provisioned_throughput.py):

  • New integ test for import job polling (test_deploy_oss_model_waits_for_import_completion).
  • New integ test for create_provisioned_throughput() using a pre-existing Bedrock fine-tuned Llama 3.1 8B custom model.

Testing

  • Unit tests cover all new methods (happy path, polling, failure, timeout) — 66 tests passing.
  • Integration test for deploy() validated locally against real Bedrock APIs — import job creation, polling to completion (~9 min), and model readiness all confirmed.
  • Integration test for create_provisioned_throughput() validated locally end-to-end — PT creation, polling to InService (~18 min), and automatic cleanup all confirmed.

@lucasjia-aws lucasjia-aws force-pushed the bedrock-oss-provisioned-throughput-polling branch from 07f6443 to 456b788 Compare May 27, 2026 06:07
@lucasjia-aws lucasjia-aws force-pushed the bedrock-oss-provisioned-throughput-polling branch from 456b788 to d6636a0 Compare June 1, 2026 06:23
@lucasjia-aws lucasjia-aws force-pushed the bedrock-oss-provisioned-throughput-polling branch from 2aa5e60 to aa5315a Compare June 2, 2026 10:08
@lucasjia-aws lucasjia-aws force-pushed the bedrock-oss-provisioned-throughput-polling branch from aa5315a to 66f316b Compare June 3, 2026 17:42
@lucasjia-aws lucasjia-aws force-pushed the bedrock-oss-provisioned-throughput-polling branch from 66f316b to 9ce7df3 Compare June 3, 2026 17:52
…SS deployments

- deploy() for non-Nova models now waits for import job completion
  and returns job details (model ready for on-demand inference).
- New public method: create_provisioned_throughput() with polling.
- New private methods: _wait_for_import_job_complete(),
  _wait_for_provisioned_throughput_in_service().
- Added unit tests and integ tests (serial to avoid concurrent quota issues).
- Mark bedrock integ tests as serial to avoid concurrent import job quota issues.

X-AI-Prompt: add import polling and PT for bedrock OSS deployments
X-AI-Tool: kiro-cli
@lucasjia-aws lucasjia-aws force-pushed the bedrock-oss-provisioned-throughput-polling branch from 9ce7df3 to a0da02f Compare June 3, 2026 17:52
Copy link
Copy Markdown
Contributor

@nargokul nargokul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also update example notebooks ?

ValueError: If model_id or provisioned_model_name is not provided.
"""
if not model_id:
raise ValueError("model_id is required for create_provisioned_throughput.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be gotten from the constructor or from class variables ?

Like If I do bedrock_model_builder.deplo

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I've updated PR with two commits:

  1. make mode_id optional in create_provisioned_throughput(), if not provided it will now falls back to the stored model ID after deploy() completes
  2. update example notebooks for new OSS deploy polling behavior:
    a. bedrock-modelbuilder-deployment.ipynb: deploy() now waits for import completion, removed manual polling cell, added PT usage example
    b. mtrl_finetuning_example_notebook_v3_prod.ipynb: removed manual polling loop, updated description to reflect automatic waiting, added optional create_provisioned_throughput() example

- Store imported model ID after deploy() completes
- create_provisioned_throughput() now falls back to the stored model ID
  if model_id is not explicitly passed
- Added unit tests for fallback and explicit override behavior
- bedrock-modelbuilder-deployment.ipynb: deploy() now waits for import
  completion, removed manual polling cell, added PT usage example
- mtrl_finetuning_example_notebook_v3_prod.ipynb: removed manual polling
  loop, updated description to reflect automatic waiting, added optional
  create_provisioned_throughput() example
@lucasjia-aws lucasjia-aws merged commit 97a4afe into aws:master Jun 4, 2026
13 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants