Skip to content

Conversation

@AnirudhDagar
Copy link
Contributor

Description

How Has This Been Tested?

  • Unit tests (pytest tests/)
  • Integration tests (if applicable)
  • tested locally with aga run knot_theory --config_overrides "time_limit=120, feature_transformers.enabled_models=[CAAFE]"

Configuration Changes

  • No config changes
  • Config changes (please describe):

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Code cleanup/refactor

try:
# TODO: Remove hardcoding AWS region
bedrock = boto3.client("bedrock", region_name="us-west-2")
bedrock = boto3.client("bedrock", region_name=os.environ.get("AWS_DEFAULT_REGION", "us-west-2"))
Copy link
Contributor

Choose a reason for hiding this comment

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

If you leave out region_name in the client creation, boto3 handles this fallback behavior automatically. This might be cleaner where we don't need to take care of passing the region everytime a boto3 client initiated in codes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree we could simply remove the region_name kwarg, the only thing being added here is that we have a fallback in case the user doesn't set AWS_DEFAULT_REGION. But I'm happy to remove this as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

The default behavior uses AWS_DEFAULT_REGION or the AWS config file, and as a last resort, it resorts to IMDS for EC2. If none of these sources provide a region resolution, a NoRegionError is raised to ensure that the user has to explicitly set the region in the running environment. I believe this approach is better than selecting a region on behalf of the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cleaned it up

eval_model: str = "lightgbm",
# TODO: Remove hardcoding AWS region
region_name: str = "us-west-2",
region_name: str = os.environ.get("AWS_DEFAULT_REGION", "us-west-2"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tonyhoo it is still required to pass the region_name here as for CAAFE, so I think it is okay to keep this.

Later after the release I'm going to refactor CAAFE, and then this argument can also be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to keep the region setting consistent across the repo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not possible to remove it from CAAFE until we make changes in CAAFE upstream. Would you suggest that I also make changes upstream? See details here:

https://github.com/AnirudhDagar/CAAFE/blob/be58d15e03329e0a7344938d347e07b76166523f/caafe/caafe.py#L37

https://github.com/AnirudhDagar/CAAFE/blob/be58d15e03329e0a7344938d347e07b76166523f/caafe/sklearn_wrapper.py#L42

@FANGAreNotGnu FANGAreNotGnu mentioned this pull request Jun 5, 2025
10 tasks
@FANGAreNotGnu
Copy link
Collaborator

Solved in #204

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.

3 participants