Repository navigation
Conversation
|
@ada333 please review this pr once. |
jesuino
left a comment
There was a problem hiding this comment.
Hello @SajalDevX - the changes are looking good and I plan to run it locally to test - would you please resolve the conflicts?
Thanks!
get_annotation_or_label_from_tag split the tag on ':' and then rebuilt the value with "".join, so every colon in the value was lost (URLs, timestamps, JSON). Join with TAG_SEPARATOR instead, the same way the image tag does. Refs kubeflow#975 Signed-off-by: Sajal Kumar Jana <kakalijana1254@gmail.com>
The template wrapped the raw value in double quotes, so an annotation like {"lr": 0.01} produced a DSL file that doesn't parse. Keys are already limited to safe characters by the validators, but values are free-form strings, so render them with tojson to get a properly escaped literal.
Refs kubeflow#975
Signed-off-by: Sajal Kumar Jana <kakalijana1254@gmail.com>
Covers step tags and steps_defaults with a URL, a timestamp and a JSON value. Refs kubeflow#975 Signed-off-by: Sajal Kumar Jana <kakalijana1254@gmail.com>
Compiles a notebook with a URL annotation, a JSON annotation and a label, then parses the generated file and reads the values back with literal_eval. Refs kubeflow#975 Signed-off-by: Sajal Kumar Jana <kakalijana1254@gmail.com>
Refs kubeflow#975 Signed-off-by: Sajal Kumar Jana <kakalijana1254@gmail.com>
Refs kubeflow#975 Signed-off-by: Sajal Kumar Jana <kakalijana1254@gmail.com>
Refs kubeflow#975 Signed-off-by: Sajal Kumar Jana <kakalijana1254@gmail.com>
|
Thanks for taking a look. I rebased onto the latest main and resolved the conflict in test_compiler.py, so it should be ready to try locally. |
cf5c3d3 to
f2df1e4
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@jesuino gentle ping, this is rebased on main and ready for another look. |
Fixes #975
What
Annotation (and label) values were changed or broke compilation in two ways:
get_annotation_or_label_from_tag()split the tag on:and put the value back together with"".join(...), so every:in the value disappeared.http://grafana.local:3000/d/abcbecamehttp//grafana.local3000/d/abc. This also hitsteps_defaults, since it uses the same helper._step_config.jinja2put the raw value inside"...", so a value like{"lr": 0.01}generated a DSL file that fails withSyntaxError.Changes
nbprocessor.py: join the rest of the tag withTAG_SEPARATOR(same as theimage:tag handling a few lines below)._step_config.jinja2: renderlabel_valueandannotation_valuewith| tojsonso they always end up as valid, escaped string literals. Keys are left as they are, since the validators already restrict them.For plain values the output is the same
"value"literal as before, so the existing golden DSL files didn't need to change.Testing
steps_defaults(URL with a port, timestamp, JSON value). These fail onmain.astand checks the values withliteral_eval. This fails onmainwith theSyntaxError.pytest kale/tests/unit_testspasses locally, andruff check/ruff format --checkare clean.kale --nbon a small notebook with the tags from the issue and checked that the generated file parses and has the right values.Assisted-by: Claude
Update:
tojsonescapes non-BMP characters such as emoji as JSON surrogate pairs, which Python then reads back as lone surrogates, so an annotation with an emoji produced a DSL that couldn't be encoded as UTF-8. The values are now rendered with a smallpyreprfilter (Pythonrepr, double-quoted where possible so ordinary values come out exactly as before). Added a test with an emoji and mixed quotes. The fullkale/testsrun is unchanged apart fromtest_kfp_server_config.py::test_load_config_read_error, which fails on the base commit too.