hadoop-handler 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ """Hadoop Handler — Apache Hadoop 3.4.2 Single-Node Control Center.
2
+
3
+ Developer: Aditya Pidurkar (https://github.com/itsadityapidurkar)
4
+ Licensed under Apache License 2.0.
5
+ """
6
+
7
+ __version__ = "1.1.0"
8
+ __author__ = "Aditya Pidurkar"
hadoop_handler/cli.py ADDED
@@ -0,0 +1,133 @@
1
+ """CLI entry point for hadoop-handler.
2
+
3
+ Dispatches cross-platform to native bash on Linux/macOS or PowerShell on Windows.
4
+ """
5
+
6
+ import os
7
+ import shutil
8
+ import stat
9
+ import subprocess
10
+ import sys
11
+ from pathlib import Path
12
+
13
+ __version__ = "1.1.0"
14
+
15
+ PACKAGE_DIR = Path(__file__).resolve().parent
16
+ SCRIPTS_DIR = PACKAGE_DIR / "scripts"
17
+ CONFIGS_DIR = PACKAGE_DIR / "configs"
18
+
19
+
20
+ def print_help() -> None:
21
+ help_text = f"""Hadoop Handler v{__version__} — Single-Node Cluster Control Center
22
+ Developer: Aditya Pidurkar (https://github.com/itsadityapidurkar)
23
+
24
+ Usage:
25
+ hadoop-handler [COMMAND] [OPTIONS]
26
+
27
+ Commands:
28
+ (no args) Launch interactive TUI control panel (with arrow-key navigation)
29
+ diagnose Diagnose and repair system dependencies
30
+ install Install and configure Apache Hadoop 3.4.2
31
+ verify, status Verify Hadoop & Java installation status and daemons
32
+ start Start HDFS and YARN daemons
33
+ stop Stop HDFS and YARN daemons
34
+ restart Restart all cluster daemons
35
+ delete Remove Hadoop cluster and related directories
36
+ service <action> Manage systemd user service (enable|disable|status|start|stop)
37
+ update Check and perform in-place self-update
38
+ completion <shell> Generate autocompletion script (bash|zsh|fish|powershell)
39
+ --install-completion Automatically register autocompletion in active shell
40
+
41
+ Options:
42
+ -v, --version Show version and exit
43
+ -h, --help Show this help message and exit
44
+
45
+ Online Documentation:
46
+ https://github.com/itsadityapidurkar/hadoop-handler
47
+ """
48
+ print(help_text)
49
+
50
+
51
+ def print_version() -> None:
52
+ print(f"hadoop-handler {__version__}")
53
+
54
+
55
+ def run_unix(args: list[str]) -> int:
56
+ script_path = SCRIPTS_DIR / "hadoop-handler"
57
+ if not script_path.exists():
58
+ sys.stderr.write(f"[!] Error: Runner script not found at {script_path}\n")
59
+ return 1
60
+
61
+ # Ensure user has execute permission on the runner script
62
+ try:
63
+ current_mode = script_path.stat().st_mode
64
+ if not (current_mode & stat.S_IXUSR):
65
+ script_path.chmod(current_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
66
+ except OSError:
67
+ pass
68
+
69
+ env = os.environ.copy()
70
+ if CONFIGS_DIR.exists():
71
+ env["HADOOP_HANDLER_CONF_DIR"] = str(CONFIGS_DIR)
72
+
73
+ bash_exe = shutil.which("bash") or "/bin/bash"
74
+ cmd = [bash_exe, str(script_path)] + args
75
+
76
+ # Try os.execvpe to replace the current Python process directly with bash
77
+ try:
78
+ os.execvpe(bash_exe, cmd, env)
79
+ except (OSError, AttributeError):
80
+ try:
81
+ res = subprocess.run(cmd, env=env)
82
+ return res.returncode
83
+ except KeyboardInterrupt:
84
+ return 130
85
+
86
+
87
+ def run_windows(args: list[str]) -> int:
88
+ script_path = SCRIPTS_DIR / "install.ps1"
89
+ if not script_path.exists():
90
+ sys.stderr.write(f"[!] Error: Runner script not found at {script_path}\n")
91
+ return 1
92
+
93
+ ps_exe = shutil.which("powershell") or shutil.which("pwsh")
94
+ if not ps_exe:
95
+ sys.stderr.write("[!] Error: Neither 'powershell' nor 'pwsh' was found in PATH.\n")
96
+ return 1
97
+
98
+ cmd = [
99
+ ps_exe,
100
+ "-NoProfile",
101
+ "-ExecutionPolicy",
102
+ "Bypass",
103
+ "-File",
104
+ str(script_path),
105
+ ] + args
106
+
107
+ env = os.environ.copy()
108
+ try:
109
+ res = subprocess.run(cmd, env=env)
110
+ return res.returncode
111
+ except KeyboardInterrupt:
112
+ return 130
113
+
114
+
115
+ def main() -> int:
116
+ args = sys.argv[1:]
117
+
118
+ if args:
119
+ first_arg = args[0]
120
+ if first_arg in ("-v", "--version", "-V"):
121
+ print_version()
122
+ return 0
123
+ if first_arg in ("-h", "--help"):
124
+ print_help()
125
+ return 0
126
+
127
+ if sys.platform == "win32":
128
+ return run_windows(args)
129
+ return run_unix(args)
130
+
131
+
132
+ if __name__ == "__main__":
133
+ sys.exit(main() or 0)
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
4
+
5
+ <!--
6
+ Licensed to the Apache Software Foundation (ASF) under one
7
+ or more contributor license agreements.
8
+ -->
9
+
10
+ <configuration>
11
+
12
+ <!--
13
+ Default filesystem used by Hadoop.
14
+ Since this is a single-node cluster, the NameNode
15
+ runs on the local machine (localhost) on port 9000.
16
+ -->
17
+ <property>
18
+ <name>fs.defaultFS</name>
19
+ <value>hdfs://localhost:9000</value>
20
+ </property>
21
+
22
+ <!--
23
+ Hadoop temporary directory.
24
+ Hadoop stores metadata and temporary runtime files here.
25
+ -->
26
+ <property>
27
+ <name>hadoop.tmp.dir</name>
28
+ <value>/home/YOUR_USERNAME/hadooptmp</value>
29
+ </property>
30
+
31
+ </configuration>
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
4
+
5
+ <!--
6
+ Licensed to the Apache Software Foundation (ASF) under one
7
+ or more contributor license agreements.
8
+ -->
9
+
10
+ <configuration>
11
+
12
+ <property>
13
+ <name>dfs.replication</name>
14
+ <value>1</value>
15
+ </property>
16
+
17
+ <property>
18
+ <name>dfs.namenode.name.dir</name>
19
+ <value>file:///home/YOUR_USERNAME/hadoopdata/namenode</value>
20
+ </property>
21
+
22
+ <property>
23
+ <name>dfs.datanode.data.dir</name>
24
+ <value>file:///home/YOUR_USERNAME/hadoopdata/datanode</value>
25
+ </property>
26
+
27
+ </configuration>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
4
+
5
+ <!--
6
+ Licensed to the Apache Software Foundation (ASF) under one
7
+ or more contributor license agreements.
8
+ -->
9
+
10
+ <configuration>
11
+
12
+ <property>
13
+ <name>mapreduce.framework.name</name>
14
+ <value>yarn</value>
15
+ </property>
16
+
17
+ </configuration>
@@ -0,0 +1 @@
1
+ localhost
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
4
+
5
+ <!--
6
+ Licensed to the Apache Software Foundation (ASF) under one
7
+ or more contributor license agreements.
8
+ -->
9
+
10
+ <configuration>
11
+
12
+ <property>
13
+ <name>yarn.nodemanager.aux-services</name>
14
+ <value>mapreduce_shuffle</value>
15
+ </property>
16
+
17
+ <property>
18
+ <name>yarn.nodemanager.env-whitelist</name>
19
+ <value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value>
20
+ </property>
21
+
22
+ </configuration>