torchx icon indicating copy to clipboard operation
torchx copied to clipboard

torchx runner: only add config files that can be accessed.

Open rb2k opened this issue 1 year ago • 1 comments
trafficstars

Summary: This is a bit of a weird one, but maybe it's worth addressing.

We had an issue where we ran into a 'PermissionError' exception when trying to launch the runner since we didn't have permissions to access the home directory (weird setup, I know).

We had a valid config file in Path.cwd(), but DEFAULT_CONFIG_DIRS tries to look at Path.home() first and the .exists() call will throw an exception if it doesn't have permission to read the file.

This fix would replace the .exists() call with os.access() which will just return False if the path doesn't exist and/or is unreadable.

The os.access() call as well as the os.R_OK constant should work on windows/mac and linux, but I only tested on mac and linux so far.

Differential Revision: D59290870

rb2k avatar Jul 02 '24 19:07 rb2k

This pull request was exported from Phabricator. Differential Revision: D59290870

facebook-github-bot avatar Jul 02 '24 19:07 facebook-github-bot

Failures look unrelated will fix the test failures separately

manav-a avatar Jul 10 '24 22:07 manav-a