Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(torchx/aws_batch) Enable Region Selection in TorchConfig #673

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ashvinnihalani
Copy link

@ashvinnihalani ashvinnihalani commented Dec 20, 2022

QOL improvements for support for AWS regions.

Current Behavior: Use the default Region specified in .aws config

Proposed Behaviour: Have manual override in .torchxconfig. If no override and no default throw and error

Future Improvements: Add profile support. Add fargate support.

@facebook-github-bot
Copy link
Contributor

Hi @ashvinnihalani!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 20, 2022
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@kiukchung
Copy link
Collaborator

can you make sure the lint, pyre, and python unittests pass?

import boto3.session

return boto3.session.Session()
if region:
return boto3.session.Session(region_name=region).region_name
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the point of providing a region then getting the region back from a boto3 session object?

Copy link
Author

Choose a reason for hiding this comment

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

The original point was to check if a region name had been cached or specified in the config file or environment variable which is handled by the
return boto3.session.Session().region_name in line 260.

Adding a region parameter for the method signature similar to _local_session.

We can either remove the region parameter altogether or just return the region string without constructing a boto3.session object.

Personally, I am in favor of just returning the region string, that way if the priority of the region specification changes in the future we can just change the implementation without breaking backward compat.

else:
return _local_session().client("batch")

def _regional_client(self, aws_region: Optional[str] = None) -> "boto3.session.Session":
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to change the method name to _regional_client() since you added a region param. Lets keep the name as is.

Copy link
Author

Choose a reason for hiding this comment

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

Sounds good.

for qn in queue_names:
all_apps.extend(self._list_by_queue(qn))
regions = _local_sessions_available_regions()
for region in regions:
Copy link
Collaborator

Choose a reason for hiding this comment

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

have you measured how long this takes? last I tried this, it drastically worsens latency for m5 since we have a ton of job queues across regions. (by drastic I mean ~40seconds for the list API)

Copy link
Author

Choose a reason for hiding this comment

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

Ill double-check for M5. However, did this even work across regions originally? A more apt comparison might be specifying the region in the .torchxconfig vs just using the other methods which I think I originally did.

Copy link
Collaborator

@kiukchung kiukchung left a comment

Choose a reason for hiding this comment

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

please add unittests for the changes and make sure all the CI checks pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants