Skip to content

Commit cb4cd4a

Browse files
committed
fix ci test: new log structure
1 parent ab8cbd4 commit cb4cd4a

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/test_ci.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import datetime
12
import os
23
import tempfile
4+
import time
35
from pathlib import Path
46
from typing import NoReturn
57

@@ -49,18 +51,33 @@ def dist_func() -> None:
4951

5052
num_workers = 2
5153

54+
before_timestamp = datetime.datetime.now()
55+
56+
time.sleep(1)
57+
5258
trx.launch(
5359
dist_func,
5460
workers_per_host=num_workers,
5561
backend="gloo",
5662
)
5763

58-
log_files = next(os.walk(tmp), (None, None, []))[2]
64+
after_timestamp = datetime.datetime.now()
65+
66+
log_dirs = next(os.walk(tmp), (None, [], None))[1]
67+
68+
assert len(log_dirs) == 1
69+
70+
# this should error if mis-formatted
71+
log_timestamp = datetime.datetime.fromisoformat(log_dirs[0])
72+
73+
assert before_timestamp <= log_timestamp <= after_timestamp
74+
75+
log_files = next(os.walk(f"{tmp}/{log_dirs[0]}"), (None, None, []))[2]
5976

6077
assert len(log_files) == num_workers + 1
6178

6279
for file in log_files:
63-
with Path(f"{tmp}/{file}").open() as f:
80+
with Path(f"{tmp}/{log_dirs[0]}/{file}").open() as f:
6481
contents = f.read()
6582
print(contents)
6683
if file.endswith("[0].log"):

0 commit comments

Comments
 (0)