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

file-plugins: enabling messagepack format #142

Merged
merged 24 commits into from
Aug 29, 2023

Conversation

tzaffi
Copy link
Contributor

@tzaffi tzaffi commented Aug 18, 2023

File Plugins: Add Messagepack Format and Default to msgp.gz

Based on the extension of the file pattern provided in a file_reader or file_writer plugin, choose:

  1. the Encoding Format (based on .msgp or .json)
  2. whether compression is used (based on .gz)

When no pattern is provided, it defaults to *.msgp.gz

Test Plan

This is all tested in CI including a new integration test conduit/plugins/importers/filereader/fileReadWrite_test.go

@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Merging #142 (6c7f4c8) into master (442791a) will increase coverage by 3.65%.
Report is 56 commits behind head on master.
The diff coverage is 80.61%.

@@            Coverage Diff             @@
##           master     #142      +/-   ##
==========================================
+ Coverage   67.66%   71.31%   +3.65%     
==========================================
  Files          32       37       +5     
  Lines        1976     2761     +785     
==========================================
+ Hits         1337     1969     +632     
- Misses        570      690     +120     
- Partials       69      102      +33     
Files Changed Coverage Δ
conduit/data/block_export_data.go 100.00% <ø> (+92.30%) ⬆️
conduit/metrics/metrics.go 100.00% <ø> (ø)
conduit/pipeline/metadata.go 69.11% <ø> (ø)
conduit/plugins/config.go 100.00% <ø> (ø)
conduit/plugins/importers/algod/metrics.go 100.00% <ø> (ø)
...gins/processors/filterprocessor/fields/searcher.go 77.50% <ø> (ø)
...ins/processors/filterprocessor/filter_processor.go 83.82% <ø> (+3.54%) ⬆️
...plugins/processors/filterprocessor/gen/generate.go 34.28% <ø> (ø)
conduit/plugins/processors/noop/noop_processor.go 64.70% <ø> (+6.81%) ⬆️
pkg/cli/internal/list/list.go 20.75% <ø> (ø)
... and 21 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Zeph Grunschlag added 2 commits August 18, 2023 11:48
@tzaffi tzaffi changed the title msgp in file plugins file-plugins: enabling messagepack format Aug 18, 2023
@tzaffi tzaffi marked this pull request as ready for review August 18, 2023 17:14
@tzaffi tzaffi requested a review from a team August 18, 2023 17:22
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These test fixtures were generated using the block generator scenario config.allmixed.small.yml

Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

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

The actual feature looks fine, nice improvement. I have some misc questions and comments about the refactoring and some potential dead code.

@@ -103,29 +101,23 @@ func (p *pipelineImpl) registerPluginMetricsCallbacks() {
}
}

// makeConfig creates a plugin config from a name and config pair.
// configWithLogger creates a plugin config from a name and config pair.
Copy link
Contributor

Choose a reason for hiding this comment

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

why rename this? Seems unrelated to the rest of the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to set up the integration test, I wanted to break-out the pure config generating portion to a new method pluginType.GetConfig(). With this refactoring, it's clearer that this method does 2 things:

  1. sets up the plugin's config
  2. returns a logger that inherits the pipeline's logger setup

These seemed sufficiently unrelated to me that I thought it was worth rename.

However, renaming is not at all crucial.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

conduit/plugins/exporters/filewriter/util.go Show resolved Hide resolved
@@ -0,0 +1,72 @@
# Log verbosity: PANIC, FATAL, ERROR, WARN, INFO, DEBUG, TRACE
log-level: INFO
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd consider making this programmatically, or removing as much as possible so that there's less opportunity for things to become stale.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

// the genesis file is available __in addition to__ the round 0 block file.
// This is because the encoding assumed for the genesis is different
// from the encoding assumed for blocks.
// TODO: handle the case of a multipurpose file that contains both encodings.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate on this TODO in the comment? As it is, I'm not sure exactly what you have in mind.

Also, the canonical genesis file is json. Maybe we should always write it that way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I mean in the TODO is that in principle, it's possible to have a block 0 which includes both the genesis information as well as the block information. But you hint that this may not be such a great idea and we should probably just assume we have a genesis.json since that's canonical. Does it actually make sense to have a round 0? Should we eliminate the concept?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Plan:

  • remove TODO
  • file exporter/importer ASSUME genesis.json
  • continue with block 0 in appropriate encoding

Copy link
Contributor Author

Choose a reason for hiding this comment

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

)

// GetConfig creates an appropriate plugin config for the type.
func (pt PluginType) GetConfig(cfg data.NameConfigPair, dataDir string) (PluginConfig, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this for? I'm having a hard time figuring out where it's used. There are already several patterns for creating test configurations in the other plugin tests, I think it would be better to use/refine one of those rather than adding a new scheme.

Copy link
Contributor Author

@tzaffi tzaffi Aug 21, 2023

Choose a reason for hiding this comment

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

I'm only using it in fileReadWrite_test.go, and also in the recently renamed pipelineImpl.configWithLogger(). I can easily recreate the logic in the test and revert this new function. I'll go ahead and do that, but I'm going to keep the added typing in this file to the constants Exporter, Processor and Importer as I believe that was the original intent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, yes please revert this and add a test helper if necessary. I think this is unique to the filereader/filewriter e2e test, so it probably doesn't need to be a generally available utility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tzaffi tzaffi requested a review from winder August 22, 2023 21:50
@tzaffi tzaffi requested a review from shiqizng August 25, 2023 19:12
conduit/plugins/exporters/filewriter/README.md Outdated Show resolved Hide resolved
Comment on lines +78 to +79
genesis := initProvider.GetGenesis()
genesisPath := path.Join(exp.cfg.BlocksDir, GenesisFilename)
Copy link
Contributor

Choose a reason for hiding this comment

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

This was missing before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah

@tzaffi tzaffi merged commit 1ee2e86 into algorand:master Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants