Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Make working_dir support files created before 1980 #46634

Merged
merged 5 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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