dermasmid opened a new pull request, #29944:
URL: https://github.com/apache/beam/pull/29944
Typescript Dofn's are very limited due to limited support for serialization
in Js as a whole.
The following PR gets around serialization entirely by, importing the users
function from their code, which allows for basically any code to run.
There's a few ways to implement it, none of them seem to be perfect, but ive
done two here:
1. import the function by using require on the user's module
2. having the user register the `fn` and save it in the `global` object
The drawbacks:
1. it's not always possible to determine when the users `fn` can be imported
from automatically
2. it's not as clean, we need to require() the users module to get those
registers to run
Both approaches will result in the users pipeline code to run on the worker,
which means we need to avoid starting the pipeline in case we run on the worker
(similar to python's __name__ == "__main__"), but we can prob detect it in the
sdk code so the user does not have to deal with it.
The reason this was so easy to implement is because we already pack in then
install the user's code on the workers, so the only thing we need to solve is
how to import the fn that that user passed in while creating the pipeline.
In any case this PR is meant to showcase the idea and start a conversation
------------------------
Thank you for your contribution! Follow this checklist to help us
incorporate your contribution quickly and easily:
- [ ] Mention the appropriate issue in your description (for example:
`addresses #123`), if applicable. This will automatically add a link to the
pull request in the issue. If you would like the issue to automatically close
on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more
tips on [how to make review process
smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
To check the build health, please visit
[https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more
information about GitHub Actions CI or the [workflows
README](https://github.com/apache/beam/blob/master/.github/workflows/README.md)
to see a list of phrases to trigger workflows.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]