Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEA]: Support passing a custom parser to HttpServerSourceStage #1703

Closed
2 tasks done
dagardner-nv opened this issue May 16, 2024 · 0 comments · Fixed by #1705
Closed
2 tasks done

[FEA]: Support passing a custom parser to HttpServerSourceStage #1703

dagardner-nv opened this issue May 16, 2024 · 0 comments · Fixed by #1705
Assignees
Labels
feature request New feature or request

Comments

@dagardner-nv
Copy link
Contributor

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Medium

Please provide a clear description of problem this feature solves

Not all JSON payloads translate naturally into DataFrames

Describe your ideal solution

Pass in an optional function.

Currently we do:

    def _parse_payload(self, payload: str) -> HttpParseResponse:
        try:
            df = cudf.read_json(payload, lines=self._lines, engine='cudf')
        except Exception as e:
        ...

Instead we could do:

    def _parse_payload(self, payload: str) -> HttpParseResponse:
        try:
            if self._custom_parse_fn is not None:
                df = self._custom_parse_fn(payload)
            else:
                df = cudf.read_json(payload, lines=self._lines, engine='cudf')
        except Exception as e:
        ...

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I have searched the open feature requests and have found no duplicates for this feature request
@dagardner-nv dagardner-nv added the feature request New feature or request label May 16, 2024
@dagardner-nv dagardner-nv self-assigned this May 16, 2024
@dagardner-nv dagardner-nv moved this from Todo to In Progress in Morpheus Boards May 16, 2024
@dagardner-nv dagardner-nv moved this from In Progress to Review - Ready for Review in Morpheus Boards May 16, 2024
rapids-bot bot pushed a commit that referenced this issue May 30, 2024
…lientSourceStage` stages (#1705)

* Add a new constructor argument to `HttpServerSourceStage` & `HttpClientSourceStage` called `payload_to_df_fn`, allowing users to specify a custom payload parser.
* Remove work-around for rapidsai/cudf#5712 this bug is fixed in our current version of cudf.
* Relocate updated tests to `tests/stages`

Closes #1703

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/nv-morpheus/Morpheus/blob/main/docs/source/developer_guide/contributing.md).
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: #1705
@github-project-automation github-project-automation bot moved this from Review - Ready for Review to Done in Morpheus Boards May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
Status: Done
1 participant