Skip to content

Commit 9a5ad7c

Browse files
pylint fixes (#41614)
1 parent 11f7eb8 commit 9a5ad7c

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/_arm_deployments/arm_deployment_executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def deploy_resource(
120120
else:
121121
return poller
122122
except Exception as ex:
123-
module_logger.debug("Polling hit the exception %s\n", ex)
123+
module_logger.debug("Polling hit the exception: %s", type(ex).__name__)
124124
raise ex
125125

126126
if error is not None:

sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,15 @@ def _get_clouds_by_metadata_url(metadata_url: str) -> Dict[str, Dict[str, str]]:
298298
return cli_cloud_dict
299299
except Exception as ex: # pylint: disable=broad-except
300300
module_logger.warning(
301-
"Error: Azure ML was unable to load cloud metadata from the url specified by %s. %s. "
301+
"Error: Azure ML was unable to load cloud metadata from the metadata url."
302302
"This may be due to a misconfiguration of networking controls. Azure Machine Learning Python "
303303
"SDK requires outbound access to Azure Resource Manager. Please contact your networking team "
304304
"to configure outbound access to Azure Resource Manager on both Network Security Group and "
305305
"Firewall. For more details on required configurations, see "
306-
"https://learn.microsoft.com/azure/machine-learning/how-to-access-azureml-behind-firewall.",
306+
"https://learn.microsoft.com/azure/machine-learning/how-to-access-azureml-behind-firewall."
307+
)
308+
module_logger.debug(
309+
"Metadata url: %s. %s",
307310
metadata_url,
308311
ex,
309312
)
@@ -330,7 +333,8 @@ def _convert_arm_to_cli(arm_cloud_metadata) -> Dict[str, Dict[str, str]]:
330333
EndpointURLS.REGISTRY_DISCOVERY_ENDPOINT: registry_discovery_url,
331334
}
332335
except KeyError as ex:
333-
module_logger.warning("Property on cloud not found in arm cloud metadata: %s", ex)
336+
module_logger.warning("Property on cloud not found in arm cloud metadata")
337+
module_logger.debug("%s", ex)
334338
continue
335339
return cli_cloud_metadata_dict
336340

sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_artifact_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ def _download_artifacts(
239239
try:
240240
self._redirect_artifacts_tool_path(organization)
241241
except Exception as e: # pylint: disable=W0718
242-
_logger.warning("Redirect artifacts tool path failed, details: %s", e)
242+
_logger.warning("Redirect artifacts tool path failed")
243+
_logger.debug("Details: %s", e)
243244

244245
retries += 1
245246
result = subprocess.run(

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/job.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,13 @@ def _from_rest_object( # pylint: disable=too-many-return-statements
334334
raise ex
335335
except Exception as ex:
336336
error_message = json.dumps(obj.as_dict(), indent=2) if obj else None
337-
module_logger.info(
337+
module_logger.debug(
338338
"Exception: %s.\n%s\nUnable to parse the job resource: %s.\n",
339339
ex,
340340
traceback.format_exc(),
341341
error_message,
342342
)
343+
module_logger.info("Failed to parse job resource")
343344
raise JobParsingError(
344345
message=str(ex),
345346
no_personal_data_message=f"Unable to parse a job resource of type:{type(obj).__name__}",

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_component_operations.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,11 @@ def _reset_version_if_no_change(self, component: Component, current_name: str, c
500500
)
501501
return component.version, component._to_rest_object()
502502
except ResourceNotFoundError as e:
503-
logger.info("Failed to get component version, %s", e)
503+
logger.info("Failed to get component version")
504+
logger.debug("%s", e)
504505
except Exception as e: # pylint: disable=W0718
505-
logger.error("Failed to compare client_component_hash, %s", e)
506+
logger.error("Failed to compare client_component_hash")
507+
logger.debug("%s", e)
506508

507509
return current_version, rest_component_resource
508510

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,8 @@ def resource(self) -> Any:
11331133
# duration comes in format: "PT1M56.3454108S"
11341134
module_logger.info("Total time : %s\n", from_iso_duration_format_min_sec(total_duration))
11351135
except Exception as e: # pylint: disable=W0718
1136-
module_logger.warning("Exception occurred while logging total duration: %s", e)
1136+
module_logger.warning("Exception occurred while logging total duration")
1137+
module_logger.debug("%s", e)
11371138
return self.func()
11381139

11391140
# pylint: disable=docstring-missing-param

0 commit comments

Comments
 (0)