Skip to content

Commit

Permalink
adjusted comment and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Abacn committed Oct 8, 2024
1 parent 1fdd4b8 commit 413ffe9
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,10 @@ public BeamFnApi.InstructionResponse.Builder processBundle(BeamFnApi.Instruction
return BeamFnApi.InstructionResponse.newBuilder().setProcessBundle(response);
} catch (Exception e) {
// Make sure we clean up from the active set of bundle processors.
LOG.debug(
"Discard bundleProcessor for {} after exception: {}",
request.getProcessBundle().getProcessBundleDescriptorId(),
e.getMessage());
bundleProcessorCache.discard(bundleProcessor);
throw e;
}
Expand Down Expand Up @@ -1168,16 +1172,15 @@ void discard() {
if (this.bundleCache != null) {
this.bundleCache.clear();
}
// setupFunction called in createBundleProcessor when BundleProcessorCache.get returns null.
// call teardownFunction here as the BundleProcessor is already removed from cache and isn't
// going to be re-used.
// setupFunctions are invoked in createBundleProcessor. Invoke teardownFunction here as the
// BundleProcessor is already removed from cache and won't be re-used.
for (ThrowingRunnable teardownFunction : Lists.reverse(this.getTearDownFunctions())) {
try {
teardownFunction.run();
} catch (Throwable e) {
LOG.error(
"Exceptions are thrown from DoFn.teardown method. Note that it will not fail the"
+ " pipeline execution,",
LOG.warn(
"Exceptions are thrown from DoFn.teardown method when trying to discard "
+ "ProcessBundleHandler",
e);
}
}
Expand Down

0 comments on commit 413ffe9

Please sign in to comment.