class_docstr: Performs storage operations on artifacts in the access-controlled
  `dbfs:/databricks/mlflow-tracking` location.
  
  Signed access URIs for S3 / Azure Blob Storage are fetched from the MLflow service and used to
  read and write files from/to this location.
  
  The artifact_uri is expected to be of the form
  dbfs:/databricks/mlflow-tracking/<EXP_ID>/<RUN_ID>/
class_docstr_tok: ["Performs","storage","operations","on","artifacts","in","the","access-controlled","`","dbfs",":","\/databricks\/mlflow-tracking","`","location",".","Signed","access","URIs","for","S3","\/","Azure","Blob","Storage","are","fetched","from","the","MLflow","service","and","used","to","read","and","write","files","from\/to","this","location",".","The","artifact_uri","is","expected","to","be","of","the","form","dbfs",":","\/databricks\/mlflow-tracking\/","<","EXP_ID",">","\/","<","RUN_ID",">","\/"]
docstr: Uploads a file to a given Azure storage location.
  The function uses a file chunking generator with 100 MB being the size limit for each chunk.
  This limit is imposed by the stage_block API in azure-storage-blob.
  In the case the file size is large and the upload takes longer than the validity of the
  given credentials, a new set of credentials are generated and the operation continues. This
  is the reason for the first nested try-except block
  Finally, since the prevailing credentials could expire in the time between the last
  stage_block and the commit, a second try-except block refreshes credentials if needed.
docstr_tok: ["Uploads","a","file","to","a","given","Azure","storage","location",".","The","function","uses","a","file","chunking","generator","with","100","MB","being","the","size","limit","for","each","chunk",".","This","limit","is","imposed","by","the","stage_block","API","in","azure-storage-blob",".","In","the","case","the","file","size","is","large","and","the","upload","takes","longer","than","the","validity","of","the","given","credentials",",","a","new","set","of","credentials","are","generated","and","the","operation","continues",".","This","is","the","reason","for","the","first","nested","try-except","block","Finally",",","since","the","prevailing","credentials","could","expire","in","the","time","between","the","last","stage_block","and","the","commit",",","a","second","try-except","block","refreshes","credentials","if","needed","."]
code: def _azure_upload_file(
      self, credentials, local_file, artifact_file_path
  ):
      """
      Uploads a file to a given Azure storage location.
      The function uses a file chunking generator with 100 MB being the size limit for each chunk.
      This limit is imposed by the stage_block API in azure-storage-blob.
      In the case the file size is large and the upload takes longer than the validity of the
      given credentials, a new set of credentials are generated and the operation continues. This
      is the reason for the first nested try-except block
      Finally, since the prevailing credentials could expire in the time between the last
      stage_block and the commit, a second try-except block refreshes credentials if needed.
      """
      try:
          headers = self._extract_headers_from_credentials(
              credentials.headers
          )
          futures = {}
          num_chunks = _compute_num_chunks(
              local_file, MLFLOW_MULTIPART_UPLOAD_CHUNK_SIZE.get()
          )
          for index in range(num_chunks):
              start_byte = (
                  index * MLFLOW_MULTIPART_UPLOAD_CHUNK_SIZE.get()
              )
              future = self.chunk_thread_pool.submit(
                  self._azure_upload_chunk,
                  credentials=credentials,
                  headers=headers,
                  local_file=local_file,
                  artifact_file_path=artifact_file_path,
                  start_byte=start_byte,
                  size=MLFLOW_MULTIPART_UPLOAD_CHUNK_SIZE.get(),
              )
              futures[future] = index
  
          results, errors = _complete_futures(futures, local_file)
          if errors:
              raise MlflowException(
                  f"Failed to upload at least one part of {local_file}. Errors: {errors}"
              )
          # Sort results by the chunk index
          uploading_block_list = [
              results[index] for index in sorted(results)
          ]
  
          try:
              put_block_list(
                  credentials.signed_uri,
                  uploading_block_list,
                  headers=headers,
              )
          except requests.HTTPError as e:
              if e.response.status_code in [401, 403]:
                  _logger.info(
                      "Failed to authorize request, possibly due to credential expiration."
                      " Refreshing credentials and trying again..."
                  )
                  credential_info = self._get_write_credential_infos(
                      [artifact_file_path]
                  )[0]
                  put_block_list(
                      credential_info.signed_uri,
                      uploading_block_list,
                      headers=headers,
                  )
              else:
                  raise e
      except Exception as err:
          raise MlflowException(err)
  
imports: import base64
  import logging
  import os
  import posixpath
  import uuid
  import requests
  import mlflow.tracking
  from mlflow.azure.client import patch_adls_file_upload, patch_adls_flush, put_adls_file_creation, put_block, put_block_list
  from mlflow.entities import FileInfo
  from mlflow.environment_variables import MLFLOW_MULTIPART_DOWNLOAD_CHUNK_SIZE, MLFLOW_MULTIPART_UPLOAD_CHUNK_SIZE
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_artifacts_pb2 import ArtifactCredentialType, CompleteMultipartUpload, CreateMultipartUpload, DatabricksMlflowArtifactsService, GetCredentialsForRead, GetCredentialsForWrite, GetPresignedUploadPartUrl, PartEtag
  from mlflow.protos.databricks_pb2 import INTERNAL_ERROR, INVALID_PARAMETER_VALUE
  from mlflow.protos.service_pb2 import GetRun, ListArtifacts, MlflowService
  from mlflow.store.artifact.cloud_artifact_repo import CloudArtifactRepository, _complete_futures, _compute_num_chunks
  from mlflow.utils import chunk_list
  from mlflow.utils.databricks_utils import get_databricks_host_creds
  from mlflow.utils.file_utils import download_file_using_http_uri, read_chunk
  from mlflow.utils.proto_json_utils import message_to_json
  from mlflow.utils.request_utils import cloud_storage_http_request
  from mlflow.utils.rest_utils import _REST_API_PATH_PREFIX, augmented_raise_for_status, call_endpoint, extract_api_info_for_service
  from mlflow.utils.uri import extract_and_normalize_path, get_databricks_profile_uri_from_artifact_uri, is_databricks_acled_artifacts_uri, is_valid_dbfs_uri, remove_databricks_profile_info_from_artifact_uri
label_desc: Use image node_id 10 for calling the DatabricksArtifactRepository obj's underlying member method code with example usage: obj._azure_upload_file(credentials, local_file, artifact_file_path) without return types