Skip to content

Conversation

ntlm1686
Copy link
Contributor

@ntlm1686 ntlm1686 commented Jun 14, 2022

To parse a address like "addr-of-cluster-app_id", the old code will fail since it takes "addr" as the address and "of-cluster-app_id" as the app id.
After replace partition by rpartition, it should work as intended.

Test plan:

Follow the original test.

@facebook-github-bot
Copy link
Contributor

Hi @ljjsalt!

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 cla@fb.com. 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 Jun 14, 2022
Copy link
Member

@d4l3k d4l3k left a comment

Choose a reason for hiding this comment

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

Hi, thanks for contributing!

The one thing I'm a bit worried about is in the cases where there's a dash in the ID since that's valid in all of our schedulers.

Since I believe the ray host address always contains the port (and IDs can't contain :) it might be best for us to do a combination where we look look for the first :\d+- and split on that instead.

Can pull out the partition logic into a helper method and would be nice to add some tests as well

foo-foo:1234-bar-bar

@d4l3k
Copy link
Member

d4l3k commented Jun 14, 2022

Looks like that's the case--the ray integration tests are failing because of the right dashes

ValueError: invalid literal for int() with base 10: '8265-torchx-utils-booth'

@codecov
Copy link

codecov bot commented Jun 14, 2022

Codecov Report

Merging #517 (8088c16) into main (84158cf) will decrease coverage by 4.51%.
The diff coverage is 12.50%.

@@            Coverage Diff             @@
##             main     #517      +/-   ##
==========================================
- Coverage   94.78%   90.27%   -4.52%     
==========================================
  Files          65       65              
  Lines        3932     3938       +6     
==========================================
- Hits         3727     3555     -172     
- Misses        205      383     +178     
Impacted Files Coverage Δ
torchx/schedulers/ray_scheduler.py 19.23% <12.50%> (-76.77%) ⬇️
torchx/schedulers/ray/ray_driver.py 0.00% <0.00%> (-95.84%) ⬇️
torchx/schedulers/__init__.py 86.20% <0.00%> (-10.35%) ⬇️
torchx/util/entrypoints.py 90.00% <0.00%> (-10.00%) ⬇️
torchx/specs/file_linter.py 96.50% <0.00%> (-2.10%) ⬇️
torchx/schedulers/docker_scheduler.py 94.84% <0.00%> (-1.04%) ⬇️
torchx/specs/api.py 99.20% <0.00%> (-0.40%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84158cf...8088c16. Read the comment docs.

@ntlm1686
Copy link
Contributor Author

Hi, thanks for contributing!

The one thing I'm a bit worried about is in the cases where there's a dash in the ID since that's valid in all of our schedulers.

Since I believe the ray host address always contains the port (and IDs can't contain :) it might be best for us to do a combination where we look look for the first :\d+- and split on that instead.

Can pull out the partition logic into a helper method and would be nice to add some tests as well

foo-foo:1234-bar-bar

Yes, this makes sense. So can we make sure that there is always at least one ":" in the host address and should we consider the situation that there are more than one ":"?

parsed_addr, parsed_app_id = self._scheduler._parse_app_id(
f"{addr}:{port}-{app_id}"
)
self.assertEqual(parsed_addr, addr)
Copy link
Member

Choose a reason for hiding this comment

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

I think this is dropping the port -- port should still be included in the address

Would also be good to add an explicit test where there's no port specified and it should fall back to the old behavior for safety reasons

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad, I didn't see the instruction on how to run tests in the document.

addrs = ["0.0.0.0", "www.testexample.com", "addr-of-cluster"]
ports = ["65535", ]
app_ids = ["a-p-p_id", "app-i-d", "app_id", "app:id"]
for addr, port, app_id in product(addrs, ports, app_ids):
Copy link
Member

Choose a reason for hiding this comment

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

product is clever but I think it's a bit easy to miss things since it's a bit hard to follow

no strong preference but might be better to just be very explicit and call _parse_app_id for each case even if it's a few more lines of code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I have changed the test examples to explicit form.

Include port number in parsed cluster address
@facebook-github-bot
Copy link
Contributor

@d4l3k has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@d4l3k
Copy link
Member

d4l3k commented Jun 15, 2022

I made some fixups on this at #523

@ljjsalt the commit should still link to your account if you add your @ibm.com email to your GitHub account

@ntlm1686
Copy link
Contributor Author

ok no problem

@d4l3k
Copy link
Member

d4l3k commented Jun 16, 2022

landed via 5d1ad55

@d4l3k d4l3k closed this Jun 16, 2022
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.

3 participants