Skip to content

Commit

Permalink
fix problem of reading log file tags on Windows (#437)
Browse files Browse the repository at this point in the history
Co-authored-by: Bowen Xian (Shanghai Wicresoft Co Ltd) <v-bxian@microsoft.com>
  • Loading branch information
XianBW and Bowen Xian (Shanghai Wicresoft Co Ltd) authored Oct 17, 2024
1 parent b82e597 commit 24aec11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rdagent/log/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def log(
def iter_msg(self, watch: bool = False) -> Generator[Message, None, None]:
msg_l = []
for file in self.path.glob("**/*.log"):
tag = ".".join(str(file.relative_to(self.path)).replace("/", ".").split(".")[:-3])
tag = ".".join(file.relative_to(self.path).as_posix().replace("/", ".").split(".")[:-3])
pid = file.parent.name

with file.open("r") as f:
with file.open("r", encoding="utf-8") as f:
content = f.read()

matches, next_matches = self.log_pattern.finditer(content), self.log_pattern.finditer(content)
Expand Down Expand Up @@ -100,7 +100,7 @@ def iter_msg(self, watch: bool = False) -> Generator[Message, None, None]:
msg_l.append(m)

for file in self.path.glob("**/*.pkl"):
tag = ".".join(str(file.relative_to(self.path)).replace("/", ".").split(".")[:-3])
tag = ".".join(file.relative_to(self.path).as_posix().replace("/", ".").split(".")[:-3])
pid = file.parent.name

with file.open("rb") as f:
Expand Down

0 comments on commit 24aec11

Please sign in to comment.