Commit Graph

18 Commits

Author SHA1 Message Date
Alex Latchford a0b18eb9e8
fix(sdk): Get short name of complex input/output types to ensure we can map to appropriate de|serializer (#6504)
Also:
- Simplify _data_passing methods, add in type hints and docstrings.
- Remove get_deserializer_code_for_type.
2021-09-09 17:31:51 -07:00
Chen Sun 2f19a26ffd
chore(sdk): Format all Python files under SDK folder. (#6501)
* Reformat sdk only using the new yapf config.

* Reformat docstrings using docformatter.

* update golden files to resolve diff caused by whitespaces

* fix some tests

* format .py files under sdk/python/tests using yapf

* additional docformatter

* fix some tests
2021-09-03 11:25:11 -07:00
Chen Sun 58f74d3347
feat(sdk): special handling for type annotation using `typing.Optional` (#5716)
* handle type annotation with Optional

* remove typing._GenericAlias, which is available only after Py 3.7

* fix

* fix py3.6 test

* address review comments
2021-05-25 06:57:09 -07:00
Chen Sun 2abc352ad8
feat(sdk.v2): Support bool, dict, list, JsonObject, and JsonArray type as parameter types (#5665)
* Treat bool, dict, and list type as parameter types

* fix tests

* address review comments

* update test golden files

* address review comments
2021-05-18 12:41:41 -07:00
Alexey Volkov cc83e1089b
Assigned copyright to the project authors (#5587) 2021-05-05 13:53:22 +08:00
Chen Sun 61f9c2c328
chore(sdk): allow serializing pipeline params with `typing` type hints (#5153)
* support serializing pipeline params with `typing` type hints

* back to relative import

* address different behaviors in py3.6 vs py3.7+
2021-02-19 14:56:45 -08:00
Alexey Volkov d4fd6e16a8
feat(sdk): Components - Added Bool as a known type name (#4597)
* SDK - Components - Added Bool as a known type name

Some components are already using this type name and are starting to fail due to more strict type checking during constant argument serialization.

* Fixed syntax error
2020-10-09 03:49:06 -07:00
Alexey Volkov 03325848fc
feat(sdk): Components - Prevent passing unserializable objects to components. Fixes #4040 (#4496) 2020-09-16 02:23:22 -07:00
Alexey Volkov f773b9c263
SDK - Components - Stabilize JSON serialization by sorting keys (#3879)
* SDK - Components - Stabilize JSON serialization by sorting keys

Otherwise serialization of the default values of the component/pipeline inputs is unstable on Python 3.5.

* Fixed the test data
2020-06-01 03:07:55 -07:00
Alexey Volkov 7ee3244f5b
SDK - Components - Fixed dict-style type annotations (#3107)
Refactored `_data_passing.py` interface to expose functions instead of dictionaries.
2020-02-18 20:40:25 -08:00
Alexey Volkov 8f4f7bc8b6 SDK - Components - Verify the object type when serializing primitive arguments (#2272)
* SDK - Components - Verify the object type when serializing primitive arguments

Fixes an issue where if an input had a primitive type (e.g. `Integer`), you could pass anything to it (e.g. booleans, `ContainerOp`s, functions etc), because it just used `str` as serializer. Now the serializers chack the value type and raise error if the type is incorrect.

* Allow serializing integer when float is required.
2019-10-01 11:55:35 -07:00
Alexey Volkov 7735a14694 SDK - Components - Stop serializing string values (#2227)
This can happen with Lightweight component outputs if they've already been serialized manually.
2019-09-25 20:29:06 -07:00
Alexey Volkov 98fd6c8c32 SDK - Components - Fixed serialization of lists and dicts containing `PipelineParam` items (#2212)
Fixes https://github.com/kubeflow/pipelines/issues/2206
The issue is fixed for both `JSON`-based and `str()`-based serialization.
2019-09-24 19:43:59 -07:00
Alexey Volkov 3a30b2bdcf SDK - Veryfying that the serializer returns string (#1965)
This change was prompted by the failure when b64encode was returning bytes instead of str.
2019-08-27 13:21:12 -07:00
Alexey Volkov d043d165a9 SDK - Components - Add support for the Base64Pickle type (#1946)
* SDK - Components - Add support for the Base64Pickle type

* Make flake8 happy
2019-08-26 18:56:37 -07:00
Alexey Volkov e48d563cb9 SDK - Components - Add support for the List, Dict and Json types (#1945) 2019-08-23 20:12:26 -07:00
Alexey Volkov 11de563852 SDK - Components - Add support for the Boolean type (#1936)
Fixes https://github.com/kubeflow/pipelines/issues/1488
2019-08-23 19:00:26 -07:00
Alexey Volkov 17e18a162e SDK - Components - Improved serialization and deserialization of arguments and defaults (#1934)
* SDK - Components - Improved serialization and deserialization of arguments and defaults

Properly serialize default values and passed arguments using the same code.
Check the types of passed argument values and issue warnings.
Improved argument reference type compatibility checking. When types do not match there is always either error or warning.
When creating component from python function, the input types are now canonicalized.

* Addressed the feedback
2019-08-23 18:18:25 -07:00