File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 5050
5151class Trainer ():
5252
53- def __init__ (self , sync_dir = None , patch_size = 572 , max_workers = 12 ):
53+ def __init__ (self , sync_dir = None , patch_size = 572 ,
54+ max_workers = 12 ,
55+ instruction_deleted_hook = None ):
56+
57+ self .instruction_deleted_hook = instruction_deleted_hook
5458
5559 valid_sizes = get_valid_patch_sizes ()
5660 assert patch_size in valid_sizes , (f'Specified patch size of { patch_size } '
@@ -146,7 +150,12 @@ def check_for_instructions(self):
146150 try :
147151 for fname in ls (self .instruction_dir ):
148152 if self .execute_instruction (fname ):
149- os .remove (os .path .join (self .instruction_dir , fname ))
153+ instruction_path = os .path .join (self .instruction_dir , fname )
154+ if self .instruction_deleted_hook :
155+ self .instruction_deleted_hook (instruction_path )
156+ os .remove (instruction_path )
157+
158+
150159 except Exception as e :
151160 print ('Exception checking for instruction' , e )
152161
You can’t perform that action at this time.
0 commit comments