prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  v2 - support resource requests and limits
  * [x] https://github.com/kubeflow/pipelines/pull/7045
  * [x] #7043
  * [x] #7047
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `samples/core/resource_spec/resource_spec_v2.py`
  Content:
  ```
  1 # Copyright 2020-2021 The Kubeflow Authors
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #      http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 import os
  16 from kfp import dsl
  17 
  18 # In tests, we install a KFP package from the PR under test. Users should not
  19 # normally need to specify `kfp_package_path` in their component definitions.
  20 _KFP_PACKAGE_PATH = os.getenv('KFP_PACKAGE_PATH')
  21 
  22 
  23 @dsl.component(kfp_package_path=_KFP_PACKAGE_PATH)
  24 def training_op(n: int) -> int:
  25     # quickly allocate a lot of memory to verify memory is enough
  26     a = [i for i in range(n)]
  27     return len(a)
  28 
  29 
  30 @dsl.pipeline(
  31     name='pipeline-with-resource-spec',
  32     description='A pipeline with resource specification.')
  33 def my_pipeline(n: int = 11234567):
  34     # For units of these resource limits,
  35     # refer to https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes
  36     # 11234567 roughly needs 400Mi+ memory.
  37     #
  38     # Note, with v2 python components, there's a larger memory overhead caused
  39     # by installing KFP SDK in the component, so we had to increase memory limit to 650M.
  40     training_task = training_op(n=n).set_cpu_limit('1').set_memory_limit('650M')
  41 
  42     # TODO(Bobgy): other resource specs like cpu requests, memory requests and
  43     # GPU limits are not available yet: https://github.com/kubeflow/pipelines/issues/6354.
  44     # There are other resource spec you can set.
  45     # For example, to use TPU, add the following:
  46     # .add_node_selector_constraint('cloud.google.com/gke-accelerator', 'tpu-v3')
  47     # .set_gpu_limit(1)
  48
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/samples/core/resource_spec/resource_spec_v2.py b/samples/core/resource_spec/resource_spec_v2.py
  --- a/samples/core/resource_spec/resource_spec_v2.py
  +++ b/samples/core/resource_spec/resource_spec_v2.py
  @@ -38,6 +38,9 @@
       # Note, with v2 python components, there's a larger memory overhead caused
       # by installing KFP SDK in the component, so we had to increase memory limit to 650M.
       training_task = training_op(n=n).set_cpu_limit('1').set_memory_limit('650M')
  +    
  +    # TODO(gkcalat): enable requests once SDK implements the feature
  +    # training_task = training_task.set_cpu_request('1').set_memory_request('650M')
   
       # TODO(Bobgy): other resource specs like cpu requests, memory requests and
       # GPU limits are not available yet: https://github.com/kubeflow/pipelines/issues/6354.
  
verification_info: {"golden_diff": "diff --git a/samples/core/resource_spec/resource_spec_v2.py b/samples/core/resource_spec/resource_spec_v2.py\n--- a/samples/core/resource_spec/resource_spec_v2.py\n+++ b/samples/core/resource_spec/resource_spec_v2.py\n@@ -38,6 +38,9 @@\n     # Note, with v2 python components, there's a larger memory overhead caused\n     # by installing KFP SDK in the component, so we had to increase memory limit to 650M.\n     training_task = training_op(n=n).set_cpu_limit('1').set_memory_limit('650M')\n+    \n+    # TODO(gkcalat): enable requests once SDK implements the feature\n+    # training_task = training_task.set_cpu_request('1').set_memory_request('650M')\n \n     # TODO(Bobgy): other resource specs like cpu requests, memory requests and\n     # GPU limits are not available yet: https://github.com/kubeflow/pipelines/issues/6354.\n", "issue": "v2 - support resource requests and limits\n* [x] https://github.com/kubeflow/pipelines/pull/7045\r\n* [x] #7043\r\n* [x] #7047\r\n\n", "before_files": [{"content": "# Copyright 2020-2021 The Kubeflow Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport os\nfrom kfp import dsl\n\n# In tests, we install a KFP package from the PR under test. Users should not\n# normally need to specify `kfp_package_path` in their component definitions.\n_KFP_PACKAGE_PATH = os.getenv('KFP_PACKAGE_PATH')\n\n\n@dsl.component(kfp_package_path=_KFP_PACKAGE_PATH)\ndef training_op(n: int) -> int:\n    # quickly allocate a lot of memory to verify memory is enough\n    a = [i for i in range(n)]\n    return len(a)\n\n\n@dsl.pipeline(\n    name='pipeline-with-resource-spec',\n    description='A pipeline with resource specification.')\ndef my_pipeline(n: int = 11234567):\n    # For units of these resource limits,\n    # refer to https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes\n    # 11234567 roughly needs 400Mi+ memory.\n    #\n    # Note, with v2 python components, there's a larger memory overhead caused\n    # by installing KFP SDK in the component, so we had to increase memory limit to 650M.\n    training_task = training_op(n=n).set_cpu_limit('1').set_memory_limit('650M')\n\n    # TODO(Bobgy): other resource specs like cpu requests, memory requests and\n    # GPU limits are not available yet: https://github.com/kubeflow/pipelines/issues/6354.\n    # There are other resource spec you can set.\n    # For example, to use TPU, add the following:\n    # .add_node_selector_constraint('cloud.google.com/gke-accelerator', 'tpu-v3')\n    # .set_gpu_limit(1)\n", "path": "samples/core/resource_spec/resource_spec_v2.py"}], "after_files": [{"content": "# Copyright 2020-2021 The Kubeflow Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport os\nfrom kfp import dsl\n\n# In tests, we install a KFP package from the PR under test. Users should not\n# normally need to specify `kfp_package_path` in their component definitions.\n_KFP_PACKAGE_PATH = os.getenv('KFP_PACKAGE_PATH')\n\n\n@dsl.component(kfp_package_path=_KFP_PACKAGE_PATH)\ndef training_op(n: int) -> int:\n    # quickly allocate a lot of memory to verify memory is enough\n    a = [i for i in range(n)]\n    return len(a)\n\n\n@dsl.pipeline(\n    name='pipeline-with-resource-spec',\n    description='A pipeline with resource specification.')\ndef my_pipeline(n: int = 11234567):\n    # For units of these resource limits,\n    # refer to https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes\n    # 11234567 roughly needs 400Mi+ memory.\n    #\n    # Note, with v2 python components, there's a larger memory overhead caused\n    # by installing KFP SDK in the component, so we had to increase memory limit to 650M.\n    training_task = training_op(n=n).set_cpu_limit('1').set_memory_limit('650M')\n    \n    # TODO(gkcalat): enable requests once SDK implements the feature\n    # training_task = training_task.set_cpu_request('1').set_memory_request('650M')\n\n    # TODO(Bobgy): other resource specs like cpu requests, memory requests and\n    # GPU limits are not available yet: https://github.com/kubeflow/pipelines/issues/6354.\n    # There are other resource spec you can set.\n    # For example, to use TPU, add the following:\n    # .add_node_selector_constraint('cloud.google.com/gke-accelerator', 'tpu-v3')\n    # .set_gpu_limit(1)\n", "path": "samples/core/resource_spec/resource_spec_v2.py"}]}