Sort glob of files to ensure it is deterministic (#55850)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55850

ghstack-source-id: 126339587

Test Plan: diff on top builds successfully on Sandcastle

Reviewed By: wconstab

Differential Revision: D27722254

fbshipit-source-id: 181ae1a874dbfc73688dcc5b7e9264d79abd44d3
This commit is contained in:
Edward Yang
2021-04-19 09:48:53 -07:00
committed by Facebook GitHub Bot
parent 838d3079ad
commit 6409d34482

View File

@ -260,7 +260,8 @@ for p in args.paths:
# this 'top level path p' is a standard directory containing modules,
# not a module itself
# each 'mod' could be a dir containing __init__.py or .py file
for mod in path.glob("*"):
# NB: sorted to make sure this is deterministic
for mod in sorted(path.glob("*")):
f.compile_path(mod, mod)
else:
f.compile_path(path, path)