Skip to content

Commit

Permalink
[Core] Make working_dir support files created before 1980 (ray-projec…
Browse files Browse the repository at this point in the history
…t#46634)

Signed-off-by: Jiajun Yao <jeromeyjj@gmail.com>
  • Loading branch information
jjyao authored Jul 16, 2024
1 parent 5e16fd0 commit 0ad0b01
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/ray/_private/runtime_env/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def _zip_directory(
directory inside the zip file.
"""
pkg_file = Path(output_path).absolute()
with ZipFile(pkg_file, "w") as zip_handler:
with ZipFile(pkg_file, "w", strict_timestamps=False) as zip_handler:
# Put all files in the directory into the zip file.
dir_path = Path(directory).absolute()

Expand Down
22 changes: 22 additions & 0 deletions python/ray/tests/test_runtime_env_working_dir_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,28 @@ def g():
ray.get(refs)


def test_file_created_before_1980(shutdown_only, tmp_working_dir):
# Make sure working_dir supports file created before 1980
# https://github.com/ray-project/ray/issues/46379
working_path = Path(tmp_working_dir)
file_1970 = working_path / "1970"
with file_1970.open(mode="w") as f:
f.write("1970")
os.utime(
file_1970,
(0, 0),
)

ray.init(runtime_env={"working_dir": tmp_working_dir})

@ray.remote
def task():
with open("1970") as f:
assert f.read() == "1970"

ray.get(task.remote())


if __name__ == "__main__":
if os.environ.get("PARALLEL_CI"):
sys.exit(pytest.main(["-n", "auto", "--boxed", "-vs", __file__]))
Expand Down

0 comments on commit 0ad0b01

Please sign in to comment.