torchx
torchx copied to clipboard
torchx runner: only add config files that can be accessed.
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
This pull request was exported from Phabricator. Differential Revision: D59290870
Failures look unrelated will fix the test failures separately