From 2cf84dfc3730922d048358274ed6105965d082d2 Mon Sep 17 00:00:00 2001 From: Kip Kohn Date: Thu, 14 Dec 2023 17:48:01 -0800 Subject: [PATCH] Log when `PasswordManager` fails to load any master password --- .../apache/gobblin/password/PasswordManager.java | 16 +++++++++++----- .../modules/orchestration/DagManager.java | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gobblin-api/src/main/java/org/apache/gobblin/password/PasswordManager.java b/gobblin-api/src/main/java/org/apache/gobblin/password/PasswordManager.java index 7c62f1b37d3..85b81d2ea45 100644 --- a/gobblin-api/src/main/java/org/apache/gobblin/password/PasswordManager.java +++ b/gobblin-api/src/main/java/org/apache/gobblin/password/PasswordManager.java @@ -113,6 +113,7 @@ private List getEncryptors(CachedInstanceKey cacheKey) { try (Closer closer = Closer.create()) { if (!fs.exists(currentMasterPasswordFile) || fs.getFileStatus(currentMasterPasswordFile).isDirectory()) { + LOG.warn("Master password path '" + currentMasterPasswordFile + "' not a FileSystem file."); continue; } InputStream in = closer.register(fs.open(currentMasterPasswordFile)); @@ -124,18 +125,23 @@ private List getEncryptors(CachedInstanceKey cacheKey) { suffix = "." + String.valueOf(i); } catch (FileNotFoundException fnf) { // It is ok for password files not being present - LOG.warn("Master password file " + currentMasterPasswordFile + " not found."); + LOG.warn("Master password file '" + currentMasterPasswordFile + "' not found."); } catch (IOException ioe) { exception = ioe; - LOG.warn("Master password could not be read from file " + currentMasterPasswordFile); + LOG.warn("Master password file could not be read from '" + currentMasterPasswordFile + "'"); } catch (Exception e) { - LOG.warn("Encryptor could not be instantiated."); + LOG.warn("Encryptor could not be instantiated using file '" + currentMasterPasswordFile + "'.", e); } } while (i++ < numOfEncryptionKeys); // Throw exception if could not read any existing password file - if (encryptors.size() < 1 && exception != null) { - throw new RuntimeException("Master Password could not be read from any master password file.", exception); + if (encryptors.size() < 1) { + if (exception != null) { + throw new RuntimeException("Master password could not be read from any master password file.", exception); + } else { + // TODO: determine whether to always throw whenever no encryptors, despite `exception == null`! (for now, at least give notice by logging) + LOG.error("No master password loaded, despite " + numOfEncryptionKeys + " encryption keys!"); + } } return encryptors; } diff --git a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java index c69aa0210bc..3b422c55bf6 100644 --- a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java +++ b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/DagManager.java @@ -720,6 +720,8 @@ private void cancelDagNode(DagNode dagNodeToCancel) throws Exe String serializedFuture = DagManagerUtils.getSpecProducer(dagNodeToCancel).serializeAddSpecResponse(future); props.put(ConfigurationKeys.SPEC_PRODUCER_SERIALIZED_FUTURE, serializedFuture); sendCancellationEvent(dagNodeToCancel.getValue()); + } else { + log.warn("No Job future when canceling DAG node (hence, not sending cancellation event) - {}", dagNodeToCancel.getValue().getJobSpec().getUri()); } if (dagNodeToCancel.getValue().getJobSpec().getConfig().hasPath(ConfigurationKeys.FLOW_EXECUTION_ID_KEY)) { props.setProperty(ConfigurationKeys.FLOW_EXECUTION_ID_KEY,