-
Notifications
You must be signed in to change notification settings - Fork 207
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
Refactor PipelinesDataFlowModelParser to take in an InputStream instead of a file path #4289
Refactor PipelinesDataFlowModelParser to take in an InputStream instead of a file path #4289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change looks good to me. Question -- What is the motivation for this change?
The motivation is to make this library extendible to support non-files, such as raw strings of the pipeline config |
…ad of a file path Signed-off-by: Taylor Gray <[email protected]>
c26a944
to
c1e0559
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very nice improvement to this code. Thanks!
I do have one comment about exceptions that we should resolve.
|
||
if (configurationLocation.isFile()) { | ||
return Stream.of(configurationLocation).map(this::getInputStreamForFile) | ||
.filter(Objects::nonNull).collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, I think we should throw an exception since we are looking for a single file.
try { | ||
return new FileInputStream(pipelineConfigurationFile); | ||
} catch (IOException e) { | ||
LOG.warn("Pipeline configuration file {} not found", pipelineConfigurationFile.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include the exception message here and remove the "not found" part. This could happen if you don't have read permissions on the file.
Signed-off-by: Taylor Gray <[email protected]>
Description
This change refactors the
PipelinesDataFlowModelParser
to not be dependent on files, but to be dependent onInputStreams
.This is done with
PipelineConfigurationReader
that is passed to thePipelinesDataFlowModelParser
.PipelineConfigurationFileReader
that is created via dependency injection, and contains the former chunk s ofPipelinesDataFlowModelParser
that was relevant to reading the filesCheck List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.