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

[Merged by Bors] - feat: added look_back to smartmodule proc macro #3276

Closed
wants to merge 2 commits into from
Closed

[Merged by Bors] - feat: added look_back to smartmodule proc macro #3276

wants to merge 2 commits into from

Conversation

galibey
Copy link
Contributor

@galibey galibey commented May 24, 2023

Added #[smartmodule(look_back)] proc macro to support generating look_back function in the SmartModule.

Fixes #3273

@digikata
Copy link
Contributor

LGTM!

One nitpick, is there a recommended error for user look_back logic to use and attach "application" level context to? A ui-test where user code explicitly returns an error in the lookback fn might be good.

@galibey
Copy link
Contributor Author

galibey commented May 24, 2023

LGTM!

One nitpick, is there a recommended error for user look_back logic to use and attach "application" level context to? A ui-test where user code explicitly returns an error in the lookback fn might be good.

Added an example in ui-tests here 310f6a7

transforms:
- uses: infinyon/fluvio-smartmodule-filter-lookback@0.1.0
with:
lookback:
Copy link
Contributor

@sehz sehz May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no loopback in the code example. It should be removed. The loopback will be controlled by SPU

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this issue but we should have ability to test loopback using SMDK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no loopback in the code example. It should be removed. The loopback will be controlled by SPU

This parameter is consumed on SmartEngine and SPU levels. It will come in the next PRs.
The loopback is controlled by SPU, that's correct. But it still needs to get information of how many records need to be read and passed to the SM via look_back call, and that is where this parameter comes to play.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this issue but we should have ability to test loopback using SMDK

Good point. Added it to the tracking issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't rely on SmartModule on having parameters since it is dependent on author. This need to be assume be defined by SPU

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is supposed to be defined not by the author but by the user of the SmartModule. Some SmartModules need only the last record (github stars, deduplication by monotonic ids, etc), some SmartModules need to read 1000 last records to build some data structure (bloom filters). Later, we may want to introduce asking for records based on time, etc. This is a concern of the configuration of the SmartModule. SPU has no this information.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it was discussed in RFD https://github.com/infinyon/infinyon-rfd/pull/23 and already implemented

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated example

@galibey galibey requested a review from sehz June 1, 2023 10:30
Copy link
Contributor

@sehz sehz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Great job

Copy link
Contributor

@sehz sehz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not showstopper but what happens in if there are other filters and transforms in chain. They may have their own lookback param. So maybe lookback should be associated with chain rather than individual transform steps

In that case transform may more look like this

transforms:
lookback:
last: 10
steps:
- mytranform
- transform2
- bloom3

@galibey
Copy link
Contributor Author

galibey commented Jun 1, 2023

Not showstopper but what happens in if there are other filters and transforms in chain. They may have their own lookback param. So maybe lookback should be associated with chain rather than individual transform steps

In that case transform may more look like this

transforms: lookback: last: 10 steps: - mytranform - transform2 - bloom3

They will get records according to their own lookback parameter.

@galibey
Copy link
Contributor Author

galibey commented Jun 1, 2023

bors r+

bors bot pushed a commit that referenced this pull request Jun 1, 2023
Added `#[smartmodule(look_back)]` proc macro to support generating `look_back` function in the SmartModule. 

Fixes #3273
@bors
Copy link

bors bot commented Jun 1, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title feat: added look_back to smartmodule proc macro [Merged by Bors] - feat: added look_back to smartmodule proc macro Jun 1, 2023
@bors bors bot closed this Jun 1, 2023
@galibey galibey deleted the feat/3273-add-lookback-fn-to-proc-macro branch June 1, 2023 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add lock_back function support to smartmodule proc macro
3 participants