mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
![]() - Enhanced ray dag InputNode to take arbitrary user input via `.execute()`. - If only one value is provided, like `dag.execute(1)`, return raw value; - Otherwise wrap user input into an `DAGInputData` object that can be accessed via index or key. - User can also pass list / dict object and just access them via index [0] or key ["key"] - Introduced `InputAttrNode` that helps to connect partial attribute of user input to the DAG. - Added context manager syntax for `InputNode`. - Add InputNode enforcements with tests, such as DAG level singleton, exception with messages, etc. - Enforce only simple int or str key - Take care of JSON serialization for InputNode that carried original context manager info, ensure it's preserved. - DAGNode UUID is also preserved in JSON serde. ## Next steps On ray dag level we're proceeding with ``` with InputNode() as input: # Probably better to rename it to DAGInput() a = Model.bind(input[0]) b = Model.bind(input.x) dag = combine.bind(a, b) ``` But also enforces 1) InputNode is always used in context manager as opposed to directly created 2) There should be one and only one InputNode instance for each dag. 3) No args passed by user to InputNode at ray dag level. Then in serve we subclass a ServeInputNode() to enhance it like the following to support HTTP input validation and conversion: ``` with ServeInputNode(schema=MySchemaCls) as input: a = Model.bind(input[0]) b = Model.bind(input.x) dag = combine.bind(a, b) ``` ## Checks - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [x] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Co-authored-by: Eric Liang <ekhliang@gmail.com> Co-authored-by: mwtian <81660174+mwtian@users.noreply.github.com> |
||
---|---|---|
.. | ||
ray | ||
requirements | ||
asv.conf.json | ||
build-wheel-macos-arm64.sh | ||
build-wheel-macos.sh | ||
build-wheel-manylinux2014.sh | ||
build-wheel-windows.sh | ||
MANIFEST.in | ||
README-building-wheels.md | ||
requirements.txt | ||
requirements_linters.txt | ||
requirements_ml_docker.txt | ||
setup.py |