Skip to content

Commit b635a1e

Browse files
committed
aadarsh-st/SK-2521: Fix review comment
1 parent f6d3f8b commit b635a1e

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

skyflow/service_account/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def generate_bearer_token(credentials_file_path, options = None, logger = None):
3838
except Exception:
3939
log_error_log(SkyflowMessages.ErrorLogs.INVALID_CREDENTIALS_FILE.value, logger = logger)
4040
raise SkyflowError(SkyflowMessages.Error.FILE_INVALID_JSON.value.format(credentials_file_path), invalid_input_error_code)
41-
except FileNotFoundError:
41+
except OSError:
4242
raise SkyflowError(SkyflowMessages.Error.INVALID_CREDENTIAL_FILE_PATH.value, invalid_input_error_code)
4343

4444
result = get_service_account_token(credentials, options, logger)

skyflow/vault/controller/_connections.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ def invoke(self, request: InvokeConnectionRequest):
2929

3030
log_info(SkyflowMessages.Info.INVOKE_CONNECTION_TRIGGERED.value, self.__vault_client.get_logger())
3131

32+
response = None
3233
try:
3334
response = session.send(invoke_connection_request)
34-
try:
35-
invoke_connection_response = parse_invoke_connection_response(response)
36-
return invoke_connection_response
37-
finally:
38-
response.close()
35+
return parse_invoke_connection_response(response)
36+
3937
except Exception as e:
4038
log_error_log(SkyflowMessages.ErrorLogs.INVOKE_CONNECTION_REQUEST_REJECTED.value, self.__vault_client.get_logger())
4139
if isinstance(e, SkyflowError): raise e
4240
raise SkyflowError(SkyflowMessages.Error.INVOKE_CONNECTION_FAILED.value,
4341
SkyflowMessages.ErrorCodes.SERVER_ERROR.value)
4442
finally:
45-
session.close()
43+
if response is not None:
44+
response.close()
45+
session.close()

skyflow/vault/controller/_detect.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def __poll_for_processed_file(self, run_id, max_wait_time=64):
7979
current_wait_time = next_wait_time
8080
time.sleep(wait_time)
8181
elif status == 'SUCCESS' or status == 'FAILED':
82-
# Retrieve the response data before closing the HTTP response
83-
result = response
84-
return result
82+
return response
8583
finally:
8684
http_response.close()
8785
except Exception as e:
@@ -289,9 +287,7 @@ def deidentify_file(self, request: DeidentifyFileRequest):
289287
file_extension = self._get_file_extension(file_name) if file_name else None
290288

291289
# Track if we need to close the file (only if it was opened from file_path)
292-
file_needs_closing = False
293-
if hasattr(request.file, 'file_path') and request.file.file_path is not None:
294-
file_needs_closing = True
290+
file_needs_closing = hasattr(request.file, 'file_path') and request.file.file_path is not None
295291

296292
try:
297293
file_content = file_obj.read()

0 commit comments

Comments
 (0)