@@ -64,7 +64,7 @@ def __init__(self, jobname, jobtitle, logdir, timeout, exclusive_jobnames=None):
6464 if not os .path .exists (logdir ):
6565 os .makedirs (logdir )
6666 for ii in itertools .count ():
67- logpath = os .path .join (logdir , "%s-%d .log" % ( jobname , ii ) )
67+ logpath = os .path .join (logdir , f" { jobname } - { ii :d } .log" )
6868 if not os .path .exists (logpath ):
6969 self .logpath = logpath
7070 break
@@ -73,12 +73,8 @@ def __init__(self, jobname, jobtitle, logdir, timeout, exclusive_jobnames=None):
7373 # Record this process in the master log
7474 with open (os .path .join (logdir , "master.log" ), 'a' ) as fp :
7575 fp .write (
76- "%s %s: %d %s\n " % (
77- time .asctime (),
78- self .jobtitle ,
79- os .getpid (),
80- self .logpath
81- )
76+ f"{ time .asctime ()} { self .jobtitle } :"
77+ f"{ os .getpid ():d} { self .logpath } \n "
8278 )
8379 except Exception :
8480 print ("CAUGHT A WILD EXCEPTION BUT IGNORING IT WITHOUT LOGGING IT!" )
@@ -106,7 +102,9 @@ def claim(self, dirpath):
106102 status_path = StatusManager .claiming_filepath (dirpath , self .jobname )
107103 try :
108104 with open (status_path , 'w' ) as fp :
109- fp .write ("%d %s: %s\n " % (os .getpid (), self .jobtitle , self .logpath ))
105+ fp .write (
106+ f"{ os .getpid ():d} { self .jobtitle } : { self .logpath } \n "
107+ )
110108 except Exception :
111109 print ("CAUGHT A WILD EXCEPTION BUT IGNORING IT WITHOUT LOGGING IT!" )
112110 return False # Writing error: cannot calim directory
0 commit comments