class_docstr: Resource profile to associate with an RDD. A :class:`pyspark.resource.ResourceProfile`
  allows the user to specify executor and task requirements for an RDD that will get
  applied during a stage. This allows the user to change the resource requirements between
  stages. This is meant to be immutable so user cannot change it after building.
  
  .. versionadded:: 3.1.0
  
  Notes
  -----
  This API is evolving.
  
  Examples
  --------
  Create Executor resource requests.
  
  >>> executor_requests = (
  ...     ExecutorResourceRequests()
  ...     .cores(2)
  ...     .memory("6g")
  ...     .memoryOverhead("1g")
  ...     .pysparkMemory("2g")
  ...     .offheapMemory("3g")
  ...     .resource("gpu", 2, "testGpus", "nvidia.com")
  ... )
  
  Create task resource requasts.
  
  >>> task_requests = TaskResourceRequests().cpus(2).resource("gpu", 2)
  
  Create a resource profile.
  
  >>> builder = ResourceProfileBuilder()
  >>> resource_profile = builder.require(executor_requests).require(task_requests).build
  
  Create an RDD with the resource profile.
  
  >>> rdd = sc.parallelize(range(10)).withResources(resource_profile)
  >>> rdd.getResourceProfile()
  <pyspark.resource.profile.ResourceProfile object ...>
  >>> rdd.getResourceProfile().taskResources
  {'cpus': <...TaskResourceRequest...>, 'gpu': <...TaskResourceRequest...>}
  >>> rdd.getResourceProfile().executorResources
  {'gpu': <...ExecutorResourceRequest...>,
   'cores': <...ExecutorResourceRequest...>,
   'offHeap': <...ExecutorResourceRequest...>,
   'memoryOverhead': <...ExecutorResourceRequest...>,
   'pyspark.memory': <...ExecutorResourceRequest...>,
   'memory': <...ExecutorResourceRequest...>}
class_docstr_tok: ["Resource","profile","to","associate","with","an","RDD",".","A",":","class",":","`","pyspark.resource.ResourceProfile","`","allows","the","user","to","specify","executor","and","task","requirements","for","an","RDD","that","will","get","applied","during","a","stage",".","This","allows","the","user","to","change","the","resource","requirements","between","stages",".","This","is","meant","to","be","immutable","so","user","can","not","change","it","after","building",".","..","versionadded",":",":","3.1.0","Notes","--","--","-","This","API","is","evolving",".","Examples","--","--","--","--","Create","Executor","resource","requests",".",">",">",">","executor_requests","=","(","...","ExecutorResourceRequests","(",")","...",".cores","(","2",")","...",".memory","(","``","6g","''",")","...",".memoryOverhead","(","``","1g","''",")","...",".pysparkMemory","(","``","2g","''",")","...",".offheapMemory","(","``","3g","''",")","...",".resource","(","``","gpu","''",",","2",",","``","testGpus","''",",","``","nvidia.com","''",")","...",")","Create","task","resource","requasts",".",">",">",">","task_requests","=","TaskResourceRequests","(",")",".cpus","(","2",")",".resource","(","``","gpu","''",",","2",")","Create","a","resource","profile",".",">",">",">","builder","=","ResourceProfileBuilder","(",")",">",">",">","resource_profile","=","builder.require","(","executor_requests",")",".require","(","task_requests",")",".build","Create","an","RDD","with","the","resource","profile",".",">",">",">","rdd","=","sc.parallelize","(","range","(","10",")",")",".withResources","(","resource_profile",")",">",">",">","rdd.getResourceProfile","(",")","<","pyspark.resource.profile.ResourceProfile","object","...",">",">",">",">","rdd.getResourceProfile","(",")",".taskResources","{","'cpus","'",":","<","...","TaskResourceRequest","...",">",",","'gpu","'",":","<","...","TaskResourceRequest","...",">","}",">",">",">","rdd.getResourceProfile","(",")",".executorResources","{","'gpu","'",":","<","...","ExecutorResourceRequest","...",">",",","'cores","'",":","<","...","ExecutorResourceRequest","...",">",",","'offHeap","'",":","<","...","ExecutorResourceRequest","...",">",",","'memoryOverhead","'",":","<","...","ExecutorResourceRequest","...",">",",","'pyspark.memory","'",":","<","...","ExecutorResourceRequest","...",">",",","'memory","'",":","<","...","ExecutorResourceRequest","...",">","}"]
docstr: Returns
  -------
  dict
      a dictionary of resources to :class:`ExecutorResourceRequest`
docstr_tok: ["Returns","--","--","--","-","dict","a","dictionary","of","resources","to",":","class",":","`","ExecutorResourceRequest","`"]
code: def executorResources(self) -> Dict[str, ExecutorResourceRequest]:
      """
      Returns
      -------
      dict
          a dictionary of resources to :class:`ExecutorResourceRequest`
      """
      if self._java_resource_profile is not None:
          execRes = self._java_resource_profile.executorResourcesJMap()
          result = {}
          for k, v in execRes.items():
              result[k] = ExecutorResourceRequest(
                  v.resourceName(),
                  v.amount(),
                  v.discoveryScript(),
                  v.vendor(),
              )
          return result
      else:
          return self._executor_resource_requests
  
file_path: spark/python/pyspark/resource/profile.py
imports: from typing import overload, Dict, Union, Optional
  from py4j.java_gateway import JavaObject
  from pyspark.resource.requests import TaskResourceRequest, TaskResourceRequests, ExecutorResourceRequests, ExecutorResourceRequest
label_desc: Use image node_id 6 for calling the ResourceProfile obj's underlying member method code with example usage: obj.executorResources() and returns: result, self