Skip to content

Instantly share code, notes, and snippets.

@jesuino
Created December 1, 2025 14:20
Show Gist options
  • Select an option

  • Save jesuino/491f73eed363b5c15021ae762e073487 to your computer and use it in GitHub Desktop.

Select an option

Save jesuino/491f73eed363b5c15021ae762e073487 to your computer and use it in GitHub Desktop.
kfp 2.15.0 reproducer - a way to reproduce a problem with kfp 2.15.1 that didn't happen on kfp 2.14.6
time="2025-12-01T14:17:59.005Z" level=info msg="capturing logs" argo=true
I1201 14:17:59.064603 14 main.go:66] Setting log level to: '1'
I1201 14:17:59.068492 14 cache.go:89] Connecting to cache endpoint ml-pipeline.kubeflow:8887
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[KFP Executor 2025-12-01 14:18:58,776 INFO]: Looking for component `simple_step` in --component_module_path `/tmp/tmp.1Qm9TBZmcu/ephemeral_component.py`
[KFP Executor 2025-12-01 14:18:58,776 INFO]: Loading KFP component "simple_step" from /tmp/tmp.1Qm9TBZmcu/ephemeral_component.py (directory "/tmp/tmp.1Qm9TBZmcu" and module name "ephemeral_component")
[KFP Executor 2025-12-01 14:18:58,777 INFO]: Got executor_input:
{
"inputs": {},
"outputs": {
"artifacts": {
"executor-logs": {
"artifacts": [
{
"name": "executor-logs",
"type": {
"schemaTitle": "system.Artifact"
},
"uri": "minio://mlpipeline/v2/artifacts/simple/0c913da7-0a3f-4a1f-a7c6-0692d380f989/simple-step/b1cc0127-07a0-4aae-b10a-c1997c5b195d/executor-logs"
}
]
},
"simple_html_report": {
"artifacts": [
{
"name": "simple_html_report",
"type": {
"schemaTitle": "system.HTML",
"schemaVersion": "0.0.1"
},
"uri": "minio://mlpipeline/v2/artifacts/simple/0c913da7-0a3f-4a1f-a7c6-0692d380f989/simple-step/b1cc0127-07a0-4aae-b10a-c1997c5b195d/simple_html_report"
}
]
}
},
"outputFile": "/minio/mlpipeline/v2/artifacts/simple/0c913da7-0a3f-4a1f-a7c6-0692d380f989/simple-step/b1cc0127-07a0-4aae-b10a-c1997c5b195d/output_metadata.json"
}
}
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/site-packages/kfp/dsl/executor_main.py", line 109, in <module>
executor_main()
File "/usr/local/lib/python3.10/site-packages/kfp/dsl/executor_main.py", line 101, in executor_main
output_file = executor.execute()
File "/usr/local/lib/python3.10/site-packages/kfp/dsl/executor.py", line 415, in execute
result = self.func(**func_kwargs)
File "/tmp/tmp.1Qm9TBZmcu/ephemeral_component.py", line 30, in simple_step
from kale.common.jputils import run_code as _kale_run_code
File "/usr/local/lib/python3.10/site-packages/kale/__init__.py", line 41, in <module>
from .step import Step, StepConfig
File "/usr/local/lib/python3.10/site-packages/kale/step.py", line 9, in <module>
from kale.common import astutils, runutils
File "/usr/local/lib/python3.10/site-packages/kale/common/runutils.py", line 10, in <module>
from kale.common import utils, kfputils
File "/usr/local/lib/python3.10/site-packages/kale/common/kfputils.py", line 17, in <module>
from kfp.compiler import Compiler
File "/usr/local/lib/python3.10/site-packages/kfp/compiler/__init__.py", line 21, in <module>
from kfp.compiler.compiler import Compiler
File "/usr/local/lib/python3.10/site-packages/kfp/compiler/compiler.py", line 22, in <module>
from kfp.compiler import pipeline_spec_builder as builder
File "/usr/local/lib/python3.10/site-packages/kfp/compiler/pipeline_spec_builder.py", line 27, in <module>
from kfp.compiler import compiler_utils
File "/usr/local/lib/python3.10/site-packages/kfp/compiler/compiler_utils.py", line 29, in <module>
from kfp.dsl import pipeline_context
File "/usr/local/lib/python3.10/site-packages/kfp/dsl/pipeline_context.py", line 20, in <module>
from kfp.dsl import component_factory
File "/usr/local/lib/python3.10/site-packages/kfp/dsl/component_factory.py", line 33, in <module>
from kfp.dsl import graph_component
File "/usr/local/lib/python3.10/site-packages/kfp/dsl/graph_component.py", line 32, in <module>
class GraphComponent(base_component.BaseComponent):
File "/usr/local/lib/python3.10/site-packages/kfp/dsl/graph_component.py", line 141, in GraphComponent
self, pipeline: pipeline_context.Pipeline,
AttributeError: partially initialized module 'kfp.dsl.pipeline_context' has no attribute 'Pipeline' (most likely due to a circular import)
I1201 14:18:58.907472 14 launcher_v2.go:193] publish success.
I1201 14:18:58.935819 14 client.go:750] Attempting to update DAG state
F1201 14:18:58.957228 14 main.go:58] failed to execute component: exit status 1
time="2025-12-01T14:18:59.032Z" level=info msg="sub-process exited" argo=true error="<nil>"
Error: exit status 1
import json
import kfp.dsl as kfp_dsl
from kfp.dsl import Input, Output, Dataset, HTML, Metrics, ClassificationMetrics, Artifact, Model
@kfp_dsl.component(
base_image='python:3.10',
packages_to_install=['kfp>=2.0.0',
'dev-kubeflow-kale'],
pip_index_urls=['https://pypi.org/simple', 'https://test.pypi.org/simple'],
)
def simple_step(simple_html_report: Output[HTML]):
_kale_pipeline_parameters_block = '''
'''
_kale_data_loading_block = '''
# -----------------------DATA LOADING START--------------------------------
from kale import marshal as _kale_marshal
_kale_marshal.set_data_dir("/marshal")
# -----------------------DATA LOADING END----------------------------------
'''
_kale_block1 = '''
print("Very Simple")
'''
_kale_data_saving_block = '''
# -----------------------DATA SAVING START---------------------------------
from kale import marshal as _kale_marshal
_kale_marshal.set_data_dir("/marshal")
# -----------------------DATA SAVING END-----------------------------------
'''
# run the code blocks inside a jupyter kernel
from kale.common.jputils import run_code as _kale_run_code
from kale.common.kfputils import \
update_uimetadata as _kale_update_uimetadata
_kale_blocks = (
_kale_pipeline_parameters_block,
_kale_data_loading_block,
_kale_block1,
_kale_data_saving_block
)
_kale_html_artifact = _kale_run_code(_kale_blocks)
with open(simple_html_report.path, "w") as f:
f.write(_kale_html_artifact)
_kale_update_uimetadata('simple_html_report')
@kfp_dsl.pipeline(
name='simple',
description=''
)
def auto_generated_pipeline(
):
"""Auto-generated pipeline function."""
simple_task = simple_step(
)
simple_task.set_display_name("simple-step")
if __name__ == "__main__":
from kfp import compiler
pipeline_filename = 'simple.yaml'
compiler.Compiler().compile(auto_generated_pipeline, pipeline_filename)
print(f"Pipeline compiled to {pipeline_filename}")
print("To run, upload this YAML to your KFP v2 instance or use kfp.Client().create_run_from_pipeline_func.")
# PIPELINE DEFINITION
# Name: simple
# Description: Auto-generated pipeline function.
components:
comp-simple-step:
executorLabel: exec-simple-step
outputDefinitions:
artifacts:
simple_html_report:
artifactType:
schemaTitle: system.HTML
schemaVersion: 0.0.1
deploymentSpec:
executors:
exec-simple-step:
container:
args:
- --executor_input
- '{{$}}'
- --function_to_execute
- simple_step
command:
- sh
- -c
- "\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 --index-url https://pypi.org/simple\
\ --extra-index-url https://test.pypi.org/simple --trusted-host https://pypi.org/simple\
\ --trusted-host https://test.pypi.org/simple 'kfp>=2.0.0' 'dev-kubeflow-kale'\
\ && \"$0\" \"$@\"\n"
- sh
- -ec
- 'program_path=$(mktemp -d)
printf "%s" "$0" > "$program_path/ephemeral_component.py"
_KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"
'
- "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\
\ *\n\ndef simple_step(simple_html_report: Output[HTML]):\n _kale_pipeline_parameters_block\
\ = '''\n '''\n\n _kale_data_loading_block = '''\n # -----------------------DATA\
\ LOADING START--------------------------------\n from kale import marshal\
\ as _kale_marshal\n _kale_marshal.set_data_dir(\"/marshal\")\n #\
\ -----------------------DATA LOADING END----------------------------------\n\
\ '''\n\n _kale_block1 = '''\n print(\"Very Simple\")\n '''\n\
\n _kale_data_saving_block = '''\n # -----------------------DATA SAVING\
\ START---------------------------------\n from kale import marshal as\
\ _kale_marshal\n _kale_marshal.set_data_dir(\"/marshal\")\n # -----------------------DATA\
\ SAVING END-----------------------------------\n '''\n\n # run the\
\ code blocks inside a jupyter kernel\n from kale.common.jputils import\
\ run_code as _kale_run_code\n from kale.common.kfputils import \\\n\
\ update_uimetadata as _kale_update_uimetadata\n\n _kale_blocks\
\ = (\n _kale_pipeline_parameters_block,\n _kale_data_loading_block,\n\
\n _kale_block1,\n _kale_data_saving_block\n )\n\n _kale_html_artifact\
\ = _kale_run_code(_kale_blocks)\n with open(simple_html_report.path,\
\ \"w\") as f:\n f.write(_kale_html_artifact)\n _kale_update_uimetadata('simple_html_report')\n\
\n"
image: python:3.10
pipelineInfo:
description: Auto-generated pipeline function.
name: simple
root:
dag:
tasks:
simple-step:
cachingOptions:
enableCache: true
componentRef:
name: comp-simple-step
taskInfo:
name: simple-step
schemaVersion: 2.1.0
sdkVersion: kfp-2.15.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment