class_docstr: Class representing a remote function stored in S3.
docstr: Load and deserialize the function and the arguments and then execute it.
docstr_tok: ["Load","and","deserialize","the","function","and","the","arguments","and","then","execute","it","."]
code: def load_and_invoke(self) -> Any:
      """Load and deserialize the function and the arguments and then execute it."""
  
      logger.info(
          "Deserializing function code from %s",
          s3_path_join(self.func_upload_path, FUNCTION_FOLDER),
      )
      func = serialization.deserialize_func_from_s3(
          sagemaker_session=self.sagemaker_session,
          s3_uri=s3_path_join(self.func_upload_path, FUNCTION_FOLDER),
          hmac_key=self.hmac_key,
      )
  
      logger.info(
          "Deserializing function arguments from %s",
          s3_path_join(self.func_upload_path, ARGUMENTS_FOLDER),
      )
      args, kwargs = serialization.deserialize_obj_from_s3(
          sagemaker_session=self.sagemaker_session,
          s3_uri=s3_path_join(self.func_upload_path, ARGUMENTS_FOLDER),
          hmac_key=self.hmac_key,
      )
  
      logger.info("Resolving pipeline variables")
      resolved_args, resolved_kwargs = resolve_pipeline_variables(
          self.context,
          args,
          kwargs,
          hmac_key=self.hmac_key,
          s3_base_uri=self.s3_base_uri,
          sagemaker_session=self.sagemaker_session,
      )
  
      logger.info("Invoking the function")
      result = func(*resolved_args, **resolved_kwargs)
  
      logger.info(
          "Serializing the function return and uploading to %s",
          s3_path_join(self.results_upload_path, RESULTS_FOLDER),
      )
      serialization.serialize_obj_to_s3(
          obj=result,
          sagemaker_session=self.sagemaker_session,
          s3_uri=s3_path_join(self.results_upload_path, RESULTS_FOLDER),
          hmac_key=self.hmac_key,
          s3_kms_key=self.s3_kms_key,
      )
  
      if self.context and self.context.serialize_output_to_json:
          logger.info(
              "JSON Serializing the function return and uploading to %s",
              s3_path_join(self.results_upload_path, RESULTS_FOLDER),
          )
          serialization.json_serialize_obj_to_s3(
              obj=result,
              json_key=JSON_SERIALIZED_RESULT_KEY,
              sagemaker_session=self.sagemaker_session,
              s3_uri=s3_path_join(
                  os.path.join(
                      self.results_upload_path,
                      RESULTS_FOLDER,
                      JSON_RESULTS_FILE,
                  )
              ),
              s3_kms_key=self.s3_kms_key,
          )
  
file_path: sagemaker-python-sdk/src/sagemaker/remote_function/core/stored_function.py
imports: from __future__ import absolute_import
  import os
  from dataclasses import dataclass
  from typing import Any
  from sagemaker.s3 import s3_path_join
  from sagemaker.remote_function import logging_config
  from sagemaker.remote_function.core.pipeline_variables import Context, resolve_pipeline_variables
  import sagemaker.remote_function.core.serialization
  from sagemaker.session import Session
label_desc: Use image node_id 4 for calling the StoredFunction obj's underlying member method code with example usage: obj.load_and_invoke() without return types