Hean-Chhinling commented on code in PR #8742:
URL: https://github.com/apache/hadoop/pull/8742#discussion_r4103143395


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/resources/diagnostics/diagnostics_collector.py:
##########
@@ -0,0 +1,358 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import argparse
+import logging
+import os
+import re
+import socket
+import subprocess
+import sys
+import time
+import xml.etree.ElementTree as ET
+from datetime import datetime, timedelta
+from typing import List, Optional, Tuple
+
+logger = logging.getLogger(__name__)
+
+_TEMP_DIR = "/tmp"
+_HADOOP_CONF_DIR: Optional[str] = None
+_YARN_SITE_XML = "yarn-site.xml"
+_RM_WEBAPP_HTTPS_ADDRESS_KEY = "yarn.resourcemanager.webapp.https.address"
+_RM_WEBAPP_HTTP_ADDRESS_KEY = "yarn.resourcemanager.webapp.address"
+_RM_ADDRESS: Optional[str] = None
+_NODE_SCHEME = "http"
+
+_RM_LOG_REGEX = r"(?<=\")\/logs.+?RESOURCEMANAGER.+?(?=\")"
+_NM_LOG_REGEX = r"(?<=\")\/logs.+?NODEMANAGER.+?(?=\")"
+_INPUT_TIME_FORMAT = '%a %b %d %H:%M:%S %Z %Y'  # e.g. Wed May 28 07:35:39 UTC 
2025
+_OUTPUT_TIME_FORMAT = '%Y-%m-%d %H:%M:%S,%f'    # e.g. 2025-05-28 11:57:05,435
+_OUTPUT_TIME_FORMAT_WITHOUT_SECOND = '%Y-%m-%d %H:%M'  # e.g. 2025-05-28 11:57
+_NUMBER_OF_JSTACK = 3
+
+args = None
+
+
+def list_issues() -> None:
+    print("application_diagnostic:appId", "scheduler_related_issue", sep="\n")
+
+
+def application_diagnostic() -> str:
+    """
+    Application Logs, Application Info, Application Attempts
+    Multiple JStack of Hanging Containers and NodeManager
+    ResourceManager logs during job duration.
+    NodeManager logs from NodeManager where hanging containers of jobs run 
during the duration of containers.
+    """
+    if args.arguments is None or len(args.arguments) == 0:
+        logger.error("Missing application or job id")
+        sys.exit(os.EX_USAGE)
+
+    app_id = args.arguments[0]
+    logger.info("Collecting application diagnostics for %s", app_id)
+    output_path = _create_output_dir(os.path.join(_TEMP_DIR, app_id))
+
+    nm_address = _get_nodemanager_address(app_id)

Review Comment:
   Very good idea, I have not really thought about this case.
   I will do that in my next commit :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to