File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ def wrapper():
9696 )
9797
9898 # Create a temporary zip file of the impc_etl module
99+ temp_zip_path = None
99100 temp_zip_fd , temp_zip_path = tempfile .mkstemp (suffix = '.zip' , prefix = 'impc_etl_' )
100101 os .close (temp_zip_fd ) # Close the file descriptor
101102
@@ -123,7 +124,7 @@ def wrapper():
123124 task_logger .info (f"Added impc_etl module to Spark workers" )
124125 except Exception as e :
125126 task_logger .error (f"Failed to prepare impc_etl module: { e } " )
126- if os .path .exists (temp_zip_path ):
127+ if temp_zip_path and os .path .exists (temp_zip_path ):
127128 os .unlink (temp_zip_path )
128129 raise
129130
@@ -146,7 +147,7 @@ def wrapper():
146147 # Continue execution as the task may have completed successfully
147148 finally :
148149 # Clean up temporary zip file
149- if ' temp_zip_path' in locals () and os .path .exists (temp_zip_path ):
150+ if temp_zip_path and os .path .exists (temp_zip_path ):
150151 try :
151152 os .unlink (temp_zip_path )
152153 task_logger .info ("Cleaned up temporary impc_etl zip file" )
You can’t perform that action at this time.
0 commit comments