original_docstring: Defines REST POST Endpoint for Uploading input payloads.
          Will trigger inference job sequentially after uploading payload
  
          Args:
              file (UploadFile, optional): .zip file provided by user to be moved
              and extracted in shared volume directory for input payloads. Defaults to File(...).
  
          Returns:
              FileResponse: Asynchronous object for FastAPI to stream compressed .zip folder with
              the output payload from running the MONAI Application Package
          
docstring: Defines REST POST Endpoint for Uploading input payloads.
  Will trigger inference job sequentially after uploading payload
  
  file (UploadFile, optional): .zip file provided by user to be moved
  and extracted in shared volume directory for input payloads. Defaults to File(...).
  
  Asynchronous object for FastAPI to stream compressed .zip folder with
  the output payload from running the MONAI Application Package
docstring_tokens: Defines REST POST Endpoint for Uploading input payloads . Will trigger inference job sequentially after uploading payload file ( UploadFile optional ) : . zip file provided by user to be moved and extracted in shared volume directory for input payloads . Defaults to File ( ... ) . Asynchronous object for FastAPI to stream compressed . zip folder with the output payload from running the MONAI Application Package
code: def upload_file(file: UploadFile = File(...)) -> FileResponse:
          """Defines REST POST Endpoint for Uploading input payloads.
          Will trigger inference job sequentially after uploading payload
  
          Args:
              file (UploadFile, optional): .zip file provided by user to be moved
              and extracted in shared volume directory for input payloads. Defaults to File(...).
  
          Returns:
              FileResponse: Asynchronous object for FastAPI to stream compressed .zip folder with
              the output payload from running the MONAI Application Package
          """
          logger.info("/upload/ Request Received")
          if not request_mutex.acquire(False):
              logger.info("Request rejected as MIS is currently servicing another request")
              raise HTTPException(
                  status_code=500,
                  detail="Request timed out since MAP container's pod was in pending state after timeout")
          else:
              logger.info("Acquired resource lock")
  
          try:
              payload_provider.upload_input_payload(file)
              kubernetes_handler.create_kubernetes_pod()
  
              try:
                  pod_status = kubernetes_handler.watch_kubernetes_pod()
              finally:
                  kubernetes_handler.delete_kubernetes_pod()
  
              if (pod_status is PodStatus.Pending):
                  logger.error("Request timed out since MAP container's pod was in pending state after timeout")
                  raise HTTPException(
                      status_code=500,
                      detail="Request timed out since MAP container's pod was in pending state after timeout")
              elif (pod_status is PodStatus.Running):
                  logger.error("Request timed out since MAP container's pod was in running state after timeout")
                  raise HTTPException(
                      status_code=500,
                      detail="Request timed out since MAP container's pod was in running state after timeout")
              elif (pod_status is PodStatus.Failed):
                  logger.info("Request failed since MAP container's pod failed")
                  raise HTTPException(status_code=500, detail="Request failed since MAP container's pod failed")
              elif (pod_status is PodStatus.Succeeded):
                  logger.info("MAP container's pod completed")
                  return payload_provider.stream_output_payload()
          except Exception as e:
              logging.error(e, exc_info=True)
          finally:
              logger.info("Releasing resource lock")
              request_mutex.release()
code_tokens: def upload_file ( file : UploadFile = File ( ... ) ) -> FileResponse : logger . info ( "/upload/ Request Received" ) if not request_mutex . acquire ( False ) : logger . info ( "Request rejected as MIS is currently servicing another request" ) raise HTTPException ( status_code = 500 , detail = "Request timed out since MAP container's pod was in pending state after timeout" ) else : logger . info ( "Acquired resource lock" ) try : payload_provider . upload_input_payload ( file ) kubernetes_handler . create_kubernetes_pod ( ) try : pod_status = kubernetes_handler . watch_kubernetes_pod ( ) finally : kubernetes_handler . delete_kubernetes_pod ( ) if ( pod_status is PodStatus . Pending ) : logger . error ( "Request timed out since MAP container's pod was in pending state after timeout" ) raise HTTPException ( status_code = 500 , detail = "Request timed out since MAP container's pod was in pending state after timeout" ) elif ( pod_status is PodStatus . Running ) : logger . error ( "Request timed out since MAP container's pod was in running state after timeout" ) raise HTTPException ( status_code = 500 , detail = "Request timed out since MAP container's pod was in running state after timeout" ) elif ( pod_status is PodStatus . Failed ) : logger . info ( "Request failed since MAP container's pod failed" ) raise HTTPException ( status_code = 500 , detail = "Request failed since MAP container's pod failed" ) elif ( pod_status is PodStatus . Succeeded ) : logger . info ( "MAP container's pod completed" ) return payload_provider . stream_output_payload ( ) except Exception as e : logging . error ( e , exc_info = True ) finally : logger . info ( "Releasing resource lock" ) request_mutex . release ( )
short_docstring: Defines REST POST Endpoint for Uploading input payloads.
short_docstring_tokens: Defines REST POST Endpoint for Uploading input payloads .
comment: """Defines REST POST Endpoint for Uploading input payloads.
          Will trigger inference job sequentially after uploading payload
  
          Args:
              file (UploadFile, optional): .zip file provided by user to be moved
              and extracted in shared volume directory for input payloads. Defaults to File(...).
  
          Returns:
              FileResponse: Asynchronous object for FastAPI to stream compressed .zip folder with
              the output payload from running the MONAI Application Package
          """