diff --git a/backend/src/v2/compiler/testdata/component_used_twice.py b/backend/src/v2/compiler/testdata/component_used_twice.py index f4da0136308..555db1e056b 100644 --- a/backend/src/v2/compiler/testdata/component_used_twice.py +++ b/backend/src/v2/compiler/testdata/component_used_twice.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import dsl -from kfp.v2 import components +from kfp import dsl +from kfp import components @components.create_component_from_func diff --git a/frontend/mock-backend/data/v2/pipeline/mock_lightweight_python_functions_v2_pipeline.json b/frontend/mock-backend/data/v2/pipeline/mock_lightweight_python_functions_v2_pipeline.json index b063913d7a1..7a2f6abe755 100644 --- a/frontend/mock-backend/data/v2/pipeline/mock_lightweight_python_functions_v2_pipeline.json +++ b/frontend/mock-backend/data/v2/pipeline/mock_lightweight_python_functions_v2_pipeline.json @@ -104,8 +104,8 @@ "(python3 -m ensurepip || python3 -m ensurepip --user) && (PIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.0' || PIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.0' --user) && \"$0\" \"$@\"", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nfrom kfp.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n" ], "image": "python:3.7" } diff --git a/frontend/mock-backend/data/v2/pipeline/mock_lightweight_python_functions_v2_pipeline_rev.json b/frontend/mock-backend/data/v2/pipeline/mock_lightweight_python_functions_v2_pipeline_rev.json index 7855e934a16..7597231d5a7 100644 --- a/frontend/mock-backend/data/v2/pipeline/mock_lightweight_python_functions_v2_pipeline_rev.json +++ b/frontend/mock-backend/data/v2/pipeline/mock_lightweight_python_functions_v2_pipeline_rev.json @@ -107,8 +107,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n" ], "image": "python:3.7" } @@ -127,8 +127,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef train(\n # Use InputPath to get a locally accessible path for the input artifact\n # of type `Dataset`.\n dataset_one_path: InputPath('Dataset'),\n # Use Input[T] to get a metadata-rich handle to the input artifact\n # of type `Dataset`.\n dataset_two: Input[Dataset],\n # An input parameter of type string.\n message: str,\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n model: Output[Model],\n # An input parameter of type bool.\n input_bool: bool,\n # An input parameter of type dict.\n input_dict: Dict[str, int],\n # An input parameter of type List[str].\n input_list: List[str],\n # An input parameter of type int with a default value.\n num_steps: int = 100,\n):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset_one_path, 'r') as input_file:\n dataset_one_contents = input_file.read()\n\n with open(dataset_two.path, 'r') as input_file:\n dataset_two_contents = input_file.read()\n\n line = (f'dataset_one_contents: {dataset_one_contents} || '\n f'dataset_two_contents: {dataset_two_contents} || '\n f'message: {message} || '\n f'input_bool: {input_bool}, type {type(input_bool)} || '\n f'input_dict: {input_dict}, type {type(input_dict)} || '\n f'input_list: {input_list}, type {type(input_list)} \\n')\n\n with open(model.path, 'w') as output_file:\n for i in range(num_steps):\n output_file.write('Step {}\\n{}\\n=====\\n'.format(i, line))\n\n # model is an instance of Model artifact, which has a .metadata dictionary\n # to store arbitrary metadata for the output artifact.\n model.metadata['accuracy'] = 0.9\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef train(\n # Use InputPath to get a locally accessible path for the input artifact\n # of type `Dataset`.\n dataset_one_path: InputPath('Dataset'),\n # Use Input[T] to get a metadata-rich handle to the input artifact\n # of type `Dataset`.\n dataset_two: Input[Dataset],\n # An input parameter of type string.\n message: str,\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n model: Output[Model],\n # An input parameter of type bool.\n input_bool: bool,\n # An input parameter of type dict.\n input_dict: Dict[str, int],\n # An input parameter of type List[str].\n input_list: List[str],\n # An input parameter of type int with a default value.\n num_steps: int = 100,\n):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset_one_path, 'r') as input_file:\n dataset_one_contents = input_file.read()\n\n with open(dataset_two.path, 'r') as input_file:\n dataset_two_contents = input_file.read()\n\n line = (f'dataset_one_contents: {dataset_one_contents} || '\n f'dataset_two_contents: {dataset_two_contents} || '\n f'message: {message} || '\n f'input_bool: {input_bool}, type {type(input_bool)} || '\n f'input_dict: {input_dict}, type {type(input_dict)} || '\n f'input_list: {input_list}, type {type(input_list)} \\n')\n\n with open(model.path, 'w') as output_file:\n for i in range(num_steps):\n output_file.write('Step {}\\n{}\\n=====\\n'.format(i, line))\n\n # model is an instance of Model artifact, which has a .metadata dictionary\n # to store arbitrary metadata for the output artifact.\n model.metadata['accuracy'] = 0.9\n\n" ], "image": "python:3.7" } diff --git a/frontend/mock-backend/data/v2/pipeline/pipeline_with_loops_and_conditions.json b/frontend/mock-backend/data/v2/pipeline/pipeline_with_loops_and_conditions.json index e0e3bfae237..f2364e2af35 100644 --- a/frontend/mock-backend/data/v2/pipeline/pipeline_with_loops_and_conditions.json +++ b/frontend/mock-backend/data/v2/pipeline/pipeline_with_loops_and_conditions.json @@ -926,8 +926,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" ], "image": "python:3.7" } @@ -946,8 +946,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" ], "image": "python:3.7" } @@ -966,8 +966,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" ], "image": "python:3.7" } @@ -986,8 +986,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_struct(struct: dict):\n print(struct)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_struct(struct: dict):\n print(struct)\n\n" ], "image": "python:3.7" } @@ -1006,8 +1006,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1026,8 +1026,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1046,8 +1046,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1066,8 +1066,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1086,8 +1086,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1106,8 +1106,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1126,8 +1126,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1146,8 +1146,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1166,8 +1166,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } diff --git a/frontend/mock-backend/data/v2/pipeline/protobuf_value_params_v2.json b/frontend/mock-backend/data/v2/pipeline/protobuf_value_params_v2.json index f7cc07b9fca..f75a60e1bc1 100644 --- a/frontend/mock-backend/data/v2/pipeline/protobuf_value_params_v2.json +++ b/frontend/mock-backend/data/v2/pipeline/protobuf_value_params_v2.json @@ -45,8 +45,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.6' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_params(\n int_param: int = 1234, \n double_param: float = 56.78, \n string_param: str = 'lorem ipsum', \n bool_param: bool = True, \n list_string_param: List[str] = ['lorem', 'ipsum'], \n list_int_param: List[int] = [123, 456, 789], \n struct_param: Dict[str, int] = { 'key_1': 12345, 'key_2': 6789 }):\n print(\"int_param: \", int_param)\n print(\"double_param: \", double_param)\n print(\"string_param: \", string_param)\n print(\"bool_param: \", bool_param)\n print(\"list_string_param: \", list_string_param)\n print(\"list_int_param: \", list_int_param)\n print(\"struct_param: \", struct_param)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_params(\n int_param: int = 1234, \n double_param: float = 56.78, \n string_param: str = 'lorem ipsum', \n bool_param: bool = True, \n list_string_param: List[str] = ['lorem', 'ipsum'], \n list_int_param: List[int] = [123, 456, 789], \n struct_param: Dict[str, int] = { 'key_1': 12345, 'key_2': 6789 }):\n print(\"int_param: \", int_param)\n print(\"double_param: \", double_param)\n print(\"string_param: \", string_param)\n print(\"bool_param: \", bool_param)\n print(\"list_string_param: \", list_string_param)\n print(\"list_int_param: \", list_int_param)\n print(\"struct_param: \", struct_param)\n\n" ], "image": "python:3.7" } diff --git a/frontend/src/data/test/mock_lightweight_python_functions_v2_pipeline.json b/frontend/src/data/test/mock_lightweight_python_functions_v2_pipeline.json index 7855e934a16..7597231d5a7 100644 --- a/frontend/src/data/test/mock_lightweight_python_functions_v2_pipeline.json +++ b/frontend/src/data/test/mock_lightweight_python_functions_v2_pipeline.json @@ -107,8 +107,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n" ], "image": "python:3.7" } @@ -127,8 +127,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef train(\n # Use InputPath to get a locally accessible path for the input artifact\n # of type `Dataset`.\n dataset_one_path: InputPath('Dataset'),\n # Use Input[T] to get a metadata-rich handle to the input artifact\n # of type `Dataset`.\n dataset_two: Input[Dataset],\n # An input parameter of type string.\n message: str,\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n model: Output[Model],\n # An input parameter of type bool.\n input_bool: bool,\n # An input parameter of type dict.\n input_dict: Dict[str, int],\n # An input parameter of type List[str].\n input_list: List[str],\n # An input parameter of type int with a default value.\n num_steps: int = 100,\n):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset_one_path, 'r') as input_file:\n dataset_one_contents = input_file.read()\n\n with open(dataset_two.path, 'r') as input_file:\n dataset_two_contents = input_file.read()\n\n line = (f'dataset_one_contents: {dataset_one_contents} || '\n f'dataset_two_contents: {dataset_two_contents} || '\n f'message: {message} || '\n f'input_bool: {input_bool}, type {type(input_bool)} || '\n f'input_dict: {input_dict}, type {type(input_dict)} || '\n f'input_list: {input_list}, type {type(input_list)} \\n')\n\n with open(model.path, 'w') as output_file:\n for i in range(num_steps):\n output_file.write('Step {}\\n{}\\n=====\\n'.format(i, line))\n\n # model is an instance of Model artifact, which has a .metadata dictionary\n # to store arbitrary metadata for the output artifact.\n model.metadata['accuracy'] = 0.9\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef train(\n # Use InputPath to get a locally accessible path for the input artifact\n # of type `Dataset`.\n dataset_one_path: InputPath('Dataset'),\n # Use Input[T] to get a metadata-rich handle to the input artifact\n # of type `Dataset`.\n dataset_two: Input[Dataset],\n # An input parameter of type string.\n message: str,\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n model: Output[Model],\n # An input parameter of type bool.\n input_bool: bool,\n # An input parameter of type dict.\n input_dict: Dict[str, int],\n # An input parameter of type List[str].\n input_list: List[str],\n # An input parameter of type int with a default value.\n num_steps: int = 100,\n):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset_one_path, 'r') as input_file:\n dataset_one_contents = input_file.read()\n\n with open(dataset_two.path, 'r') as input_file:\n dataset_two_contents = input_file.read()\n\n line = (f'dataset_one_contents: {dataset_one_contents} || '\n f'dataset_two_contents: {dataset_two_contents} || '\n f'message: {message} || '\n f'input_bool: {input_bool}, type {type(input_bool)} || '\n f'input_dict: {input_dict}, type {type(input_dict)} || '\n f'input_list: {input_list}, type {type(input_list)} \\n')\n\n with open(model.path, 'w') as output_file:\n for i in range(num_steps):\n output_file.write('Step {}\\n{}\\n=====\\n'.format(i, line))\n\n # model is an instance of Model artifact, which has a .metadata dictionary\n # to store arbitrary metadata for the output artifact.\n model.metadata['accuracy'] = 0.9\n\n" ], "image": "python:3.7" } diff --git a/frontend/src/data/test/pipeline_with_loops_and_conditions.json b/frontend/src/data/test/pipeline_with_loops_and_conditions.json index e0e3bfae237..f2364e2af35 100644 --- a/frontend/src/data/test/pipeline_with_loops_and_conditions.json +++ b/frontend/src/data/test/pipeline_with_loops_and_conditions.json @@ -926,8 +926,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" ], "image": "python:3.7" } @@ -946,8 +946,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" ], "image": "python:3.7" } @@ -966,8 +966,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" ], "image": "python:3.7" } @@ -986,8 +986,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_struct(struct: dict):\n print(struct)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_struct(struct: dict):\n print(struct)\n\n" ], "image": "python:3.7" } @@ -1006,8 +1006,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1026,8 +1026,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1046,8 +1046,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1066,8 +1066,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1086,8 +1086,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1106,8 +1106,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1126,8 +1126,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1146,8 +1146,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1166,8 +1166,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==1.8.9' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } diff --git a/frontend/src/lib/v2/WorkflowUtils.test.ts b/frontend/src/lib/v2/WorkflowUtils.test.ts index 819265daebb..2c8efe452fb 100644 --- a/frontend/src/lib/v2/WorkflowUtils.test.ts +++ b/frontend/src/lib/v2/WorkflowUtils.test.ts @@ -65,8 +65,8 @@ PIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-scr ', 'sh', '-ec', - 'program_path=$(mktemp -d)\nprintf "%s" "$0" > "$program_path/ephemeral_component.py"\npython3 -m kfp.v2.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"\n', - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n", + 'program_path=$(mktemp -d)\nprintf "%s" "$0" > "$program_path/ephemeral_component.py"\npython3 -m kfp.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"\n', + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n", ], image: 'python:3.7', }); diff --git a/samples/core/condition/condition_v2.py b/samples/core/condition/condition_v2.py index d327bb424b9..398bc696d27 100644 --- a/samples/core/condition/condition_v2.py +++ b/samples/core/condition/condition_v2.py @@ -13,7 +13,7 @@ # limitations under the License. import os -from kfp.v2 import dsl +from kfp import dsl # In tests, we install a KFP package from the PR under test. Users should not # normally need to specify `kfp_package_path` in their component definitions. diff --git a/samples/core/loop_output/loop_output_v2.py b/samples/core/loop_output/loop_output_v2.py index 1ba4ab7b930..c7dd4332d5f 100644 --- a/samples/core/loop_output/loop_output_v2.py +++ b/samples/core/loop_output/loop_output_v2.py @@ -13,7 +13,7 @@ # limitations under the License. import os -from kfp.v2 import dsl +from kfp import dsl # In tests, we install a KFP package from the PR under test. Users should not # normally need to specify `kfp_package_path` in their component definitions. @@ -26,7 +26,7 @@ def args_generator_op() -> str: # TODO(Bobgy): how can we make this component with type float? -# got error: kfp.v2.components.types.type_utils.InconsistentTypeException: +# got error: kfp.components.types.type_utils.InconsistentTypeException: # Incompatible argument passed to the input "s" of component "Print op": Argument # type "STRING" is incompatible with the input type "NUMBER_DOUBLE" @dsl.component(kfp_package_path=_KFP_PACKAGE_PATH) diff --git a/samples/core/loop_parameter/loop_parameter_v2.py b/samples/core/loop_parameter/loop_parameter_v2.py index 90306cab9d2..8ff51c24d78 100644 --- a/samples/core/loop_parameter/loop_parameter_v2.py +++ b/samples/core/loop_parameter/loop_parameter_v2.py @@ -1,5 +1,5 @@ import os -from kfp.v2 import dsl +from kfp import dsl # In tests, we install a KFP package from the PR under test. Users should not # normally need to specify `kfp_package_path` in their component definitions. diff --git a/samples/core/loop_static/loop_static_v2.py b/samples/core/loop_static/loop_static_v2.py index eb6355936cd..a5c1eafe9c0 100644 --- a/samples/core/loop_static/loop_static_v2.py +++ b/samples/core/loop_static/loop_static_v2.py @@ -1,5 +1,5 @@ import os -from kfp.v2 import dsl +from kfp import dsl from typing import List # In tests, we install a KFP package from the PR under test. Users should not diff --git a/samples/core/output_a_directory/output_a_directory.py b/samples/core/output_a_directory/output_a_directory.py index 3db9d3cf358..e1dda9f88f0 100644 --- a/samples/core/output_a_directory/output_a_directory.py +++ b/samples/core/output_a_directory/output_a_directory.py @@ -21,8 +21,8 @@ import kfp.deprecated as kfp from kfp.deprecated.components import create_component_from_func, load_component_from_text, InputPath, OutputPath -import kfp.v2 as v2 -from kfp.v2.dsl import Input, Output, Artifact +import kfp as v2 +from kfp.dsl import Input, Output, Artifact # Outputting directories from Python-based components: diff --git a/samples/core/resource_spec/resource_spec_v2.py b/samples/core/resource_spec/resource_spec_v2.py index 1512fba079f..ddf6380ce9a 100644 --- a/samples/core/resource_spec/resource_spec_v2.py +++ b/samples/core/resource_spec/resource_spec_v2.py @@ -13,7 +13,7 @@ # limitations under the License. import os -from kfp.v2 import dsl +from kfp import dsl # In tests, we install a KFP package from the PR under test. Users should not # normally need to specify `kfp_package_path` in their component definitions. diff --git a/samples/test/after.py b/samples/test/after.py index 7bcc68bab77..5c036c42b87 100644 --- a/samples/test/after.py +++ b/samples/test/after.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler component_op = components.load_component_from_text(""" name: Print Text diff --git a/samples/test/fail_v2.py b/samples/test/fail_v2.py index 80bd15f87ea..94a6b1efcce 100644 --- a/samples/test/fail_v2.py +++ b/samples/test/fail_v2.py @@ -13,7 +13,7 @@ # limitations under the License. """Fail pipeline.""" -from kfp.v2 import dsl +from kfp import dsl @dsl.component diff --git a/samples/test/lightweight_python_functions_v2_pipeline.py b/samples/test/lightweight_python_functions_v2_pipeline.py index 03b9331defe..f762f12b18a 100644 --- a/samples/test/lightweight_python_functions_v2_pipeline.py +++ b/samples/test/lightweight_python_functions_v2_pipeline.py @@ -15,9 +15,9 @@ from typing import Dict, List import os -from kfp.v2 import dsl -from kfp.v2.dsl import Input, InputPath, Output, OutputPath, Dataset, Model, component -import kfp.v2.compiler as compiler +from kfp import dsl +from kfp.dsl import Input, InputPath, Output, OutputPath, Dataset, Model, component +import kfp.compiler as compiler # In tests, we install a KFP package from the PR under test. Users should not # normally need to specify `kfp_package_path` in their component definitions. diff --git a/samples/test/lightweight_python_functions_v2_with_outputs.py b/samples/test/lightweight_python_functions_v2_with_outputs.py index 8ef4fb9c0af..3bb74ad6c99 100644 --- a/samples/test/lightweight_python_functions_v2_with_outputs.py +++ b/samples/test/lightweight_python_functions_v2_with_outputs.py @@ -15,8 +15,8 @@ from typing import NamedTuple import os -from kfp.v2 import compiler, dsl -from kfp.v2.dsl import Input, Dataset, Model, Metrics, component +from kfp import compiler, dsl +from kfp.dsl import Input, Dataset, Model, Metrics, component # In tests, we install a KFP package from the PR under test. Users should not # normally need to specify `kfp_package_path` in their component definitions. diff --git a/samples/test/metrics_visualization_v2.py b/samples/test/metrics_visualization_v2.py index 64a41d0f59f..d8abf21160e 100644 --- a/samples/test/metrics_visualization_v2.py +++ b/samples/test/metrics_visualization_v2.py @@ -13,8 +13,8 @@ # limitations under the License. import os -from kfp.v2 import dsl -from kfp.v2.dsl import ( +from kfp import dsl +from kfp.dsl import ( component, Output, ClassificationMetrics, diff --git a/samples/test/placeholder_concat.py b/samples/test/placeholder_concat.py index 86612e202d2..84f07fb2233 100644 --- a/samples/test/placeholder_concat.py +++ b/samples/test/placeholder_concat.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -import kfp.v2.compiler as compiler +from kfp import components +from kfp import dsl +import kfp.compiler as compiler component_op = components.load_component_from_text(""" name: Component with concat placeholder diff --git a/samples/test/placeholder_if_v2.py b/samples/test/placeholder_if_v2.py index 4941f95b17d..f6f5063e2de 100644 --- a/samples/test/placeholder_if_v2.py +++ b/samples/test/placeholder_if_v2.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import dsl, components +from kfp import dsl, components component_op = components.load_component_from_text(''' name: Component with optional inputs diff --git a/samples/test/two_step_with_uri_placeholder.py b/samples/test/two_step_with_uri_placeholder.py index 36a161991fc..6d6ef78139d 100644 --- a/samples/test/two_step_with_uri_placeholder.py +++ b/samples/test/two_step_with_uri_placeholder.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """Two step v2-compatible pipeline with URI placeholders.""" -from kfp.v2 import components, dsl +from kfp import components, dsl write_to_gcs_op = components.load_component_from_text(""" name: write-to-gcs diff --git a/samples/test/utils/kfp/samples/test/utils.py b/samples/test/utils/kfp/samples/test/utils.py index 42516becc84..61168144ea8 100644 --- a/samples/test/utils/kfp/samples/test/utils.py +++ b/samples/test/utils/kfp/samples/test/utils.py @@ -32,7 +32,7 @@ import kfp from kfp.deprecated.onprem import add_default_resource_spec -import kfp.v2.compiler +import kfp.compiler import kfp_server_api from ml_metadata import metadata_store from ml_metadata.metadata_store.metadata_store import ListOptions @@ -389,14 +389,14 @@ def run_v2_pipeline( original_pipeline_spec = tempfile.mktemp( suffix='.json', prefix="original_pipeline_spec") if fn: - kfp.v2.compiler.Compiler().compile( + kfp.compiler.Compiler().compile( pipeline_func=fn, package_path=original_pipeline_spec) else: pyfile = file if file.endswith(".ipynb"): pyfile = tempfile.mktemp(suffix='.py', prefix="pipeline_py_code") _nb_sample_to_py(file, pyfile) - from kfp.v2.compiler.main import compile_pyfile + from kfp.compiler.main import compile_pyfile compile_pyfile(pyfile=pyfile, package_path=original_pipeline_spec) # remove following overriding logic once we use create_run_from_job_spec to trigger kfp pipeline run diff --git a/samples/v2/hello_world.py b/samples/v2/hello_world.py index 4df0a98863e..d4044ed6add 100644 --- a/samples/v2/hello_world.py +++ b/samples/v2/hello_world.py @@ -13,8 +13,8 @@ # limitations under the License. import os -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import dsl +from kfp import compiler # In tests, we install a KFP package from the PR under test. Users should not # normally need to specify `kfp_package_path` in their component definitions. diff --git a/samples/v2/lightweight_python_functions_v2_pipeline/lightweight_python_functions_v2_pipeline.py b/samples/v2/lightweight_python_functions_v2_pipeline/lightweight_python_functions_v2_pipeline.py index 5d0f137a580..20f62ea7e54 100644 --- a/samples/v2/lightweight_python_functions_v2_pipeline/lightweight_python_functions_v2_pipeline.py +++ b/samples/v2/lightweight_python_functions_v2_pipeline/lightweight_python_functions_v2_pipeline.py @@ -14,9 +14,9 @@ """Sample pipeline for passing data in KFP v2.""" from typing import Dict, List -from kfp.v2 import compiler -from kfp.v2 import dsl -from kfp.v2.dsl import Input, InputPath, Output, OutputPath, Dataset, Model, component +from kfp import compiler +from kfp import dsl +from kfp.dsl import Input, InputPath, Output, OutputPath, Dataset, Model, component @component diff --git a/samples/v2/pipeline_with_importer.py b/samples/v2/pipeline_with_importer.py index af646a7b18a..49c4ff5989e 100644 --- a/samples/v2/pipeline_with_importer.py +++ b/samples/v2/pipeline_with_importer.py @@ -15,8 +15,8 @@ import os from typing import NamedTuple -from kfp.v2 import compiler, dsl -from kfp.v2.dsl import Dataset, Input, Model, component, importer +from kfp import compiler, dsl +from kfp.dsl import Dataset, Input, Model, component, importer # In tests, we install a KFP package from the PR under test. Users should not # normally need to specify `kfp_package_path` in their component definitions. diff --git a/samples/v2/producer_consumer_param.py b/samples/v2/producer_consumer_param.py index d27b563a355..ce299c54af1 100644 --- a/samples/v2/producer_consumer_param.py +++ b/samples/v2/producer_consumer_param.py @@ -13,7 +13,7 @@ # limitations under the License. # Simple two-step pipeline with 'producer' and 'consumer' steps -from kfp.v2 import components, compiler, dsl +from kfp import components, compiler, dsl producer_op = components.load_component_from_text(""" name: Producer diff --git a/sdk/RELEASE.md b/sdk/RELEASE.md index 54352a68ad3..802fc102f63 100644 --- a/sdk/RELEASE.md +++ b/sdk/RELEASE.md @@ -464,7 +464,7 @@ ## Breaking Changes -* `kfp.v2.components`no longer imports everything from `kfp.components`. For instance, `load_component_from_*` methods are available only from `kfp.components`, but not from `kfp.v2.components`. +* `kfp.components`no longer imports everything from `kfp.components`. For instance, `load_component_from_*` methods are available only from `kfp.components`, but not from `kfp.components`. * No more ['_path' suffix striping](https://github.com/kubeflow/pipelines/issues/5279) from v2 components. ### For Pipeline Authors diff --git a/sdk/python/kfp/__init__.py b/sdk/python/kfp/__init__.py index 33c61dae084..7a44426a159 100644 --- a/sdk/python/kfp/__init__.py +++ b/sdk/python/kfp/__init__.py @@ -19,6 +19,6 @@ __version__ = '2.0.0b0' TYPE_CHECK = True -# COMPILING_FOR_V2 is True when using kfp.v2.compiler or use (v1) kfp.compiler +# COMPILING_FOR_V2 is True when using kfp.compiler or use (v1) kfp.compiler # with V2_COMPATIBLE or V2_ENGINE mode COMPILING_FOR_V2 = False diff --git a/sdk/python/kfp/v2/compiler/__init__.py b/sdk/python/kfp/compiler/__init__.py similarity index 92% rename from sdk/python/kfp/v2/compiler/__init__.py rename to sdk/python/kfp/compiler/__init__.py index 01d0d8b090a..1932f13ce1d 100644 --- a/sdk/python/kfp/v2/compiler/__init__.py +++ b/sdk/python/kfp/compiler/__init__.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2.compiler.compiler import Compiler +from kfp.compiler.compiler import Compiler diff --git a/sdk/python/kfp/v2/compiler/compiler.py b/sdk/python/kfp/compiler/compiler.py similarity index 98% rename from sdk/python/kfp/v2/compiler/compiler.py rename to sdk/python/kfp/compiler/compiler.py index 272969467e1..44f7f05abf1 100644 --- a/sdk/python/kfp/v2/compiler/compiler.py +++ b/sdk/python/kfp/compiler/compiler.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""KFP DSL v2 compiler. +"""KFP DSL compiler. This is an experimental implementation of KFP compiler that compiles KFP pipeline into Pipeline IR: @@ -28,17 +28,17 @@ import kfp.deprecated as kfp from google.protobuf import json_format from kfp.pipeline_spec import pipeline_spec_pb2 -from kfp.v2 import dsl -from kfp.v2.compiler import pipeline_spec_builder as builder -from kfp.v2.components import utils as component_utils -from kfp.v2.components import component_factory -from kfp.v2.components import for_loop -from kfp.v2.components import pipeline_channel -from kfp.v2.components import pipeline_context -from kfp.v2.components import pipeline_task -from kfp.v2.components import tasks_group -from kfp.v2.components.types import artifact_types -from kfp.v2.components.types import type_utils +from kfp import dsl +from kfp.compiler import pipeline_spec_builder as builder +from kfp.components import utils as component_utils +from kfp.components import component_factory +from kfp.components import for_loop +from kfp.components import pipeline_channel +from kfp.components import pipeline_context +from kfp.components import pipeline_task +from kfp.components import tasks_group +from kfp.components.types import artifact_types +from kfp.components.types import type_utils _GroupOrTask = Union[tasks_group.TasksGroup, pipeline_task.PipelineTask] @@ -62,7 +62,7 @@ class Compiler: def my_pipeline(a: int = 1, b: str = "default value"): ... - kfp.v2.compiler.Compiler().compile( + kfp.compiler.Compiler().compile( pipeline_func=my_pipeline, package_path='path/to/pipeline.json', ) @@ -91,7 +91,7 @@ def compile( type_check_old_value = kfp.TYPE_CHECK try: kfp.TYPE_CHECK = type_check - pipeline_spec = self._create_pipeline_v2( + pipeline_spec = self._create_pipeline( pipeline_func=pipeline_func, pipeline_name=pipeline_name, pipeline_parameters_override=pipeline_parameters, @@ -103,7 +103,7 @@ def compile( finally: kfp.TYPE_CHECK = type_check_old_value - def _create_pipeline_v2( + def _create_pipeline( self, pipeline_func: Callable[..., Any], pipeline_name: Optional[str] = None, diff --git a/sdk/python/kfp/v2/compiler/compiler_test.py b/sdk/python/kfp/compiler/compiler_test.py similarity index 98% rename from sdk/python/kfp/v2/compiler/compiler_test.py rename to sdk/python/kfp/compiler/compiler_test.py index c138113535e..29ca17fc976 100644 --- a/sdk/python/kfp/v2/compiler/compiler_test.py +++ b/sdk/python/kfp/compiler/compiler_test.py @@ -19,11 +19,11 @@ import unittest from absl.testing import parameterized -from kfp.v2 import components -from kfp.v2 import compiler -from kfp.v2 import dsl -from kfp.v2.components.types import type_utils -from kfp.v2.dsl import PipelineTaskFinalStatus +from kfp import components +from kfp import compiler +from kfp import dsl +from kfp.components.types import type_utils +from kfp.dsl import PipelineTaskFinalStatus VALID_PRODUCER_COMPONENT_SAMPLE = components.load_component_from_text(""" name: producer @@ -127,7 +127,7 @@ def test_compile_pipeline_with_dsl_graph_component_should_raise_error(self): with self.assertRaisesRegex( AttributeError, - "module 'kfp.v2.dsl' has no attribute 'graph_component'"): + "module 'kfp.dsl' has no attribute 'graph_component'"): @dsl.graph_component def flip_coin_graph_component(): diff --git a/sdk/python/kfp/v2/compiler/main.py b/sdk/python/kfp/compiler/main.py similarity index 98% rename from sdk/python/kfp/v2/compiler/main.py rename to sdk/python/kfp/compiler/main.py index 4521d907804..bae9d12801e 100644 --- a/sdk/python/kfp/v2/compiler/main.py +++ b/sdk/python/kfp/compiler/main.py @@ -20,8 +20,8 @@ from typing import Any, Callable, List, Mapping, Optional import kfp.deprecated.dsl as dsl -from kfp.v2 import compiler -from kfp.v2.components import pipeline_context +from kfp import compiler +from kfp.components import pipeline_context def parse_arguments() -> argparse.Namespace: diff --git a/sdk/python/kfp/v2/compiler/pipeline_spec_builder.py b/sdk/python/kfp/compiler/pipeline_spec_builder.py similarity index 99% rename from sdk/python/kfp/v2/compiler/pipeline_spec_builder.py rename to sdk/python/kfp/compiler/pipeline_spec_builder.py index d650dba2f49..1c5fc41fdf9 100644 --- a/sdk/python/kfp/v2/compiler/pipeline_spec_builder.py +++ b/sdk/python/kfp/compiler/pipeline_spec_builder.py @@ -18,14 +18,14 @@ from google.protobuf import struct_pb2 from kfp.pipeline_spec import pipeline_spec_pb2 -from kfp.v2.components import utils as component_utils -from kfp.v2.components import for_loop -from kfp.v2.components import pipeline_channel -from kfp.v2.components import pipeline_task -from kfp.v2.components import placeholders -from kfp.v2.components import tasks_group -from kfp.v2.components.types import artifact_types -from kfp.v2.components.types import type_utils +from kfp.components import utils as component_utils +from kfp.components import for_loop +from kfp.components import pipeline_channel +from kfp.components import pipeline_task +from kfp.components import placeholders +from kfp.components import tasks_group +from kfp.components.types import artifact_types +from kfp.components.types import type_utils _GroupOrTask = Union[tasks_group.TasksGroup, pipeline_task.PipelineTask] diff --git a/sdk/python/kfp/v2/compiler/pipeline_spec_builder_test.py b/sdk/python/kfp/compiler/pipeline_spec_builder_test.py similarity index 96% rename from sdk/python/kfp/v2/compiler/pipeline_spec_builder_test.py rename to sdk/python/kfp/compiler/pipeline_spec_builder_test.py index 6e14fc58606..a982901fcb4 100644 --- a/sdk/python/kfp/v2/compiler/pipeline_spec_builder_test.py +++ b/sdk/python/kfp/compiler/pipeline_spec_builder_test.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.compiler.pipeline_spec_builder.""" +"""Tests for kfp.compiler.pipeline_spec_builder.""" import unittest @@ -19,9 +19,9 @@ from google.protobuf import json_format from google.protobuf import struct_pb2 from kfp.pipeline_spec import pipeline_spec_pb2 -from kfp.v2.compiler import pipeline_spec_builder -from kfp.v2.components import pipeline_channel -from kfp.v2.components import structures +from kfp.compiler import pipeline_spec_builder +from kfp.components import pipeline_channel +from kfp.components import structures class PipelineSpecBuilderTest(parameterized.TestCase): diff --git a/sdk/python/kfp/v2/compiler_cli_tests/README.md b/sdk/python/kfp/compiler_cli_tests/README.md similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/README.md rename to sdk/python/kfp/compiler_cli_tests/README.md diff --git a/sdk/python/kfp/v2/compiler_cli_tests/__init__.py b/sdk/python/kfp/compiler_cli_tests/__init__.py similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/__init__.py rename to sdk/python/kfp/compiler_cli_tests/__init__.py diff --git a/sdk/python/kfp/v2/compiler_cli_tests/compiler_cli_tests.py b/sdk/python/kfp/compiler_cli_tests/compiler_cli_tests.py similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/compiler_cli_tests.py rename to sdk/python/kfp/compiler_cli_tests/compiler_cli_tests.py diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/add_component.yaml b/sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/add_component.yaml similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/add_component.yaml rename to sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/add_component.yaml diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/concat_placeholder_component.yaml b/sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/concat_placeholder_component.yaml similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/concat_placeholder_component.yaml rename to sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/concat_placeholder_component.yaml diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/fancy_trainer_component.yaml b/sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/fancy_trainer_component.yaml similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/fancy_trainer_component.yaml rename to sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/fancy_trainer_component.yaml diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/if_placeholder_component.yaml b/sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/if_placeholder_component.yaml similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/if_placeholder_component.yaml rename to sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/if_placeholder_component.yaml diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/ingestion_component.yaml b/sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/ingestion_component.yaml similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/ingestion_component.yaml rename to sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/ingestion_component.yaml diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/serving_component.yaml b/sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/serving_component.yaml similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/serving_component.yaml rename to sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/serving_component.yaml diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/trainer_component.yaml b/sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/trainer_component.yaml similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/component_yaml/trainer_component.yaml rename to sdk/python/kfp/compiler_cli_tests/test_data/component_yaml/trainer_component.yaml diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.json b/sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.json similarity index 60% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.json rename to sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.json index 822cf38cb3e..9cf40fa8fb9 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.json @@ -107,8 +107,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef preprocess(\n # An input parameter of type string.\n message: str,\n # An input parameter of type dict.\n input_dict_parameter: Dict[str, int],\n # An input parameter of type list.\n input_list_parameter: List[str],\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n output_dataset_one: Output[Dataset],\n # A locally accessible filepath for another output artifact of type\n # `Dataset`.\n output_dataset_two_path: OutputPath('Dataset'),\n # A locally accessible filepath for an output parameter of type string.\n output_parameter_path: OutputPath(str),\n # A locally accessible filepath for an output parameter of type bool.\n output_bool_parameter_path: OutputPath(bool),\n # A locally accessible filepath for an output parameter of type dict.\n output_dict_parameter_path: OutputPath(Dict[str, int]),\n # A locally accessible filepath for an output parameter of type list.\n output_list_parameter_path: OutputPath(List[str]),\n):\n \"\"\"Dummy preprocessing step.\"\"\"\n\n # Use Dataset.path to access a local file path for writing.\n # One can also use Dataset.uri to access the actual URI file path.\n with open(output_dataset_one.path, 'w') as f:\n f.write(message)\n\n # OutputPath is used to just pass the local file path of the output artifact\n # to the function.\n with open(output_dataset_two_path, 'w') as f:\n f.write(message)\n\n with open(output_parameter_path, 'w') as f:\n f.write(message)\n\n with open(output_bool_parameter_path, 'w') as f:\n f.write(\n str(True)) # use either `str()` or `json.dumps()` for bool values.\n\n import json\n with open(output_dict_parameter_path, 'w') as f:\n f.write(json.dumps(input_dict_parameter))\n\n with open(output_list_parameter_path, 'w') as f:\n f.write(json.dumps(input_list_parameter))\n\n" ], "image": "python:3.7" } @@ -127,8 +127,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef train(\n # Use InputPath to get a locally accessible path for the input artifact\n # of type `Dataset`.\n dataset_one_path: InputPath('Dataset'),\n # Use Input[T] to get a metadata-rich handle to the input artifact\n # of type `Dataset`.\n dataset_two: Input[Dataset],\n # An input parameter of type string.\n message: str,\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n model: Output[Model],\n # An input parameter of type bool.\n input_bool: bool,\n # An input parameter of type dict.\n input_dict: Dict[str, int],\n # An input parameter of type List[str].\n input_list: List[str],\n # An input parameter of type int with a default value.\n num_steps: int = 100,\n):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset_one_path, 'r') as input_file:\n dataset_one_contents = input_file.read()\n\n with open(dataset_two.path, 'r') as input_file:\n dataset_two_contents = input_file.read()\n\n line = (f'dataset_one_contents: {dataset_one_contents} || '\n f'dataset_two_contents: {dataset_two_contents} || '\n f'message: {message} || '\n f'input_bool: {input_bool}, type {type(input_bool)} || '\n f'input_dict: {input_dict}, type {type(input_dict)} || '\n f'input_list: {input_list}, type {type(input_list)} \\n')\n\n with open(model.path, 'w') as output_file:\n for i in range(num_steps):\n output_file.write('Step {}\\n{}\\n=====\\n'.format(i, line))\n\n # model is an instance of Model artifact, which has a .metadata dictionary\n # to store arbitrary metadata for the output artifact.\n model.metadata['accuracy'] = 0.9\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef train(\n # Use InputPath to get a locally accessible path for the input artifact\n # of type `Dataset`.\n dataset_one_path: InputPath('Dataset'),\n # Use Input[T] to get a metadata-rich handle to the input artifact\n # of type `Dataset`.\n dataset_two: Input[Dataset],\n # An input parameter of type string.\n message: str,\n # Use Output[T] to get a metadata-rich handle to the output artifact\n # of type `Dataset`.\n model: Output[Model],\n # An input parameter of type bool.\n input_bool: bool,\n # An input parameter of type dict.\n input_dict: Dict[str, int],\n # An input parameter of type List[str].\n input_list: List[str],\n # An input parameter of type int with a default value.\n num_steps: int = 100,\n):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset_one_path, 'r') as input_file:\n dataset_one_contents = input_file.read()\n\n with open(dataset_two.path, 'r') as input_file:\n dataset_two_contents = input_file.read()\n\n line = (f'dataset_one_contents: {dataset_one_contents} || '\n f'dataset_two_contents: {dataset_two_contents} || '\n f'message: {message} || '\n f'input_bool: {input_bool}, type {type(input_bool)} || '\n f'input_dict: {input_dict}, type {type(input_dict)} || '\n f'input_list: {input_list}, type {type(input_list)} \\n')\n\n with open(model.path, 'w') as output_file:\n for i in range(num_steps):\n output_file.write('Step {}\\n{}\\n=====\\n'.format(i, line))\n\n # model is an instance of Model artifact, which has a .metadata dictionary\n # to store arbitrary metadata for the output artifact.\n model.metadata['accuracy'] = 0.9\n\n" ], "image": "python:3.7" } @@ -245,5 +245,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.py b/sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.py similarity index 96% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.py rename to sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.py index 103b2131184..40d73037103 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_pipeline.py @@ -11,12 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Sample pipeline for passing data in KFP v2.""" +"""Sample pipeline for passing data in KFP.""" from typing import Dict, List -from kfp.v2 import compiler -from kfp.v2 import dsl -from kfp.v2.dsl import (Dataset, Input, InputPath, Model, Output, OutputPath, +from kfp import compiler +from kfp import dsl +from kfp.dsl import (Dataset, Input, InputPath, Model, Output, OutputPath, component) diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.json b/sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.json similarity index 79% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.json rename to sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.json index f76b13e5b9f..42bbba87ec8 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.json @@ -115,8 +115,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef add_numbers(first: int, second: int) -> int:\n return first + second\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef add_numbers(first: int, second: int) -> int:\n return first + second\n\n" ], "image": "python:3.7" } @@ -135,8 +135,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef concat_message(first: str, second: str) -> str:\n return first + second\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef concat_message(first: str, second: str) -> str:\n return first + second\n\n" ], "image": "python:3.7" } @@ -155,8 +155,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef output_artifact(number: int, message: str) -> Dataset:\n result = [message for _ in range(number)]\n return '\\n'.join(result)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef output_artifact(number: int, message: str) -> Dataset:\n result = [message for _ in range(number)]\n return '\\n'.join(result)\n\n" ], "image": "python:3.7" } @@ -175,8 +175,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef output_named_tuple(\n artifact: Input[Dataset]\n) -> NamedTuple('Outputs', [\n ('scalar', str),\n ('metrics', Metrics),\n ('model', Model),\n]):\n scalar = \"123\"\n\n import json\n metrics = json.dumps({\n 'metrics': [{\n 'name': 'accuracy',\n 'numberValue': 0.9,\n 'format': \"PERCENTAGE\",\n }]\n })\n\n with open(artifact.path, 'r') as f:\n artifact_contents = f.read()\n model = \"Model contents: \" + artifact_contents\n\n from collections import namedtuple\n output = namedtuple('Outputs', ['scalar', 'metrics', 'model'])\n return output(scalar, metrics, model)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef output_named_tuple(\n artifact: Input[Dataset]\n) -> NamedTuple('Outputs', [\n ('scalar', str),\n ('metrics', Metrics),\n ('model', Model),\n]):\n scalar = \"123\"\n\n import json\n metrics = json.dumps({\n 'metrics': [{\n 'name': 'accuracy',\n 'numberValue': 0.9,\n 'format': \"PERCENTAGE\",\n }]\n })\n\n with open(artifact.path, 'r') as f:\n artifact_contents = f.read()\n model = \"Model contents: \" + artifact_contents\n\n from collections import namedtuple\n output = namedtuple('Outputs', ['scalar', 'metrics', 'model'])\n return output(scalar, metrics, model)\n\n" ], "image": "python:3.7" } @@ -328,5 +328,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.py b/sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.py similarity index 95% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.py rename to sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.py index 811cc647b58..3f2056ebd68 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/lightweight_python_functions_v2_with_outputs.py @@ -14,9 +14,9 @@ """Lightweight functions v2 with outputs.""" from typing import NamedTuple -from kfp.v2 import compiler -from kfp.v2 import dsl -from kfp.v2.dsl import component, Input, Dataset, Model, Metrics +from kfp import compiler +from kfp import dsl +from kfp.dsl import component, Input, Dataset, Model, Metrics @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_after.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_after.json similarity index 99% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_after.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_after.json index 61b1c6af868..7b528973fb6 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_after.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_after.json @@ -146,5 +146,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_after.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_after.py similarity index 93% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_after.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_after.py index f4249568217..809e039dc1a 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_after.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_after.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler component_op = components.load_component_from_text(""" name: Print Text diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.json similarity index 97% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.json index 780ba6bc193..a8588ccfcef 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.json @@ -55,5 +55,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.py similarity index 93% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.py index 1d84ba238f9..f4b7ad014df 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_concat_placeholder.py @@ -14,9 +14,9 @@ import pathlib -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler test_data_dir = pathlib.Path(__file__).parent / 'component_yaml' component_op = components.load_component_from_file( diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_condition.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_condition.json similarity index 78% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_condition.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_condition.json index fb1dee75633..6226dfc5757 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_condition.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_condition.json @@ -135,8 +135,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" ], "image": "python:3.7" } @@ -155,8 +155,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" ], "image": "python:3.7" } @@ -175,8 +175,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" ], "image": "python:3.7" } @@ -195,8 +195,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" ], "image": "python:3.7" } @@ -215,8 +215,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" ], "image": "python:3.7" } @@ -301,5 +301,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_condition.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_condition.py similarity index 92% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_condition.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_condition.py index 1da5ac783a7..e40294b5e80 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_condition.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_condition.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler -from kfp.v2.dsl import component +from kfp import components +from kfp import dsl +from kfp import compiler +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_env.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_env.json similarity index 83% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_env.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_env.json index b2df9240e38..cfa294eb896 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_env.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_env.json @@ -44,8 +44,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_env_op():\n import os\n print(os.environ['ENV1'])\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_env_op():\n import os\n print(os.environ['ENV1'])\n\n" ], "env": [ { @@ -90,5 +90,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_env.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_env.py similarity index 92% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_env.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_env.py index 5598b050fcf..87383a03d86 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_env.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_env.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler -from kfp.v2.dsl import component +from kfp import components +from kfp import dsl +from kfp import compiler +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_exit_handler.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_exit_handler.json similarity index 80% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_exit_handler.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_exit_handler.json index 34d8770d503..4e7027109ce 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_exit_handler.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_exit_handler.json @@ -98,8 +98,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef fail_op(message: str):\n \"\"\"Fails.\"\"\"\n import sys\n print(message)\n sys.exit(1)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef fail_op(message: str):\n \"\"\"Fails.\"\"\"\n import sys\n print(message)\n sys.exit(1)\n\n" ], "image": "python:3.7" } @@ -118,8 +118,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n" ], "image": "python:3.7" } @@ -138,8 +138,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n" ], "image": "python:3.7" } @@ -205,5 +205,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_exit_handler.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_exit_handler.py similarity index 93% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_exit_handler.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_exit_handler.py index c8bdba7ad5a..89d585308eb 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_exit_handler.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_exit_handler.py @@ -13,9 +13,9 @@ # limitations under the License. """Pipeline using ExitHandler.""" -from kfp.v2 import dsl -from kfp.v2 import compiler -from kfp.v2.dsl import component +from kfp import dsl +from kfp import compiler +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_gcpc_types.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_gcpc_types.json similarity index 86% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_gcpc_types.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_gcpc_types.json index f5255ec95ec..bbe89d99950 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_gcpc_types.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_gcpc_types.json @@ -43,8 +43,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef consumer_op(model: Input[VertexModel]):\n pass\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef consumer_op(model: Input[VertexModel]):\n pass\n\n" ], "image": "python:3.7" } @@ -107,5 +107,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_gcpc_types.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_gcpc_types.py similarity index 90% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_gcpc_types.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_gcpc_types.py index e99aa8485b0..20862c4d76d 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_gcpc_types.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_gcpc_types.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2.dsl import component, Input, Output -from kfp.v2 import compiler -from kfp.v2 import dsl +from kfp import components +from kfp.dsl import component, Input, Output +from kfp import compiler +from kfp import dsl class VertexModel(dsl.Artifact): diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_if_placeholder.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_if_placeholder.json similarity index 98% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_if_placeholder.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_if_placeholder.json index 32665fd1e22..222eb9c1874 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_if_placeholder.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_if_placeholder.json @@ -76,5 +76,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_if_placeholder.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_if_placeholder.py similarity index 93% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_if_placeholder.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_if_placeholder.py index 5f29cd29911..367ab7eaad0 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_if_placeholder.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_if_placeholder.py @@ -14,9 +14,9 @@ import pathlib -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler test_data_dir = pathlib.Path(__file__).parent / 'component_yaml' component_op = components.load_component_from_file( diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_importer.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_importer.json similarity index 83% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_importer.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_importer.json index 6d94c264f82..00f6cf83e8f 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_importer.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_importer.json @@ -198,8 +198,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef train(\n dataset: Input[Dataset]\n) -> NamedTuple('Outputs', [\n ('scalar', str),\n ('model', Model),\n]):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset.path, 'r') as f:\n data = f.read()\n print('Dataset:', data)\n\n scalar = '123'\n model = 'My model trained using data: {}'.format(data)\n\n from collections import namedtuple\n output = namedtuple('Outputs', ['scalar', 'model'])\n return output(scalar, model)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef train(\n dataset: Input[Dataset]\n) -> NamedTuple('Outputs', [\n ('scalar', str),\n ('model', Model),\n]):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset.path, 'r') as f:\n data = f.read()\n print('Dataset:', data)\n\n scalar = '123'\n model = 'My model trained using data: {}'.format(data)\n\n from collections import namedtuple\n output = namedtuple('Outputs', ['scalar', 'model'])\n return output(scalar, model)\n\n" ], "image": "python:3.7" } @@ -218,8 +218,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef train(\n dataset: Input[Dataset]\n) -> NamedTuple('Outputs', [\n ('scalar', str),\n ('model', Model),\n]):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset.path, 'r') as f:\n data = f.read()\n print('Dataset:', data)\n\n scalar = '123'\n model = 'My model trained using data: {}'.format(data)\n\n from collections import namedtuple\n output = namedtuple('Outputs', ['scalar', 'model'])\n return output(scalar, model)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef train(\n dataset: Input[Dataset]\n) -> NamedTuple('Outputs', [\n ('scalar', str),\n ('model', Model),\n]):\n \"\"\"Dummy Training step.\"\"\"\n with open(dataset.path, 'r') as f:\n data = f.read()\n print('Dataset:', data)\n\n scalar = '123'\n model = 'My model trained using data: {}'.format(data)\n\n from collections import namedtuple\n output = namedtuple('Outputs', ['scalar', 'model'])\n return output(scalar, model)\n\n" ], "image": "python:3.7" } @@ -315,5 +315,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_importer.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_importer.py similarity index 94% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_importer.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_importer.py index 46d5a12ef6f..edc476dacf3 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_importer.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_importer.py @@ -14,9 +14,9 @@ """Pipeline using dsl.importer.""" from typing import NamedTuple -from kfp.v2 import compiler -from kfp.v2 import dsl -from kfp.v2.dsl import component, importer, Dataset, Model, Input +from kfp import compiler +from kfp import dsl +from kfp.dsl import component, importer, Dataset, Model, Input @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops.json similarity index 82% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops.json index 98c21914203..2bb3484e081 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops.json @@ -272,8 +272,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> List[Dict[str, str]]:\n return [{'A_a': '1', 'B_b': '2'}, {'A_a': '10', 'B_b': '20'}]\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> List[Dict[str, str]]:\n return [{'A_a': '1', 'B_b': '2'}, {'A_a': '10', 'B_b': '20'}]\n\n" ], "image": "python:3.7" } @@ -292,8 +292,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_struct(struct: Dict):\n print(struct)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_struct(struct: Dict):\n print(struct)\n\n" ], "image": "python:3.7" } @@ -312,8 +312,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_struct(struct: Dict):\n print(struct)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_struct(struct: Dict):\n print(struct)\n\n" ], "image": "python:3.7" } @@ -332,8 +332,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" ], "image": "python:3.7" } @@ -352,8 +352,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" ], "image": "python:3.7" } @@ -372,8 +372,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" ], "image": "python:3.7" } @@ -392,8 +392,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" ], "image": "python:3.7" } @@ -412,8 +412,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str):\n print(msg)\n\n" ], "image": "python:3.7" } @@ -510,5 +510,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops.py similarity index 96% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops.py index 6f171469b20..f6def512f1b 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops.py @@ -14,8 +14,8 @@ from typing import Dict, List -from kfp.v2 import compiler, dsl -from kfp.v2.dsl import component +from kfp import compiler, dsl +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.json similarity index 87% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.json index f2d831afdc5..5519ce156d7 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.json @@ -926,8 +926,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" ], "image": "python:3.7" } @@ -946,8 +946,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef args_generator_op() -> list:\n return [\n {\n 'A_a': '1',\n 'B_b': ['2', '20'],\n },\n {\n 'A_a': '10',\n 'B_b': ['22', '222'],\n },\n ]\n\n" ], "image": "python:3.7" } @@ -966,8 +966,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" ], "image": "python:3.7" } @@ -986,8 +986,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_struct(struct: dict):\n print(struct)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_struct(struct: dict):\n print(struct)\n\n" ], "image": "python:3.7" } @@ -1006,8 +1006,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1026,8 +1026,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1046,8 +1046,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1066,8 +1066,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1086,8 +1086,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1106,8 +1106,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1126,8 +1126,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1146,8 +1146,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1166,8 +1166,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_text(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -1292,5 +1292,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.py similarity index 97% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.py index 0c2629d9e22..c1515e69a6d 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_loops_and_conditions.py @@ -14,8 +14,8 @@ from typing import Optional -from kfp.v2 import compiler, dsl -from kfp.v2.dsl import component +from kfp import compiler, dsl +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.json similarity index 81% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.json index ed8631ab6ea..661049d6e40 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.json @@ -90,8 +90,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef output_metrics(metrics: Output[Metrics]):\n \"\"\"Dummy component that outputs metrics with a random accuracy.\"\"\"\n import random\n result = random.randint(0, 100)\n metrics.log_metric('accuracy', result)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef output_metrics(metrics: Output[Metrics]):\n \"\"\"Dummy component that outputs metrics with a random accuracy.\"\"\"\n import random\n result = random.randint(0, 100)\n metrics.log_metric('accuracy', result)\n\n" ], "image": "python:3.7" } @@ -110,8 +110,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef output_metrics(metrics: Output[Metrics]):\n \"\"\"Dummy component that outputs metrics with a random accuracy.\"\"\"\n import random\n result = random.randint(0, 100)\n metrics.log_metric('accuracy', result)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef output_metrics(metrics: Output[Metrics]):\n \"\"\"Dummy component that outputs metrics with a random accuracy.\"\"\"\n import random\n result = random.randint(0, 100)\n metrics.log_metric('accuracy', result)\n\n" ], "image": "python:3.7" } @@ -189,5 +189,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.py similarity index 89% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.py index 559fd033a4b..f8ee28693f1 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_metrics_outputs.py @@ -15,10 +15,10 @@ from typing import NamedTuple -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler -from kfp.v2.dsl import component, Dataset, Input, Metrics, Output +from kfp import components +from kfp import dsl +from kfp import compiler +from kfp.dsl import component, Dataset, Input, Metrics, Output @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions.json similarity index 78% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions.json index 530b2a8499c..ad8216dff19 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions.json @@ -232,8 +232,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" ], "image": "python:3.7" } @@ -252,8 +252,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" ], "image": "python:3.7" } @@ -272,8 +272,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" ], "image": "python:3.7" } @@ -292,8 +292,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef flip_coin_op() -> str:\n \"\"\"Flip a coin and output heads or tails randomly.\"\"\"\n import random\n result = 'heads' if random.randint(0, 1) == 0 else 'tails'\n return result\n\n" ], "image": "python:3.7" } @@ -312,8 +312,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" ], "image": "python:3.7" } @@ -332,8 +332,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" ], "image": "python:3.7" } @@ -352,8 +352,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" ], "image": "python:3.7" } @@ -372,8 +372,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str):\n \"\"\"Print a message.\"\"\"\n print(msg)\n\n" ], "image": "python:3.7" } @@ -491,5 +491,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions.py similarity index 92% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions.py index 1ffd531be2e..427c578bcb4 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler -from kfp.v2.dsl import component +from kfp import components +from kfp import dsl +from kfp import compiler +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.json similarity index 99% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.json index e419c688cb7..78fc3594abf 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.json @@ -536,5 +536,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.py similarity index 97% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.py index e378f135b20..291017744ba 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_conditions_yaml.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler def random_num_op(low, high): diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_loops.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_loops.json similarity index 87% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_loops.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_loops.json index f348e3d3fc6..eb387ec397d 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_loops.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_loops.json @@ -218,8 +218,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -238,8 +238,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -258,8 +258,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, msg2: Optional[str] = None):\n print(f'msg: {msg}, msg2: {msg2}')\n\n" ], "image": "python:3.7" } @@ -342,5 +342,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_loops.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_loops.py similarity index 96% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_loops.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_loops.py index fe03d7bf4a0..a1aac16c2ef 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_nested_loops.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_nested_loops.py @@ -14,8 +14,8 @@ from typing import Optional -from kfp.v2 import compiler, dsl -from kfp.v2.dsl import component +from kfp import compiler, dsl +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_ontology.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_ontology.json similarity index 99% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_ontology.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_ontology.json index c97f55c7b60..4efd952a14d 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_ontology.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_ontology.json @@ -159,5 +159,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_ontology.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_ontology.py similarity index 94% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_ontology.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_ontology.py index 32ebfad5b45..d85de20c170 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_ontology.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_ontology.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler import pathlib test_data_dir = pathlib.Path(__file__).parent / 'component_yaml' diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_params_containing_format.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_params_containing_format.json similarity index 84% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_params_containing_format.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_params_containing_format.json index f66b85256e3..9824565ddb1 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_params_containing_format.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_params_containing_format.json @@ -113,8 +113,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(text: str) -> str:\n print(text)\n return text\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(text: str) -> str:\n print(text)\n return text\n\n" ], "image": "python:3.7" } @@ -133,8 +133,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(text: str) -> str:\n print(text)\n return text\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(text: str) -> str:\n print(text)\n return text\n\n" ], "image": "python:3.7" } @@ -153,8 +153,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op2(text1: str, text2: str) -> str:\n print(text1 + text2)\n return text1 + text2\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op2(text1: str, text2: str) -> str:\n print(text1 + text2)\n return text1 + text2\n\n" ], "image": "python:3.7" } @@ -251,5 +251,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_params_containing_format.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_params_containing_format.py similarity index 91% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_params_containing_format.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_params_containing_format.py index 6038ebdb56a..640654a0000 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_params_containing_format.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_params_containing_format.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler -from kfp.v2.dsl import component +from kfp import components +from kfp import dsl +from kfp import compiler +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_placeholders.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_placeholders.json similarity index 80% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_placeholders.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_placeholders.json index e9637476d17..68495b9e40c 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_placeholders.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_placeholders.json @@ -82,8 +82,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" ], "image": "python:3.7" } @@ -102,8 +102,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" ], "image": "python:3.7" } @@ -122,8 +122,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" ], "image": "python:3.7" } @@ -142,8 +142,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" ], "image": "python:3.7" } @@ -162,8 +162,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(msg: str, value: str):\n print(msg, value)\n\n" ], "image": "python:3.7" } @@ -305,5 +305,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_placeholders.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_placeholders.py similarity index 95% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_placeholders.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_placeholders.py index 4151ee3949e..0bc8411d40a 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_placeholders.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_placeholders.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import compiler, dsl -from kfp.v2.dsl import component +from kfp import compiler, dsl +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_resource_spec.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_resource_spec.json similarity index 99% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_resource_spec.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_resource_spec.json index a6aacf502ee..80182293c30 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_resource_spec.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_resource_spec.json @@ -167,5 +167,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_resource_spec.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_resource_spec.py similarity index 95% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_resource_spec.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_resource_spec.py index 2ecce9fbdeb..5473da6fbdf 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_resource_spec.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_resource_spec.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler import pathlib test_data_dir = pathlib.Path(__file__).parent / 'component_yaml' diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_reused_component.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_reused_component.json similarity index 99% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_reused_component.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_reused_component.json index 1fe025cd751..ce95f2d0c16 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_reused_component.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_reused_component.json @@ -206,5 +206,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_reused_component.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_reused_component.py similarity index 93% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_reused_component.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_reused_component.py index 5d620944dd9..3c51786f479 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_reused_component.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_reused_component.py @@ -14,9 +14,9 @@ import pathlib -from kfp.v2 import components -from kfp.v2 import compiler -from kfp.v2 import dsl +from kfp import components +from kfp import compiler +from kfp import dsl test_data_dir = pathlib.Path(__file__).parent / 'component_yaml' add_op = components.load_component_from_file( diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status.json similarity index 78% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status.json index 6636a0e91b8..41f39c0b385 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status.json @@ -101,8 +101,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'git+https://github.com/kubeflow/pipelines.git@master#subdirectory=sdk/python' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef exit_op(user_input: str, status: PipelineTaskFinalStatus):\n \"\"\"Checks pipeline run status.\"\"\"\n print('Pipeline status: ', status.state)\n print('Job resource name: ', status.pipeline_job_resource_name)\n print('Error code: ', status.error_code)\n print('Error message: ', status.error_message)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef exit_op(user_input: str, status: PipelineTaskFinalStatus):\n \"\"\"Checks pipeline run status.\"\"\"\n print('Pipeline status: ', status.state)\n print('Job resource name: ', status.pipeline_job_resource_name)\n print('Error code: ', status.error_code)\n print('Error message: ', status.error_message)\n\n" ], "image": "python:3.7" } @@ -121,8 +121,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef fail_op(message: str):\n \"\"\"Fails.\"\"\"\n import sys\n print(message)\n sys.exit(1)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef fail_op(message: str):\n \"\"\"Fails.\"\"\"\n import sys\n print(message)\n sys.exit(1)\n\n" ], "image": "python:3.7" } @@ -141,8 +141,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n" ], "image": "python:3.7" } diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status.py similarity index 93% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status.py index df5d56d057f..0ee98e13fd3 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status.py @@ -13,11 +13,11 @@ # limitations under the License. """Pipeline using ExitHandler with PipelineTaskFinalStatus.""" -from kfp.v2 import dsl -from kfp.v2 import compiler -from kfp.v2.dsl import component +from kfp import dsl +from kfp import compiler +from kfp.dsl import component -from kfp.v2.dsl import PipelineTaskFinalStatus +from kfp.dsl import PipelineTaskFinalStatus @component( diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.json similarity index 100% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.json diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.py similarity index 92% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.py index d70392f6394..1e23fdeab62 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_task_final_status_yaml.py @@ -13,10 +13,10 @@ # limitations under the License. """Pipeline using ExitHandler with PipelineTaskFinalStatus (YAML).""" -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler -from kfp.v2.dsl import component +from kfp import components +from kfp import dsl +from kfp import compiler +from kfp.dsl import component exit_op = components.load_component_from_text(""" name: Exit Op @@ -41,7 +41,7 @@ implementation: container: image: python:3.7 - command: + command: - echo - {inputValue: message} """) diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_various_io_types.json b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_various_io_types.json similarity index 99% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_various_io_types.json rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_various_io_types.json index 5b4eeda5f05..855d23b03ed 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_various_io_types.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_various_io_types.json @@ -303,5 +303,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_various_io_types.py b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_various_io_types.py similarity index 97% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_various_io_types.py rename to sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_various_io_types.py index eaea78e9555..c21570e3c27 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/pipeline_with_various_io_types.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/pipeline_with_various_io_types.py @@ -14,9 +14,9 @@ import pathlib -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler component_op_1 = components.load_component_from_text(""" name: upstream diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/two_step_pipeline.json b/sdk/python/kfp/compiler_cli_tests/test_data/two_step_pipeline.json similarity index 99% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/two_step_pipeline.json rename to sdk/python/kfp/compiler_cli_tests/test_data/two_step_pipeline.json index 63628409903..6b78e984a0d 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/two_step_pipeline.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/two_step_pipeline.json @@ -122,5 +122,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/two_step_pipeline.py b/sdk/python/kfp/compiler_cli_tests/test_data/two_step_pipeline.py similarity index 95% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/two_step_pipeline.py rename to sdk/python/kfp/compiler_cli_tests/test_data/two_step_pipeline.py index 408bdac1859..a99c1fcad26 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/two_step_pipeline.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/two_step_pipeline.py @@ -14,9 +14,9 @@ import pathlib -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler component_op_1 = components.load_component_from_text(""" name: Write to GCS diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/v2_component_with_optional_inputs.json b/sdk/python/kfp/compiler_cli_tests/test_data/v2_component_with_optional_inputs.json similarity index 73% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/v2_component_with_optional_inputs.json rename to sdk/python/kfp/compiler_cli_tests/test_data/v2_component_with_optional_inputs.json index 1ad469ff484..b4c82be5cbb 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/v2_component_with_optional_inputs.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/v2_component_with_optional_inputs.json @@ -30,8 +30,8 @@ "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'kfp==2.0.0b0' && \"$0\" \"$@\"\n", "sh", "-ec", - "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.v2.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", - "\nimport kfp\nfrom kfp.v2 import dsl\nfrom kfp.v2.dsl import *\nfrom typing import *\n\ndef component_op(\n input1: str = 'default value',\n input2: Optional[str] = None,\n input3: Optional[str] = None,\n):\n print(f'input1: {input1}, type: {type(input1)}')\n print(f'input2: {input2}, type: {type(input2)}')\n print(f'input3: {input3}, type: {type(input3)}')\n\n" + "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n", + "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef component_op(\n input1: str = 'default value',\n input2: Optional[str] = None,\n input3: Optional[str] = None,\n):\n print(f'input1: {input1}, type: {type(input1)}')\n print(f'input2: {input2}, type: {type(input2)}')\n print(f'input3: {input3}, type: {type(input3)}')\n\n" ], "image": "python:3.7" } @@ -73,5 +73,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/v2_component_with_optional_inputs.py b/sdk/python/kfp/compiler_cli_tests/test_data/v2_component_with_optional_inputs.py similarity index 94% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/v2_component_with_optional_inputs.py rename to sdk/python/kfp/compiler_cli_tests/test_data/v2_component_with_optional_inputs.py index 39fbd1b03da..69b4ef49c04 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/v2_component_with_optional_inputs.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/v2_component_with_optional_inputs.py @@ -13,8 +13,8 @@ # limitations under the License. from typing import Optional -from kfp.v2 import compiler, dsl -from kfp.v2.dsl import component +from kfp import compiler, dsl +from kfp.dsl import component @component diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/xgboost_sample_pipeline.json b/sdk/python/kfp/compiler_cli_tests/test_data/xgboost_sample_pipeline.json similarity index 99% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/xgboost_sample_pipeline.json rename to sdk/python/kfp/compiler_cli_tests/test_data/xgboost_sample_pipeline.json index df118cf6a5e..57129abf9b0 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/xgboost_sample_pipeline.json +++ b/sdk/python/kfp/compiler_cli_tests/test_data/xgboost_sample_pipeline.json @@ -755,5 +755,5 @@ } }, "schemaVersion": "2.1.0", - "sdkVersion": "kfp-1.8.9" + "sdkVersion": "kfp-1.8.11" } \ No newline at end of file diff --git a/sdk/python/kfp/v2/compiler_cli_tests/test_data/xgboost_sample_pipeline.py b/sdk/python/kfp/compiler_cli_tests/test_data/xgboost_sample_pipeline.py similarity index 97% rename from sdk/python/kfp/v2/compiler_cli_tests/test_data/xgboost_sample_pipeline.py rename to sdk/python/kfp/compiler_cli_tests/test_data/xgboost_sample_pipeline.py index 6cef31ff646..45b02435635 100644 --- a/sdk/python/kfp/v2/compiler_cli_tests/test_data/xgboost_sample_pipeline.py +++ b/sdk/python/kfp/compiler_cli_tests/test_data/xgboost_sample_pipeline.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2 import components -from kfp.v2 import dsl -from kfp.v2 import compiler +from kfp import components +from kfp import dsl +from kfp import compiler chicago_taxi_dataset_op = components.load_component_from_url( 'https://raw.githubusercontent.com/kubeflow/pipelines/60a2612541ec08c6a85c237d2ec7525b12543a43/components/datasets/Chicago_Taxi_Trips/component.yaml' diff --git a/sdk/python/kfp/v2/components/__init__.py b/sdk/python/kfp/components/__init__.py similarity index 73% rename from sdk/python/kfp/v2/components/__init__.py rename to sdk/python/kfp/components/__init__.py index c3903310ef3..cf10195f4f8 100644 --- a/sdk/python/kfp/v2/components/__init__.py +++ b/sdk/python/kfp/components/__init__.py @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2.components.yaml_component import load_component_from_text -from kfp.v2.components.yaml_component import load_component_from_file -from kfp.v2.components.yaml_component import load_component_from_url +from kfp.components.yaml_component import load_component_from_text +from kfp.components.yaml_component import load_component_from_file +from kfp.components.yaml_component import load_component_from_url diff --git a/sdk/python/kfp/v2/components/base_component.py b/sdk/python/kfp/components/base_component.py similarity index 96% rename from sdk/python/kfp/v2/components/base_component.py rename to sdk/python/kfp/components/base_component.py index e991ea0b1eb..34544bd0e00 100644 --- a/sdk/python/kfp/v2/components/base_component.py +++ b/sdk/python/kfp/components/base_component.py @@ -15,9 +15,9 @@ import abc -from kfp.v2.components import pipeline_task -from kfp.v2.components import structures -from kfp.v2.components.types import type_utils +from kfp.components import pipeline_task +from kfp.components import structures +from kfp.components.types import type_utils class BaseComponent(metaclass=abc.ABCMeta): diff --git a/sdk/python/kfp/v2/components/base_component_test.py b/sdk/python/kfp/components/base_component_test.py similarity index 95% rename from sdk/python/kfp/v2/components/base_component_test.py rename to sdk/python/kfp/components/base_component_test.py index 04cdd51f714..cd0a1f5f4f3 100644 --- a/sdk/python/kfp/v2/components/base_component_test.py +++ b/sdk/python/kfp/components/base_component_test.py @@ -11,14 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.base_component.""" +"""Tests for kfp.components.base_component.""" import unittest from unittest.mock import patch -from kfp.v2.components import base_component -from kfp.v2.components import structures -from kfp.v2.components import pipeline_task +from kfp.components import base_component +from kfp.components import structures +from kfp.components import pipeline_task class TestComponent(base_component.BaseComponent): diff --git a/sdk/python/kfp/v2/components/component_decorator.py b/sdk/python/kfp/components/component_decorator.py similarity index 98% rename from sdk/python/kfp/v2/components/component_decorator.py rename to sdk/python/kfp/components/component_decorator.py index b3f3c4d36d0..9260cea1d5a 100644 --- a/sdk/python/kfp/v2/components/component_decorator.py +++ b/sdk/python/kfp/components/component_decorator.py @@ -15,7 +15,7 @@ import functools from typing import Callable, Optional, List -from kfp.v2.components import component_factory +from kfp.components import component_factory def component(func: Optional[Callable] = None, @@ -45,7 +45,7 @@ def component(func: Optional[Callable] = None, Example usage: - from kfp.v2 import dsl + from kfp import dsl @dsl.component def my_function_one(input: str, output: Output[Model]): ... diff --git a/sdk/python/kfp/v2/components/component_factory.py b/sdk/python/kfp/components/component_factory.py similarity index 96% rename from sdk/python/kfp/v2/components/component_factory.py rename to sdk/python/kfp/components/component_factory.py index bd35ada29ec..8ea7e3055da 100644 --- a/sdk/python/kfp/v2/components/component_factory.py +++ b/sdk/python/kfp/components/component_factory.py @@ -22,20 +22,20 @@ import docstring_parser -from kfp.v2.components import placeholders -from kfp.v2.components import python_component -from kfp.v2.components import structures -from kfp.v2.components.types import artifact_types, type_annotations -from kfp.v2.components.types import type_utils +from kfp.components import placeholders +from kfp.components import python_component +from kfp.components import structures +from kfp.components.types import artifact_types, type_annotations +from kfp.components.types import type_utils _DEFAULT_BASE_IMAGE = 'python:3.7' @dataclasses.dataclass class ComponentInfo(): - """A dataclass capturing registered v2 components. + """A dataclass capturing registered components. - This will likely be subsumed/augmented with v2 BaseComponent. + This will likely be subsumed/augmented with BaseComponent. """ name: str function_name: str @@ -48,7 +48,7 @@ class ComponentInfo(): # A map from function_name to components. This is always populated when a -# module containing KFP v2 components is loaded. Primarily used by KFP CLI +# module containing KFP components is loaded. Primarily used by KFP CLI # component builder to package components in a file into containers. REGISTERED_MODULES = None @@ -309,8 +309,8 @@ def _get_command_and_args_for_lightweight_component( func: Callable) -> Tuple[List[str], List[str]]: imports_source = [ "import kfp", - "from kfp.v2 import dsl", - "from kfp.v2.dsl import *", + "from kfp import dsl", + "from kfp.dsl import *", "from typing import *", ] @@ -326,7 +326,7 @@ def _get_command_and_args_for_lightweight_component( textwrap.dedent('''\ program_path=$(mktemp -d) printf "%s" "$0" > "$program_path/ephemeral_component.py" - python3 -m kfp.v2.components.executor_main \ + python3 -m kfp.components.executor_main \ --component_module_path \ "$program_path/ephemeral_component.py" \ "$@" @@ -349,7 +349,7 @@ def _get_command_and_args_for_containerized_component( command = [ 'python3', '-m', - 'kfp.v2.components.executor_main', + 'kfp.components.executor_main', ] args = [ diff --git a/sdk/python/kfp/v2/components/constants.py b/sdk/python/kfp/components/constants.py similarity index 100% rename from sdk/python/kfp/v2/components/constants.py rename to sdk/python/kfp/components/constants.py diff --git a/sdk/python/kfp/v2/components/executor.py b/sdk/python/kfp/components/executor.py similarity index 99% rename from sdk/python/kfp/v2/components/executor.py rename to sdk/python/kfp/components/executor.py index e7de5c311f7..43e7a960035 100644 --- a/sdk/python/kfp/v2/components/executor.py +++ b/sdk/python/kfp/components/executor.py @@ -15,8 +15,8 @@ import json from typing import Any, Callable, Dict, List, Optional, Union -from kfp.v2.components.types import artifact_types, type_annotations -from kfp.v2.components import task_final_status +from kfp.components.types import artifact_types, type_annotations +from kfp.components import task_final_status class Executor(): diff --git a/sdk/python/kfp/v2/components/executor_main.py b/sdk/python/kfp/components/executor_main.py similarity index 96% rename from sdk/python/kfp/v2/components/executor_main.py rename to sdk/python/kfp/components/executor_main.py index 612b7396a08..b40def1ea83 100644 --- a/sdk/python/kfp/v2/components/executor_main.py +++ b/sdk/python/kfp/components/executor_main.py @@ -17,9 +17,9 @@ import os import sys -from kfp.v2.components import executor as component_executor -from kfp.v2.components import kfp_config -from kfp.v2.components import utils +from kfp.components import executor as component_executor +from kfp.components import kfp_config +from kfp.components import utils def _setup_logging(): diff --git a/sdk/python/kfp/v2/components/executor_test.py b/sdk/python/kfp/components/executor_test.py similarity index 98% rename from sdk/python/kfp/v2/components/executor_test.py rename to sdk/python/kfp/components/executor_test.py index 97c3c0a00fd..b9f72225dae 100644 --- a/sdk/python/kfp/v2/components/executor_test.py +++ b/sdk/python/kfp/components/executor_test.py @@ -19,13 +19,13 @@ import unittest from typing import Callable, Dict, List, NamedTuple, Optional -from kfp.v2.components import executor -from kfp.v2.components.types import artifact_types -from kfp.v2.components.types.artifact_types import (Artifact, Dataset, Metrics, +from kfp.components import executor +from kfp.components.types import artifact_types +from kfp.components.types.artifact_types import (Artifact, Dataset, Metrics, Model) -from kfp.v2.components.types.type_annotations import (Input, InputPath, Output, +from kfp.components.types.type_annotations import (Input, InputPath, Output, OutputPath) -from kfp.v2.components.task_final_status import PipelineTaskFinalStatus +from kfp.components.task_final_status import PipelineTaskFinalStatus _EXECUTOR_INPUT = """\ { diff --git a/sdk/python/kfp/v2/components/for_loop.py b/sdk/python/kfp/components/for_loop.py similarity index 99% rename from sdk/python/kfp/v2/components/for_loop.py rename to sdk/python/kfp/components/for_loop.py index a1c1c2885a3..4cb0a614cb6 100644 --- a/sdk/python/kfp/v2/components/for_loop.py +++ b/sdk/python/kfp/components/for_loop.py @@ -16,7 +16,7 @@ import re from typing import Any, Dict, List, Optional, Tuple, Union, get_type_hints -from kfp.v2.components import pipeline_channel +from kfp.components import pipeline_channel ItemList = List[Union[int, float, str, Dict[str, Any]]] diff --git a/sdk/python/kfp/v2/components/for_loop_test.py b/sdk/python/kfp/components/for_loop_test.py similarity index 97% rename from sdk/python/kfp/v2/components/for_loop_test.py rename to sdk/python/kfp/components/for_loop_test.py index 734056e2c07..0a6a5d13324 100644 --- a/sdk/python/kfp/v2/components/for_loop_test.py +++ b/sdk/python/kfp/components/for_loop_test.py @@ -11,12 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.for_loop.""" +"""Tests for kfpmponents.for_loop.""" import unittest from absl.testing import parameterized -from kfp.v2.components import pipeline_channel -from kfp.v2.components import for_loop +from kfp.components import pipeline_channel +from kfp.components import for_loop class ForLoopTest(parameterized.TestCase): diff --git a/sdk/python/kfp/v2/components/importer_component.py b/sdk/python/kfp/components/importer_component.py similarity index 91% rename from sdk/python/kfp/v2/components/importer_component.py rename to sdk/python/kfp/components/importer_component.py index 7282724c898..ac6e14614af 100644 --- a/sdk/python/kfp/v2/components/importer_component.py +++ b/sdk/python/kfp/components/importer_component.py @@ -13,8 +13,8 @@ # limitations under the License. """Importer-based component.""" -from kfp.v2.components import base_component -from kfp.v2.components import structures +from kfp.components import base_component +from kfp.components import structures class ImporterComponent(base_component.BaseComponent): diff --git a/sdk/python/kfp/v2/components/importer_node.py b/sdk/python/kfp/components/importer_node.py similarity index 89% rename from sdk/python/kfp/v2/components/importer_node.py rename to sdk/python/kfp/components/importer_node.py index 2d8c0a8709f..17c95995dc7 100644 --- a/sdk/python/kfp/v2/components/importer_node.py +++ b/sdk/python/kfp/components/importer_node.py @@ -15,12 +15,12 @@ from typing import Any, Union, Optional, Type, Mapping -from kfp.v2.components import pipeline_task -from kfp.v2.components import pipeline_channel -from kfp.v2.components import placeholders -from kfp.v2.components import structures -from kfp.v2.components import importer_component -from kfp.v2.components.types import artifact_types +from kfp.components import pipeline_task +from kfp.components import pipeline_channel +from kfp.components import placeholders +from kfp.components import structures +from kfp.components import importer_component +from kfp.components.types import artifact_types INPUT_KEY = 'uri' OUTPUT_KEY = 'artifact' diff --git a/sdk/python/kfp/v2/components/kfp_config.py b/sdk/python/kfp/components/kfp_config.py similarity index 100% rename from sdk/python/kfp/v2/components/kfp_config.py rename to sdk/python/kfp/components/kfp_config.py diff --git a/sdk/python/kfp/v2/components/pipeline_channel.py b/sdk/python/kfp/components/pipeline_channel.py similarity index 98% rename from sdk/python/kfp/v2/components/pipeline_channel.py rename to sdk/python/kfp/components/pipeline_channel.py index 6d2b6a08734..e65b16c26bc 100644 --- a/sdk/python/kfp/v2/components/pipeline_channel.py +++ b/sdk/python/kfp/components/pipeline_channel.py @@ -18,8 +18,8 @@ import re from typing import Dict, List, Optional, Union -from kfp.v2.components import utils -from kfp.v2.components.types import type_utils +from kfp.components import utils +from kfp.components.types import type_utils @dataclasses.dataclass @@ -131,7 +131,7 @@ def __repr__(self) -> str: We make repr return the placeholder string so that if someone uses str()-based serialization of complex objects containing `PipelineChannel`, it works properly. (e.g. str([1, 2, 3, - kfp.v2.dsl.PipelineParameterChannel("aaa"), 4, 5, 6,])) + kfp.dsl.PipelineParameterChannel("aaa"), 4, 5, 6,])) """ return str(self) diff --git a/sdk/python/kfp/v2/components/pipeline_channel_test.py b/sdk/python/kfp/components/pipeline_channel_test.py similarity index 98% rename from sdk/python/kfp/v2/components/pipeline_channel_test.py rename to sdk/python/kfp/components/pipeline_channel_test.py index 688dbbbd04a..2b56abee065 100644 --- a/sdk/python/kfp/v2/components/pipeline_channel_test.py +++ b/sdk/python/kfp/components/pipeline_channel_test.py @@ -11,12 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.pipeline_channel.""" +"""Tests for kfp.components.pipeline_channel.""" import unittest from absl.testing import parameterized -from kfp.v2.components import pipeline_channel +from kfp.components import pipeline_channel class PipelineChannelTest(parameterized.TestCase): diff --git a/sdk/python/kfp/v2/components/pipeline_context.py b/sdk/python/kfp/components/pipeline_context.py similarity index 98% rename from sdk/python/kfp/v2/components/pipeline_context.py rename to sdk/python/kfp/components/pipeline_context.py index 92efc96c3b2..d72eb8eccdc 100644 --- a/sdk/python/kfp/v2/components/pipeline_context.py +++ b/sdk/python/kfp/components/pipeline_context.py @@ -15,9 +15,9 @@ from typing import Callable, Optional -from kfp.v2.components import pipeline_task -from kfp.v2.components import tasks_group -from kfp.v2.components import utils +from kfp.components import pipeline_task +from kfp.components import tasks_group +from kfp.components import utils # This handler is called whenever the @pipeline decorator is applied. # It can be used by command-line DSL compiler to inject code that runs for every diff --git a/sdk/python/kfp/v2/components/pipeline_task.py b/sdk/python/kfp/components/pipeline_task.py similarity index 98% rename from sdk/python/kfp/v2/components/pipeline_task.py rename to sdk/python/kfp/components/pipeline_task.py index 7cf1d322055..2124bab975f 100644 --- a/sdk/python/kfp/v2/components/pipeline_task.py +++ b/sdk/python/kfp/components/pipeline_task.py @@ -17,11 +17,11 @@ import copy from typing import Any, List, Mapping, Optional, Union -from kfp.v2.components import constants -from kfp.v2.components import placeholders -from kfp.v2.components import pipeline_channel -from kfp.v2.components import structures -from kfp.v2.components.types import type_utils +from kfp.components import constants +from kfp.components import placeholders +from kfp.components import pipeline_channel +from kfp.components import structures +from kfp.components.types import type_utils def create_pipeline_task( diff --git a/sdk/python/kfp/v2/components/pipeline_task_test.py b/sdk/python/kfp/components/pipeline_task_test.py similarity index 98% rename from sdk/python/kfp/v2/components/pipeline_task_test.py rename to sdk/python/kfp/components/pipeline_task_test.py index 0224ff1b23d..9fbc578fb70 100644 --- a/sdk/python/kfp/v2/components/pipeline_task_test.py +++ b/sdk/python/kfp/components/pipeline_task_test.py @@ -11,16 +11,16 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.pipeline_task.""" +"""Tests for kfp.components.pipeline_task.""" import textwrap import unittest from typing import Union from absl.testing import parameterized -from kfp.v2.components import pipeline_task -from kfp.v2.components import structures -from kfp.v2.components import pipeline_channel +from kfp.components import pipeline_task +from kfp.components import structures +from kfp.components import pipeline_channel V2_YAML = textwrap.dedent("""\ name: component1 diff --git a/sdk/python/kfp/v2/components/placeholders.py b/sdk/python/kfp/components/placeholders.py similarity index 100% rename from sdk/python/kfp/v2/components/placeholders.py rename to sdk/python/kfp/components/placeholders.py diff --git a/sdk/python/kfp/v2/components/placeholders_test.py b/sdk/python/kfp/components/placeholders_test.py similarity index 95% rename from sdk/python/kfp/v2/components/placeholders_test.py rename to sdk/python/kfp/components/placeholders_test.py index d542b71bcbc..2f5f4a4ced0 100644 --- a/sdk/python/kfp/v2/components/placeholders_test.py +++ b/sdk/python/kfp/components/placeholders_test.py @@ -11,11 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.placeholders.""" +"""Tests for kfp.components.placeholders.""" import unittest -from kfp.v2.components import placeholders +from kfp.components import placeholders class PlaceholdersTest(unittest.TestCase): diff --git a/sdk/python/kfp/v2/components/python_component.py b/sdk/python/kfp/components/python_component.py similarity index 93% rename from sdk/python/kfp/v2/components/python_component.py rename to sdk/python/kfp/components/python_component.py index 4560d4bc676..b6be57c8da5 100644 --- a/sdk/python/kfp/v2/components/python_component.py +++ b/sdk/python/kfp/components/python_component.py @@ -15,8 +15,8 @@ from typing import Callable -from kfp.v2.components import base_component -from kfp.v2.components import structures +from kfp.components import base_component +from kfp.components import structures class PythonComponent(base_component.BaseComponent): diff --git a/sdk/python/kfp/v2/components/structures.py b/sdk/python/kfp/components/structures.py similarity index 99% rename from sdk/python/kfp/v2/components/structures.py rename to sdk/python/kfp/components/structures.py index fcd5e48ca64..80aeda8eef3 100644 --- a/sdk/python/kfp/v2/components/structures.py +++ b/sdk/python/kfp/components/structures.py @@ -20,7 +20,7 @@ from kfp.deprecated.components import _components from kfp.deprecated.components import structures as v1_structures -from kfp.v2.components import utils +from kfp.components import utils import pydantic import yaml diff --git a/sdk/python/kfp/v2/components/structures_test.py b/sdk/python/kfp/components/structures_test.py similarity index 99% rename from sdk/python/kfp/v2/components/structures_test.py rename to sdk/python/kfp/components/structures_test.py index c2d7ffd33dd..6a6a1299d50 100644 --- a/sdk/python/kfp/v2/components/structures_test.py +++ b/sdk/python/kfp/components/structures_test.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.structures.""" +"""Tests for kfp.components.structures.""" import textwrap import unittest @@ -19,7 +19,7 @@ import pydantic from absl.testing import parameterized -from kfp.v2.components import structures +from kfp.components import structures V1_YAML_IF_PLACEHOLDER = textwrap.dedent("""\ diff --git a/sdk/python/kfp/v2/components/task_final_status.py b/sdk/python/kfp/components/task_final_status.py similarity index 100% rename from sdk/python/kfp/v2/components/task_final_status.py rename to sdk/python/kfp/components/task_final_status.py diff --git a/sdk/python/kfp/v2/components/tasks_group.py b/sdk/python/kfp/components/tasks_group.py similarity index 97% rename from sdk/python/kfp/v2/components/tasks_group.py rename to sdk/python/kfp/components/tasks_group.py index 44a826366e1..64614cfd977 100644 --- a/sdk/python/kfp/v2/components/tasks_group.py +++ b/sdk/python/kfp/components/tasks_group.py @@ -16,10 +16,10 @@ import enum from typing import Optional, Union -from kfp.v2.components import for_loop -from kfp.v2.components import pipeline_context -from kfp.v2.components import pipeline_channel -from kfp.v2.components import pipeline_task +from kfp.components import for_loop +from kfp.components import pipeline_context +from kfp.components import pipeline_channel +from kfp.components import pipeline_task class TasksGroupType(str, enum.Enum): diff --git a/sdk/python/kfp/v2/components/test_data/simple_yaml.yaml b/sdk/python/kfp/components/test_data/simple_yaml.yaml similarity index 100% rename from sdk/python/kfp/v2/components/test_data/simple_yaml.yaml rename to sdk/python/kfp/components/test_data/simple_yaml.yaml diff --git a/sdk/python/kfp/v2/components/types/__init__.py b/sdk/python/kfp/components/types/__init__.py similarity index 100% rename from sdk/python/kfp/v2/components/types/__init__.py rename to sdk/python/kfp/components/types/__init__.py diff --git a/sdk/python/kfp/v2/components/types/artifact_types.py b/sdk/python/kfp/components/types/artifact_types.py similarity index 100% rename from sdk/python/kfp/v2/components/types/artifact_types.py rename to sdk/python/kfp/components/types/artifact_types.py diff --git a/sdk/python/kfp/v2/components/types/artifact_types_test.py b/sdk/python/kfp/components/types/artifact_types_test.py similarity index 98% rename from sdk/python/kfp/v2/components/types/artifact_types_test.py rename to sdk/python/kfp/components/types/artifact_types_test.py index 64ec6fd723f..8212b214dca 100644 --- a/sdk/python/kfp/v2/components/types/artifact_types_test.py +++ b/sdk/python/kfp/components/types/artifact_types_test.py @@ -11,14 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.types.artifact_types.""" +"""Tests for kfp.components.types.artifact_types.""" import unittest import json import os from absl.testing import parameterized -from kfp.v2.components.types import artifact_types +from kfp.components.types import artifact_types class ArtifactsTest(parameterized.TestCase): diff --git a/sdk/python/kfp/v2/components/types/test_data/expected_bulk_loaded_confusion_matrix.json b/sdk/python/kfp/components/types/test_data/expected_bulk_loaded_confusion_matrix.json similarity index 100% rename from sdk/python/kfp/v2/components/types/test_data/expected_bulk_loaded_confusion_matrix.json rename to sdk/python/kfp/components/types/test_data/expected_bulk_loaded_confusion_matrix.json diff --git a/sdk/python/kfp/v2/components/types/test_data/expected_confusion_matrix.json b/sdk/python/kfp/components/types/test_data/expected_confusion_matrix.json similarity index 100% rename from sdk/python/kfp/v2/components/types/test_data/expected_confusion_matrix.json rename to sdk/python/kfp/components/types/test_data/expected_confusion_matrix.json diff --git a/sdk/python/kfp/v2/components/types/test_data/expected_io_types_bulk_load_classification_metrics.json b/sdk/python/kfp/components/types/test_data/expected_io_types_bulk_load_classification_metrics.json similarity index 100% rename from sdk/python/kfp/v2/components/types/test_data/expected_io_types_bulk_load_classification_metrics.json rename to sdk/python/kfp/components/types/test_data/expected_io_types_bulk_load_classification_metrics.json diff --git a/sdk/python/kfp/v2/components/types/test_data/expected_io_types_classification_metrics.json b/sdk/python/kfp/components/types/test_data/expected_io_types_classification_metrics.json similarity index 100% rename from sdk/python/kfp/v2/components/types/test_data/expected_io_types_classification_metrics.json rename to sdk/python/kfp/components/types/test_data/expected_io_types_classification_metrics.json diff --git a/sdk/python/kfp/v2/components/types/type_annotations.py b/sdk/python/kfp/components/types/type_annotations.py similarity index 100% rename from sdk/python/kfp/v2/components/types/type_annotations.py rename to sdk/python/kfp/components/types/type_annotations.py diff --git a/sdk/python/kfp/v2/components/types/type_annotations_test.py b/sdk/python/kfp/components/types/type_annotations_test.py similarity index 95% rename from sdk/python/kfp/v2/components/types/type_annotations_test.py rename to sdk/python/kfp/components/types/type_annotations_test.py index 4ce94d4b170..3b30b5fe871 100644 --- a/sdk/python/kfp/v2/components/types/type_annotations_test.py +++ b/sdk/python/kfp/components/types/type_annotations_test.py @@ -11,15 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.types.type_annotations.""" +"""Tests for kfp.components.types.type_annotations.""" import unittest from typing import Any, Dict, List, Optional from absl.testing import parameterized -from kfp.v2.components.types import type_annotations -from kfp.v2.components.types.artifact_types import Model -from kfp.v2.components.types.type_annotations import (Input, InputAnnotation, +from kfp.components.types import type_annotations +from kfp.components.types.artifact_types import Model +from kfp.components.types.type_annotations import (Input, InputAnnotation, InputPath, Output, OutputAnnotation, OutputPath) diff --git a/sdk/python/kfp/v2/components/types/type_utils.py b/sdk/python/kfp/components/types/type_utils.py similarity index 98% rename from sdk/python/kfp/v2/components/types/type_utils.py rename to sdk/python/kfp/components/types/type_utils.py index eee7b0ec53c..1943e08b945 100644 --- a/sdk/python/kfp/v2/components/types/type_utils.py +++ b/sdk/python/kfp/components/types/type_utils.py @@ -20,9 +20,9 @@ from kfp.deprecated.components import structures from kfp.pipeline_spec import pipeline_spec_pb2 -from kfp.v2.components import task_final_status -from kfp.v2.components.types import artifact_types -from kfp.v2.components.types import type_annotations +from kfp.components import task_final_status +from kfp.components.types import artifact_types +from kfp.components.types import type_annotations PARAMETER_TYPES = Union[str, int, float, bool, dict, list] diff --git a/sdk/python/kfp/v2/components/types/type_utils_test.py b/sdk/python/kfp/components/types/type_utils_test.py similarity index 99% rename from sdk/python/kfp/v2/components/types/type_utils_test.py rename to sdk/python/kfp/components/types/type_utils_test.py index afb7e7ae212..62caeb6ec96 100644 --- a/sdk/python/kfp/v2/components/types/type_utils_test.py +++ b/sdk/python/kfp/components/types/type_utils_test.py @@ -19,8 +19,8 @@ from absl.testing import parameterized from kfp.deprecated.components import structures from kfp.pipeline_spec import pipeline_spec_pb2 as pb -from kfp.v2.components.types import artifact_types, type_utils -from kfp.v2.components.types.type_utils import InconsistentTypeException +from kfp.components.types import artifact_types, type_utils +from kfp.components.types.type_utils import InconsistentTypeException _PARAMETER_TYPES = [ 'String', diff --git a/sdk/python/kfp/v2/components/utils.py b/sdk/python/kfp/components/utils.py similarity index 100% rename from sdk/python/kfp/v2/components/utils.py rename to sdk/python/kfp/components/utils.py diff --git a/sdk/python/kfp/v2/components/utils_test.py b/sdk/python/kfp/components/utils_test.py similarity index 97% rename from sdk/python/kfp/v2/components/utils_test.py rename to sdk/python/kfp/components/utils_test.py index 6d0ce09aed5..35d8f0ec5d6 100644 --- a/sdk/python/kfp/v2/components/utils_test.py +++ b/sdk/python/kfp/components/utils_test.py @@ -11,12 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.utils.""" +"""Tests for kfp.components.utils.""" import unittest from absl.testing import parameterized -from kfp.v2.components import utils +from kfp.components import utils class UtilsTest(parameterized.TestCase): diff --git a/sdk/python/kfp/v2/components/yaml_component.py b/sdk/python/kfp/components/yaml_component.py similarity index 96% rename from sdk/python/kfp/v2/components/yaml_component.py rename to sdk/python/kfp/components/yaml_component.py index 1a0e009b8f8..35e04047058 100644 --- a/sdk/python/kfp/v2/components/yaml_component.py +++ b/sdk/python/kfp/components/yaml_component.py @@ -19,8 +19,8 @@ 'load_component_from_file', ] -from kfp.v2.components import base_component -from kfp.v2.components import structures +from kfp.components import base_component +from kfp.components import structures class YamlComponent(base_component.BaseComponent): diff --git a/sdk/python/kfp/v2/components/yaml_component_test.py b/sdk/python/kfp/components/yaml_component_test.py similarity index 96% rename from sdk/python/kfp/v2/components/yaml_component_test.py rename to sdk/python/kfp/components/yaml_component_test.py index f8e016530f4..2df8ef0962c 100644 --- a/sdk/python/kfp/v2/components/yaml_component_test.py +++ b/sdk/python/kfp/components/yaml_component_test.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.components.yaml_component.""" +"""Tests for kfp.components.yaml_component.""" import requests import unittest @@ -20,8 +20,8 @@ from pathlib import Path from unittest import mock -from kfp.v2.components import yaml_component -from kfp.v2.components import structures +from kfp.components import yaml_component +from kfp.components import structures SAMPLE_YAML = textwrap.dedent("""\ name: component_1 diff --git a/sdk/python/kfp/deprecated/_config.py b/sdk/python/kfp/deprecated/_config.py index 0104567b274..297c667c966 100644 --- a/sdk/python/kfp/deprecated/_config.py +++ b/sdk/python/kfp/deprecated/_config.py @@ -13,6 +13,6 @@ # limitations under the License. #TODO: wrap the DSL level configuration into one Config TYPE_CHECK = True -# COMPILING_FOR_V2 is True when using kfp.v2.compiler or use (v1) kfp.compiler +# COMPILING_FOR_V2 is True when using kfp.compiler or use (v1) kfp.compiler # with V2_COMPATIBLE or V2_ENGINE mode COMPILING_FOR_V2 = False diff --git a/sdk/python/kfp/deprecated/cli/components.py b/sdk/python/kfp/deprecated/cli/components.py index 170dcac68be..7693e901c6b 100644 --- a/sdk/python/kfp/deprecated/cli/components.py +++ b/sdk/python/kfp/deprecated/cli/components.py @@ -29,7 +29,7 @@ import typer import kfp.deprecated as kfp -from kfp.v2.components import component_factory, kfp_config, utils +from kfp.components import component_factory, kfp_config, utils _REQUIREMENTS_TXT = 'requirements.txt' diff --git a/sdk/python/kfp/deprecated/cli/components_test.py b/sdk/python/kfp/deprecated/cli/components_test.py index 5bbd7867f91..396c71a23bd 100644 --- a/sdk/python/kfp/deprecated/cli/components_test.py +++ b/sdk/python/kfp/deprecated/cli/components_test.py @@ -30,7 +30,7 @@ from kfp.deprecated.cli import components _COMPONENT_TEMPLATE = ''' -from kfp.v2.dsl import * +from kfp.dsl import * @component( base_image={base_image}, @@ -46,7 +46,7 @@ def _make_component(func_name: str, target_image: Optional[str] = None, output_component_file: Optional[str] = None) -> str: return textwrap.dedent(''' - from kfp.v2.dsl import * + from kfp.dsl import * @component( base_image={base_image}, diff --git a/sdk/python/kfp/deprecated/compiler/compiler.py b/sdk/python/kfp/deprecated/compiler/compiler.py index 0f983022ad2..0fcc996d93b 100644 --- a/sdk/python/kfp/deprecated/compiler/compiler.py +++ b/sdk/python/kfp/deprecated/compiler/compiler.py @@ -14,7 +14,6 @@ import datetime import json from collections import defaultdict, OrderedDict -from deprecated import deprecated import inspect import re import tarfile @@ -1089,44 +1088,6 @@ def _create_workflow( return workflow - # For now (0.1.31) this function is only used by TFX's KubeflowDagRunner. - # See https://github.com/tensorflow/tfx/blob/811e4c1cc0f7903d73d151b9d4f21f79f6013d4a/tfx/orchestration/kubeflow/kubeflow_dag_runner.py#L238 - @deprecated( - version='0.1.32', - reason='Workflow spec is not intended to be handled by user, please ' - 'switch to _create_workflow') - def create_workflow( - self, - pipeline_func: Callable, - pipeline_name: Text = None, - pipeline_description: Text = None, - params_list: List[dsl.PipelineParam] = None, - pipeline_conf: dsl.PipelineConf = None) -> Dict[Text, Any]: - """Create workflow spec from pipeline function and specified pipeline - params/metadata. Currently, the pipeline params are either specified in - the signature of the pipeline function or by passing a list of - dsl.PipelineParam. Conflict will cause ValueError. - - Args: - pipeline_func: Pipeline function where ContainerOps are invoked. - pipeline_name: The name of the pipeline to compile. - pipeline_description: The description of the pipeline. - params_list: List of pipeline params to append to the pipeline. - pipeline_conf: PipelineConf instance. Can specify op transforms, image pull secrets and other pipeline-level configuration options. Overrides any configuration that may be set by the pipeline. - - Returns: - The created workflow dictionary. - """ - return self._create_workflow(pipeline_func, pipeline_name, - pipeline_description, params_list, - pipeline_conf) - - @deprecated(version='0.1.32', reason='Switch to _create_workflow.') - def _compile(self, pipeline_func, pipeline_conf: dsl.PipelineConf = None): - """Compile the given pipeline function into workflow.""" - return self._create_workflow( - pipeline_func=pipeline_func, pipeline_conf=pipeline_conf) - def compile(self, pipeline_func, package_path, diff --git a/sdk/python/kfp/deprecated/compiler/testdata/v2_compatible_two_step_pipeline.yaml b/sdk/python/kfp/deprecated/compiler/testdata/v2_compatible_two_step_pipeline.yaml index a6263af8e7c..57809640aa8 100644 --- a/sdk/python/kfp/deprecated/compiler/testdata/v2_compatible_two_step_pipeline.yaml +++ b/sdk/python/kfp/deprecated/compiler/testdata/v2_compatible_two_step_pipeline.yaml @@ -55,12 +55,12 @@ spec: - | program_path=$(mktemp -d) printf "%s" "$0" > "$program_path/ephemeral_component.py" - python3 -m kfp.v2.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" + python3 -m kfp.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" - |2+ import kfp - from kfp.v2 import dsl - from kfp.v2.dsl import * + from kfp import dsl + from kfp.dsl import * from typing import * def preprocess(uri: str, some_int: int, output_parameter_one: OutputPath(int), @@ -157,12 +157,12 @@ spec: - | program_path=$(mktemp -d) printf "%s" "$0" > "$program_path/ephemeral_component.py" - python3 -m kfp.v2.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" + python3 -m kfp.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" - |2+ import kfp - from kfp.v2 import dsl - from kfp.v2.dsl import * + from kfp import dsl + from kfp.dsl import * from typing import * def train(dataset: InputPath('Dataset'), diff --git a/sdk/python/kfp/deprecated/compiler/testdata/v2_compatible_two_step_pipeline_with_custom_launcher.yaml b/sdk/python/kfp/deprecated/compiler/testdata/v2_compatible_two_step_pipeline_with_custom_launcher.yaml index 48f9066128d..b8fd8185806 100644 --- a/sdk/python/kfp/deprecated/compiler/testdata/v2_compatible_two_step_pipeline_with_custom_launcher.yaml +++ b/sdk/python/kfp/deprecated/compiler/testdata/v2_compatible_two_step_pipeline_with_custom_launcher.yaml @@ -55,12 +55,12 @@ spec: - | program_path=$(mktemp -d) printf "%s" "$0" > "$program_path/ephemeral_component.py" - python3 -m kfp.v2.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" + python3 -m kfp.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" - |2+ import kfp - from kfp.v2 import dsl - from kfp.v2.dsl import * + from kfp import dsl + from kfp.dsl import * from typing import * def preprocess(uri: str, some_int: int, output_parameter_one: OutputPath(int), @@ -157,12 +157,12 @@ spec: - | program_path=$(mktemp -d) printf "%s" "$0" > "$program_path/ephemeral_component.py" - python3 -m kfp.v2.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" + python3 -m kfp.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" - |2+ import kfp - from kfp.v2 import dsl - from kfp.v2.dsl import * + from kfp import dsl + from kfp.dsl import * from typing import * def train(dataset: InputPath('Dataset'), diff --git a/sdk/python/kfp/deprecated/compiler/v2_compatible_compiler_test.py b/sdk/python/kfp/deprecated/compiler/v2_compatible_compiler_test.py index 975a9936864..3d5177c72a9 100644 --- a/sdk/python/kfp/deprecated/compiler/v2_compatible_compiler_test.py +++ b/sdk/python/kfp/deprecated/compiler/v2_compatible_compiler_test.py @@ -23,8 +23,8 @@ import yaml from kfp.deprecated import compiler from kfp.deprecated import dsl as v1dsl -from kfp.v2 import dsl -from kfp.v2.dsl import Artifact, InputPath, OutputPath, component +from kfp import dsl +from kfp.dsl import Artifact, InputPath, OutputPath, component @component diff --git a/sdk/python/kfp/deprecated/components/_python_op.py b/sdk/python/kfp/deprecated/components/_python_op.py index d485e4b48da..a9a1ae078be 100644 --- a/sdk/python/kfp/deprecated/components/_python_op.py +++ b/sdk/python/kfp/deprecated/components/_python_op.py @@ -983,10 +983,10 @@ def create_component_from_func_v2(func: Callable, warnings.warn( 'create_component_from_func_v2() has been deprecated and will be' ' removed in KFP v1.9. Please use' - ' @kfp.v2.dsl.component() instead.', + ' @kfp.dsl.component() instead.', category=FutureWarning, ) - from kfp.v2.components import component_factory + from kfp.components import component_factory return component_factory.create_component_from_func( func=func, base_image=base_image, diff --git a/sdk/python/kfp/deprecated/dsl/__init__.py b/sdk/python/kfp/deprecated/dsl/__init__.py index 5adc0414443..8cce20f8a1a 100644 --- a/sdk/python/kfp/deprecated/dsl/__init__.py +++ b/sdk/python/kfp/deprecated/dsl/__init__.py @@ -25,10 +25,10 @@ def importer(*args, **kwargs): import warnings - from kfp.v2.dsl import importer as v2importer + from kfp.dsl import importer as v2importer warnings.warn( '`kfp.dsl.importer` is a deprecated alias and will be removed' - ' in KFP v2.0. Please import from `kfp.v2.dsl` instead.', + ' in KFP v2.0. Please import from `kfp.dsl` instead.', category=FutureWarning) return v2importer(*args, **kwargs) diff --git a/sdk/python/kfp/deprecated/dsl/_component_bridge.py b/sdk/python/kfp/deprecated/dsl/_component_bridge.py index 730d253c819..2c26f551c23 100644 --- a/sdk/python/kfp/deprecated/dsl/_component_bridge.py +++ b/sdk/python/kfp/deprecated/dsl/_component_bridge.py @@ -31,7 +31,7 @@ from kfp.deprecated.dsl import dsl_utils from kfp.deprecated.dsl import types from kfp.pipeline_spec import pipeline_spec_pb2 -from kfp.v2.components.types import type_utils +from kfp.components.types import type_utils # Placeholder to represent the output directory hosting all the generated URIs. # Its actual value will be specified during pipeline compilation. diff --git a/sdk/python/kfp/deprecated/dsl/_container_op_test.py b/sdk/python/kfp/deprecated/dsl/_container_op_test.py index a1f4f743f02..a712f6987ec 100644 --- a/sdk/python/kfp/deprecated/dsl/_container_op_test.py +++ b/sdk/python/kfp/deprecated/dsl/_container_op_test.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Tests for kfp.v2.dsl.container_op.""" +"""Tests for kfp.dsl.container_op.""" import unittest from kfp.deprecated.dsl import _container_op diff --git a/sdk/python/kfp/deprecated/dsl/component_spec.py b/sdk/python/kfp/deprecated/dsl/component_spec.py index 4b8de8be779..09206f6d456 100644 --- a/sdk/python/kfp/deprecated/dsl/component_spec.py +++ b/sdk/python/kfp/deprecated/dsl/component_spec.py @@ -18,7 +18,7 @@ from kfp.deprecated.components import _structures as structures from kfp.deprecated.dsl import _for_loop, _pipeline_param, dsl_utils from kfp.pipeline_spec import pipeline_spec_pb2 -from kfp.v2.components.types import type_utils +from kfp.components.types import type_utils def additional_input_name_for_pipelineparam( diff --git a/sdk/python/kfp/deprecated/dsl/io_types.py b/sdk/python/kfp/deprecated/dsl/io_types.py index c98bdbd59a1..fc7d6fdb21b 100644 --- a/sdk/python/kfp/deprecated/dsl/io_types.py +++ b/sdk/python/kfp/deprecated/dsl/io_types.py @@ -11,16 +11,16 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Deprecated. See kfp.v2.types.artifact_types instead. +"""Deprecated. See kfp.types.artifact_types instead. This module will be removed in KFP v2.0. """ import warnings -from kfp.v2.components.types import artifact_types +from kfp.components.types import artifact_types warnings.warn( 'Module kfp.dsl.io_types is deprecated and will be removed' - ' in KFP v2.0. Please import types from kfp.v2.dsl instead.', + ' in KFP v2.0. Please import types from kfp.dsl instead.', category=FutureWarning) Artifact = artifact_types.Artifact diff --git a/sdk/python/kfp/deprecated/dsl/type_utils.py b/sdk/python/kfp/deprecated/dsl/type_utils.py index 7c61f1d426e..78c845bf3fd 100644 --- a/sdk/python/kfp/deprecated/dsl/type_utils.py +++ b/sdk/python/kfp/deprecated/dsl/type_utils.py @@ -11,16 +11,16 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Deprecated. See kfp.v2.components.types.type_utils instead. +"""Deprecated. See kfp.components.types.type_utils instead. This module will be removed in KFP v2.0. """ import warnings -from kfp.v2.components.types import type_utils +from kfp.components.types import type_utils warnings.warn( 'Module kfp.dsl.type_utils is deprecated and will be removed' - ' in KFP v2.0. Please use from kfp.v2.components.types.type_utils instead.', + ' in KFP v2.0. Please use from kfp.components.types.type_utils instead.', category=FutureWarning) is_parameter_type = type_utils.is_parameter_type diff --git a/sdk/python/kfp/deprecated/dsl/types.py b/sdk/python/kfp/deprecated/dsl/types.py index d26224bafb6..7d524e686b1 100644 --- a/sdk/python/kfp/deprecated/dsl/types.py +++ b/sdk/python/kfp/deprecated/dsl/types.py @@ -19,7 +19,7 @@ from typing import Dict, Union import warnings -from kfp.v2.components.types import type_utils +from kfp.components.types import type_utils class BaseType: diff --git a/sdk/python/kfp/v2/dsl/__init__.py b/sdk/python/kfp/dsl/__init__.py similarity index 71% rename from sdk/python/kfp/v2/dsl/__init__.py rename to sdk/python/kfp/dsl/__init__.py index 0a7d66f1157..eda679939cd 100644 --- a/sdk/python/kfp/v2/dsl/__init__.py +++ b/sdk/python/kfp/dsl/__init__.py @@ -12,24 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -from kfp.v2.components.component_decorator import component +from kfp.components.component_decorator import component -from kfp.v2.components.importer_node import importer +from kfp.components.importer_node import importer -from kfp.v2.components.pipeline_channel import ( +from kfp.components.pipeline_channel import ( PipelineArtifactChannel, PipelineChannel, PipelineParameterChannel, ) -from kfp.v2.components.pipeline_context import pipeline -from kfp.v2.components.pipeline_task import PipelineTask -from kfp.v2.components.task_final_status import PipelineTaskFinalStatus -from kfp.v2.components.tasks_group import ( +from kfp.components.pipeline_context import pipeline +from kfp.components.pipeline_task import PipelineTask +from kfp.components.task_final_status import PipelineTaskFinalStatus +from kfp.components.tasks_group import ( Condition, ExitHandler, ParallelFor, ) -from kfp.v2.components.types.artifact_types import ( +from kfp.components.types.artifact_types import ( Artifact, ClassificationMetrics, Dataset, @@ -39,7 +39,7 @@ Model, SlicedClassificationMetrics, ) -from kfp.v2.components.types.type_annotations import ( +from kfp.components.types.type_annotations import ( Input, Output, InputPath, diff --git a/sdk/python/requirements.in b/sdk/python/requirements.in index 5f684b9eea2..1e9a533fc9d 100644 --- a/sdk/python/requirements.in +++ b/sdk/python/requirements.in @@ -29,7 +29,7 @@ tabulate>=0.8.6,<1 click>=7.1.2,<9 typer>=0.3.2,<1.0 -# kfp.v2 +# kfp absl-py>=0.9,<=0.11 kfp-pipeline-spec>=0.1.13,<0.2.0 fire>=0.3.1,<1 diff --git a/sdk/python/setup.py b/sdk/python/setup.py index 8408031f8e1..5ce105f04d8 100644 --- a/sdk/python/setup.py +++ b/sdk/python/setup.py @@ -109,11 +109,10 @@ def find_version(*file_path_parts): 'kfp.deprecated.dsl', 'kfp.deprecated.dsl.extensions', 'kfp.deprecated.notebook', - 'kfp.v2', - 'kfp.v2.compiler', - 'kfp.v2.components', - 'kfp.v2.components.types', - 'kfp.v2.dsl', + 'kfp.compiler', + 'kfp.components', + 'kfp.components.types', + 'kfp.dsl', ], classifiers=[ 'Intended Audience :: Developers', @@ -135,7 +134,7 @@ def find_version(*file_path_parts): entry_points={ 'console_scripts': [ 'dsl-compile = kfp.deprecated.compiler.main:main', - 'dsl-compile-v2 = kfp.v2.compiler.main:main', + 'dsl-compile-v2 = kfp.compiler.main:main', 'kfp=kfp.__main__:main' ] }) diff --git a/sdk/python/tests/dsl/container_op_tests.py b/sdk/python/tests/dsl/container_op_tests.py deleted file mode 100644 index 1c4280b800d..00000000000 --- a/sdk/python/tests/dsl/container_op_tests.py +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright 2018-2019 The Kubeflow Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest -from kubernetes.client.models import V1EnvVar, V1VolumeMount - -import kfp.deprecated as kfp -from kfp.deprecated.dsl import ContainerOp, UserContainer, Sidecar, PipelineVolume - - -class TestContainerOp(unittest.TestCase): - - def test_basic(self): - """Test basic usage.""" - - def my_pipeline(param1, param2): - op1 = ( - ContainerOp( - name='op1', - image='image', - arguments=['%s hello %s %s' % (param1, param2, param1)], - init_containers=[ - UserContainer( - name='initcontainer0', image='initimage0') - ], - sidecars=[Sidecar(name='sidecar0', image='image0')], - container_kwargs={ - 'env': [V1EnvVar(name='env1', value='value1')] - }, - file_outputs={ - 'out1': '/tmp/b' - }).add_init_container( - UserContainer( - name='initcontainer1', - image='initimage1')).add_init_container( - UserContainer( - name='initcontainer2', - image='initimage2')).add_sidecar( - Sidecar( - name='sidecar1', - image='image1')).add_sidecar( - Sidecar( - name='sidecar2', - image='image2'))) - - self.assertCountEqual([x.name for x in op1.inputs], - ['param1', 'param2']) - self.assertCountEqual(list(op1.outputs.keys()), ['out1']) - self.assertCountEqual([x.op_name for x in op1.outputs.values()], - [op1.name]) - self.assertEqual(op1.output.name, 'out1') - self.assertCountEqual( - [init_container.name for init_container in op1.init_containers], - ['initcontainer0', 'initcontainer1', 'initcontainer2']) - self.assertCountEqual([ - init_container.image for init_container in op1.init_containers - ], ['initimage0', 'initimage1', 'initimage2']) - self.assertCountEqual([sidecar.name for sidecar in op1.sidecars], - ['sidecar0', 'sidecar1', 'sidecar2']) - self.assertCountEqual([sidecar.image for sidecar in op1.sidecars], - ['image0', 'image1', 'image2']) - self.assertCountEqual([env.name for env in op1.container.env], - ['env1']) - - kfp.compiler.Compiler()._compile(my_pipeline) - - def test_after_op(self): - """Test duplicate ops.""" - op1 = ContainerOp(name='op1', image='image') - op2 = ContainerOp(name='op2', image='image') - op2.after(op1) - self.assertCountEqual(op2.dependent_names, [op1.name]) - - def test_deprecation_warnings(self): - """Test deprecation warnings.""" - op = ContainerOp(name='op1', image='image') - - with self.assertWarns(PendingDeprecationWarning): - op.env_variables = [V1EnvVar(name="foo", value="bar")] - - with self.assertWarns(PendingDeprecationWarning): - op.image = 'image2' - - with self.assertWarns(PendingDeprecationWarning): - op.set_memory_request('10M') - - with self.assertWarns(PendingDeprecationWarning): - op.set_memory_limit('10M') - - with self.assertWarns(PendingDeprecationWarning): - op.set_cpu_request('100m') - - with self.assertWarns(PendingDeprecationWarning): - op.set_cpu_limit('1') - - with self.assertWarns(PendingDeprecationWarning): - op.set_gpu_limit('1') - - with self.assertWarns(PendingDeprecationWarning): - op.add_env_variable(V1EnvVar(name="foo", value="bar")) - - with self.assertWarns(PendingDeprecationWarning): - op.add_volume_mount( - V1VolumeMount( - mount_path='/secret/gcp-credentials', - name='gcp-credentials')) - - def test_add_pvolumes(self): - pvolume = PipelineVolume(pvc='test') - op = ContainerOp(name='op1', image='image', pvolumes={'/mnt': pvolume}) - - self.assertEqual(pvolume.dependent_names, []) - self.assertEqual(op.pvolume.dependent_names, [op.name]) - self.assertEqual(op.volumes[0].dependent_names, [op.name]) diff --git a/sdk/python/tests/dsl/pipeline_volume_tests.py b/sdk/python/tests/dsl/pipeline_volume_tests.py deleted file mode 100644 index 1669970eacb..00000000000 --- a/sdk/python/tests/dsl/pipeline_volume_tests.py +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 2019 The Kubeflow Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import kfp.deprecated as kfp -from kfp.deprecated.dsl import VolumeOp, ContainerOp, PipelineVolume -import unittest - - -class TestPipelineVolume(unittest.TestCase): - - def test_basic(self): - """Test basic usage.""" - - def my_pipeline(): - vol = VolumeOp( - name="myvol_creation", resource_name="myvol", size="1Gi") - op1 = ContainerOp( - name="op1", image="image", pvolumes={"/mnt": vol.volume}) - op2 = ContainerOp( - name="op2", image="image", pvolumes={"/data": op1.pvolume}) - - self.assertEqual(vol.volume.dependent_names, []) - self.assertEqual(op1.pvolume.dependent_names, [op1.name]) - self.assertEqual(op2.dependent_names, [op1.name]) - - kfp.compiler.Compiler()._compile(my_pipeline) - - def test_after_method(self): - """Test the after method.""" - - def my_pipeline(): - op1 = ContainerOp(name="op1", image="image") - op2 = ContainerOp(name="op2", image="image").after(op1) - op3 = ContainerOp(name="op3", image="image") - vol1 = PipelineVolume(name="pipeline-volume") - vol2 = vol1.after(op1) - vol3 = vol2.after(op2) - vol4 = vol3.after(op1, op2) - vol5 = vol4.after(op3) - - self.assertEqual(vol1.dependent_names, []) - self.assertEqual(vol2.dependent_names, [op1.name]) - self.assertEqual(vol3.dependent_names, [op2.name]) - self.assertEqual(sorted(vol4.dependent_names), [op1.name, op2.name]) - self.assertEqual( - sorted(vol5.dependent_names), [op1.name, op2.name, op3.name]) - - kfp.compiler.Compiler()._compile(my_pipeline) - - def test_omitting_name(self): - """Test PipelineVolume creation when omitting "name".""" - - def my_pipeline(param='foo'): - vol1 = PipelineVolume(pvc="foo") - vol2 = PipelineVolume(name="provided", pvc="foo") - name1 = ( - "pvolume-4cf668b8c7be134cfcbd7758d1eef9643d1bd7ed9925a98e707635b" - ) - name2 = "provided" - self.assertEqual(vol1.name, name1) - self.assertEqual(vol2.name, name2) - - # Testing json.dumps() when pvc is a PipelineParam to avoid - # `TypeError: Object of type PipelineParam is not JSON serializable` - vol3 = PipelineVolume(pvc=param) - - kfp.compiler.Compiler()._compile(my_pipeline) diff --git a/sdk/python/tests/dsl/resource_op_tests.py b/sdk/python/tests/dsl/resource_op_tests.py deleted file mode 100644 index fceaad06798..00000000000 --- a/sdk/python/tests/dsl/resource_op_tests.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2019 The Kubeflow Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import kfp.deprecated as kfp -from kfp.deprecated.dsl import PipelineParam, ResourceOp -from kubernetes import client as k8s_client -import unittest - - -class TestResourceOp(unittest.TestCase): - - def test_basic(self): - """Test basic usage.""" - - def my_pipeline(param): - resource_metadata = k8s_client.V1ObjectMeta(name="my-resource") - k8s_resource = k8s_client.V1PersistentVolumeClaim( - api_version="v1", - kind="PersistentVolumeClaim", - metadata=resource_metadata) - res = ResourceOp( - name="resource", - k8s_resource=k8s_resource, - success_condition=param, - attribute_outputs={"test": "attr"}) - - self.assertCountEqual([x.name for x in res.inputs], ["param"]) - self.assertEqual(res.name, "resource") - self.assertEqual(res.resource.success_condition, param) - self.assertEqual(res.resource.action, "create") - self.assertEqual(res.resource.failure_condition, None) - self.assertEqual(res.resource.manifest, None) - expected_attribute_outputs = { - "manifest": "{}", - "name": "{.metadata.name}", - "test": "attr" - } - self.assertEqual(res.attribute_outputs, expected_attribute_outputs) - expected_outputs = { - "manifest": PipelineParam(name="manifest", op_name=res.name), - "name": PipelineParam(name="name", op_name=res.name), - "test": PipelineParam(name="test", op_name=res.name), - } - self.assertEqual(res.outputs, expected_outputs) - self.assertEqual(res.output, - PipelineParam(name="test", op_name=res.name)) - self.assertEqual(res.dependent_names, []) - - kfp.compiler.Compiler()._compile(my_pipeline) - - def test_delete(self): - """Test delete method.""" - param = PipelineParam("param") - k8s_resource = { - "apiVersion": "version", - "kind": "CustomResource", - "metadata": { - "name": "my-resource" - } - } - res = ResourceOp( - name="resource", - k8s_resource=k8s_resource, - success_condition=param, - attribute_outputs={"test": "attr"}) - - delete_res = res.delete() - - expected_name = str(res.outputs['name']) - - self.assertEqual(delete_res.command, [ - 'kubectl', 'delete', 'CustomResource', expected_name, - '--ignore-not-found', '--output', 'name', '--wait=false' - ]) - self.assertEqual(delete_res.outputs, {}) diff --git a/sdk/python/tests/dsl/volume_op_tests.py b/sdk/python/tests/dsl/volume_op_tests.py deleted file mode 100644 index be3c243e7c4..00000000000 --- a/sdk/python/tests/dsl/volume_op_tests.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2019 The Kubeflow Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from kubernetes.client.models import (V1Volume, - V1PersistentVolumeClaimVolumeSource) - -import kfp.deprecated as kfp -from kfp.deprecated.dsl import PipelineParam, VolumeOp, PipelineVolume -import unittest - - -class TestVolumeOp(unittest.TestCase): - - def test_basic(self): - """Test basic usage.""" - - def my_pipeline(param1, param2): - vol = VolumeOp( - name="myvol_creation", - resource_name=param1, - size=param2, - annotations={"test": "annotation"}) - - self.assertCountEqual([x.name for x in vol.inputs], - ["param1", "param2"]) - self.assertEqual(vol.k8s_resource.metadata.name, - "{{workflow.name}}-%s" % str(param1)) - expected_attribute_outputs = { - "manifest": "{}", - "name": "{.metadata.name}", - "size": "{.status.capacity.storage}" - } - self.assertEqual(vol.attribute_outputs, expected_attribute_outputs) - expected_outputs = { - "manifest": PipelineParam(name="manifest", op_name=vol.name), - "name": PipelineParam(name="name", op_name=vol.name), - "size": PipelineParam(name="size", op_name=vol.name) - } - self.assertEqual(vol.outputs, expected_outputs) - self.assertEqual(vol.output, - PipelineParam(name="name", op_name=vol.name)) - self.assertEqual(vol.dependent_names, []) - expected_volume = PipelineVolume( - name="myvol-creation", - persistent_volume_claim=V1PersistentVolumeClaimVolumeSource( - claim_name=PipelineParam(name="name", op_name=vol.name))) - - kfp.compiler.Compiler()._compile(my_pipeline) - - def test_delete(self): - """Test delete method.""" - vop = VolumeOp(name="vop", resource_name="vop", size="1Gi") - - delete_vop = vop.delete() - - expected_name = str(vop.outputs['name']) - - self.assertEqual(delete_vop.command, [ - 'kubectl', 'delete', 'PersistentVolumeClaim', expected_name, - '--ignore-not-found', '--output', 'name', '--wait=false' - ]) - self.assertEqual(delete_vop.outputs, {}) diff --git a/sdk/python/tests/dsl/volume_snapshotop_tests.py b/sdk/python/tests/dsl/volume_snapshotop_tests.py deleted file mode 100644 index ba4972653ac..00000000000 --- a/sdk/python/tests/dsl/volume_snapshotop_tests.py +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright 2019 The Kubeflow Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from kubernetes import client as k8s_client -import kfp.deprecated as kfp -from kfp.deprecated.dsl import PipelineParam, VolumeOp, VolumeSnapshotOp -import unittest - - -class TestVolumeSnapshotOp(unittest.TestCase): - - def test_basic(self): - """Test basic usage.""" - - def my_pipeline(param1, param2): - vol = VolumeOp( - name="myvol_creation", - resource_name="myvol", - size="1Gi", - ) - snap1 = VolumeSnapshotOp( - name="mysnap_creation", - resource_name=param1, - volume=vol.volume, - ) - snap2 = VolumeSnapshotOp( - name="mysnap_creation", - resource_name="mysnap", - pvc=param2, - attribute_outputs={"size": "test"}) - snap3 = VolumeSnapshotOp( - name="mysnap_creation2", - resource_name="mysnap2", - pvc=param2, - api_version="snapshot.storage.k8s.io/v1beta1", - attribute_outputs={"size": "test"}) - - self.assertEqual( - sorted([x.name for x in snap1.inputs]), ["name", "param1"]) - self.assertEqual(sorted([x.name for x in snap2.inputs]), ["param2"]) - expected_attribute_outputs_1 = { - "manifest": "{}", - "name": "{.metadata.name}", - "size": "{.status.restoreSize}" - } - self.assertEqual(snap1.attribute_outputs, - expected_attribute_outputs_1) - expected_attribute_outputs_2 = { - "manifest": "{}", - "name": "{.metadata.name}", - "size": "test" - } - self.assertEqual(snap2.attribute_outputs, - expected_attribute_outputs_2) - expected_outputs_1 = { - "manifest": PipelineParam(name="manifest", op_name=snap1.name), - "name": PipelineParam(name="name", op_name=snap1.name), - "size": PipelineParam(name="name", op_name=snap1.name), - } - self.assertEqual(snap1.outputs, expected_outputs_1) - expected_outputs_2 = { - "manifest": PipelineParam(name="manifest", op_name=snap2.name), - "name": PipelineParam(name="name", op_name=snap2.name), - "size": PipelineParam(name="name", op_name=snap2.name), - } - self.assertEqual(snap2.outputs, expected_outputs_2) - self.assertEqual(snap1.output, - PipelineParam(name="name", op_name=snap1.name)) - self.assertEqual(snap2.output, - PipelineParam(name="size", op_name=snap2.name)) - self.assertEqual(snap1.dependent_names, []) - self.assertEqual(snap2.dependent_names, []) - expected_snapshot_1 = k8s_client.V1TypedLocalObjectReference( - api_group="snapshot.storage.k8s.io", - kind="VolumeSnapshot", - name=PipelineParam(name="name", op_name=vol.name)) - self.assertEqual(snap1.snapshot, expected_snapshot_1) - expected_snapshot_2 = k8s_client.V1TypedLocalObjectReference( - api_group="snapshot.storage.k8s.io", - kind="VolumeSnapshot", - name=PipelineParam(name="param1")) - assert (snap2.k8s_resource['apiVersion'] == - "snapshot.storage.k8s.io/v1alpha1") - self.assertEqual(snap2.snapshot, expected_snapshot_2) - - expected_snapshot_3 = k8s_client.V1TypedLocalObjectReference( - api_group="snapshot.storage.k8s.io", - kind="VolumeSnapshot", - name=PipelineParam(name="param1")) - self.assertEqual(snap3.snapshot, expected_snapshot_3) - assert (snap3.k8s_resource['apiVersion'] == - "snapshot.storage.k8s.io/v1beta1") - - kfp.compiler.Compiler()._compile(my_pipeline)