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

feat: use the new FileSerde.writeAll and buffering for improved perf #167

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected FileTransform.Output run(RunContext runContext, String engineName) thr
);

try (
OutputStream output = new FileOutputStream(tempFile);
var output = new BufferedWriter(new FileWriter(tempFile), FileSerde.BUFFER_SIZE)
) {
if (from.startsWith("kestra://")) {
try (BufferedReader inputStream = new BufferedReader(new InputStreamReader(runContext.storage().getFile(URI.create(from))))) {
Expand Down Expand Up @@ -117,7 +117,7 @@ protected void finalize(
RunContext runContext,
Flux<Object> flowable,
ScriptEngineService.CompiledScript scripts,
OutputStream output
Writer output
) throws IOException, ScriptException {
Flux<Object> sequential;

Expand All @@ -132,9 +132,7 @@ protected void finalize(
.flatMap(this.convert(scripts));
}

Mono<Long> count = sequential
.doOnNext(throwConsumer(row -> FileSerde.write(output, row)))
.count();
Mono<Long> count = FileSerde.writeAll(output, sequential);

// metrics & finalize
Long lineCount = count.block();
Expand Down