diff --git a/src/main/java/io/kestra/plugin/gcp/runner/Batch.java b/src/main/java/io/kestra/plugin/gcp/runner/Batch.java index e07b61e0..3f5fa660 100644 --- a/src/main/java/io/kestra/plugin/gcp/runner/Batch.java +++ b/src/main/java/io/kestra/plugin/gcp/runner/Batch.java @@ -473,10 +473,12 @@ protected Map runnerAdditionalVars(RunContext runContext, TaskCo private void safelyKillJob(final RunContext runContext, final GoogleCredentials credentials, final String jobName) { + runContext.logger().info("Killing Job {}", jobName); // Use a dedicated BatchServiceClient, as the one used in the run method may be closed in the meantime. try (BatchServiceClient batchServiceClient = newBatchServiceClient(credentials)) { final Job job = batchServiceClient.getJob(jobName); if (isTerminated(job.getStatus().getState())) { + runContext.logger().debug("Job {} is already terminated. Skip deletion request.", jobName); // Job execution is already terminated, so we can skip deletion. return; } @@ -493,9 +495,8 @@ private void safelyKillJob(final RunContext runContext, } catch (InterruptedException e) { runContext.logger().warn("Interrupted while deleting Job: {}", jobName); Thread.currentThread().interrupt(); - } catch (ExecutionException | IOException e) { - Throwable t = e.getCause() != null ? e.getCause() : e; - runContext.logger().warn("Failed to delete Job: {}", jobName, t); + } catch (Exception e) { + runContext.logger().warn("Failed to delete Job: {}", jobName, e); } }