NameError: name 'session' is not defined
- Dominant language
- Python
- Stars
- 24
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
A clear and concise description of what the bug is.
Some places in `sagemaker-core` do not define `session` in the methods resulting in `NameError: name 'session' is not defined`

**To reproduce**
A clear, step-by-step set of instructions to reproduce the bug.
The provided code need to be **complete** and **runnable**, if additional data is needed, please include them in the issue.
```
from sagemaker_core.resources import Hub, HubContentReference
hub = Hub.create(
hub_name="CompanyHub",
hub_description="These are allowlisted models taken from the JumpStart Public Hub.",
hub_display_name="Allowlisted Models",
)
hub_content_reference = HubContentReference.create(
hub_name=hub.hub_name,
sage_maker_public_hub_content_arn="arn:aws:sagemaker:us-west-2:aws:hub-content/SageMakerPublicHub/Model/deepseek-llm-r1-distill-qwen-7b",
hub_content_name="deepseek-llm-r1-distill-qwen-7b",
)
```
**Expected behavior**
A clear and concise description of what you expected to happen.
There should not be a failure
**Screenshots or logs**
If applicable, add screenshots or logs to help explain your problem.
**Bug information**
A description of your system. Please provide:
- **SageMaker Core version**:
- **Python version**:
- **Is the issue with autogen code or with generate code ?**:
**Additional context**
Add any other context about the problem here.
Contributor guide
Research direction
Start by reproducing the example through Hub.create and HubContentReference.create in sagemaker_core.resources, then inspect the implementations for references to the undefined session variable. Done means these calls no longer raise NameError and the relevant resource operations complete successfully; add focused coverage if the existing tests expose the affected methods.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100