This is an automated email from the ASF dual-hosted git repository.

arjun4084346 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gobblin.git


The following commit(s) were added to refs/heads/master by this push:
     new cb36e2c8a Log when `PasswordManager` fails to load any master password 
(#3849)
cb36e2c8a is described below

commit cb36e2c8a3b24b11aabc43682969f0d44d392e7d
Author: Kip Kohn <[email protected]>
AuthorDate: Fri Dec 15 11:28:38 2023 -0800

    Log when `PasswordManager` fails to load any master password (#3849)
---
 .../org/apache/gobblin/password/PasswordManager.java     | 16 +++++++++++-----
 .../service/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 7c62f1b37..85b81d2ea 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 @@ public class PasswordManager {
       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 @@ public class PasswordManager {
         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 c69aa0210..3b422c55b 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 @@ public class DagManager extends AbstractIdleService {
         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,

Reply via email to