aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/azure/ai/ml/_utils/_azureml_polling.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/azure/ai/ml/_utils/_azureml_polling.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-master.tar.gz
two version of R2R are hereHEADmaster
Diffstat (limited to '.venv/lib/python3.12/site-packages/azure/ai/ml/_utils/_azureml_polling.py')
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/_utils/_azureml_polling.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_utils/_azureml_polling.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_utils/_azureml_polling.py
new file mode 100644
index 00000000..fc148426
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_utils/_azureml_polling.py
@@ -0,0 +1,48 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+
+import logging
+from concurrent.futures import Future
+from time import time
+from typing import Optional, Union
+
+from azure.ai.ml.constants._common import LROConfigurations
+from azure.core.polling import LROPoller
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+module_logger = logging.getLogger(__name__)
+
+
+class AzureMLPolling(ARMPolling):
+ """A polling class for azure machine learning."""
+
+ def update_status(self):
+ """Update the current status of the LRO."""
+ super().update_status()
+ print(".", end="", flush=True)
+
+
+def polling_wait(
+ poller: Union[LROPoller, Future],
+ message: Optional[str] = None,
+ start_time: Optional[float] = None,
+) -> None:
+ """Print out status while polling and time of operation once completed.
+
+ :param poller: An poller which will return status update via function done().
+ :type poller: Union[LROPoller, concurrent.futures.Future]
+ :param message: Message to print out before starting operation write-out.
+ :type message: Optional[str]
+ :param start_time: Start time of operation.
+ :type start_time: Optional[float]
+ """
+ module_logger.info("%s", message)
+ poller.result(timeout=LROConfigurations.POLLING_TIMEOUT)
+ module_logger.info("Done.")
+
+ if start_time:
+ end_time = time()
+ duration = divmod(int(round(end_time - start_time)), 60)
+ module_logger.info("(%sm %ss)\n", duration[0], duration[1])