@@ -438,7 +438,7 @@ def _fmt_io_filename(std_io: Optional[BinaryIO]) -> str:
438438
439439 def __repr__ (self ) -> str :
440440 role_to_pid = {}
441- for ( role_name , replicas ) in self .role_replicas .items ():
441+ for role_name , replicas in self .role_replicas .items ():
442442 pids = role_to_pid .setdefault (role_name , [])
443443 for r in replicas :
444444 pids .append (r .proc .pid )
@@ -612,7 +612,7 @@ def _evict_lru(self) -> bool:
612612 """
613613 lru_time = sys .maxsize
614614 lru_app_id = None
615- for ( app_id , app ) in self ._apps .items ():
615+ for app_id , app in self ._apps .items ():
616616 if is_terminal (app .state ):
617617 if app .last_updated <= lru_time :
618618 lru_app_id = app_id
@@ -988,7 +988,7 @@ def _cancel_existing(self, app_id: str) -> None:
988988
989989 def close (self ) -> None :
990990 # terminate all apps
991- for ( app_id , app ) in self ._apps .items ():
991+ for app_id , app in self ._apps .items ():
992992 log .debug (f"Terminating app: { app_id } " )
993993 app .kill ()
994994 # delete logdir if torchx created a log dir
@@ -1037,7 +1037,12 @@ def __iter__(self) -> "LogIterator":
10371037 self ._check_finished () # check to see if app has finished running
10381038
10391039 if os .path .isfile (self ._log_file ):
1040- self ._log_fp = open (self ._log_file , "rt" , newline = "\n " ) # noqa: P201
1040+ self ._log_fp = open (
1041+ self ._log_file ,
1042+ mode = "rt" ,
1043+ newline = "\n " ,
1044+ errors = "replace" , # replace bad utf-8 with \uFFFD
1045+ ) # noqa: P201
10411046 break
10421047
10431048 if self ._app_finished :
0 commit comments