File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 2929import copy
3030import traceback
3131import multiprocessing
32+ import shutil
3233
3334import numpy as np
3435import torch
@@ -148,18 +149,20 @@ def fix_config_paths(self, old_config):
148149 new_config [k ] = v
149150 return new_config
150151
152+
153+
151154 def check_for_instructions (self ):
155+ executed_dir = os .path .join (self .sync_dir , 'executed_instructions' )
156+ os .makedirs (executed_dir , exist_ok = True )
152157 try :
153158 for fname in ls (self .instruction_dir ):
154159 fpath = os .path .join (self .instruction_dir , fname )
155160 if not os .path .exists (fpath ):
156- continue # File was deleted ( or incomplete) , skip
161+ continue # File was deleted or incomplete, skip
157162 if self .execute_instruction (fname ):
158- instruction_path = os .path .join (self .instruction_dir , fname )
159163 if self .instruction_deleted_hook :
160- self .instruction_deleted_hook (instruction_path )
161- os .remove (instruction_path )
162-
164+ self .instruction_deleted_hook (fpath )
165+ shutil .move (fpath , os .path .join (executed_dir , fname ))
163166
164167 except Exception as e :
165168 print ('Exception checking for instruction' , e )
You can’t perform that action at this time.
0 commit comments