spark-history-cli 1.0.0__tar.gz

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,130 @@
1
+ Metadata-Version: 2.4
2
+ Name: spark-history-cli
3
+ Version: 1.0.0
4
+ Summary: CLI for querying the Apache Spark History Server REST API
5
+ Home-page: https://github.com/yaooqinn/spark-history-cli
6
+ Author: Apache Spark Contributors
7
+ License: Apache-2.0
8
+ Project-URL: Source, https://github.com/yaooqinn/spark-history-cli
9
+ Project-URL: Issues, https://github.com/yaooqinn/spark-history-cli/issues
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: click>=8.0.0
18
+ Requires-Dist: requests>=2.28.0
19
+ Requires-Dist: prompt-toolkit>=3.0.0
20
+ Dynamic: author
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: home-page
25
+ Dynamic: license
26
+ Dynamic: project-url
27
+ Dynamic: requires-dist
28
+ Dynamic: requires-python
29
+ Dynamic: summary
30
+
31
+ # spark-history-cli
32
+
33
+ A CLI for querying the Apache Spark History Server REST API.
34
+
35
+ ## Prerequisites
36
+
37
+ - **Python 3.10+**
38
+ - **A running Spark History Server** (default: `http://localhost:18080`)
39
+
40
+ Start the History Server:
41
+ ```bash
42
+ $SPARK_HOME/sbin/start-history-server.sh
43
+ ```
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ cd spark-history-cli
49
+ pip install -e .
50
+ ```
51
+
52
+ ## Usage
53
+
54
+ ### REPL Mode (default)
55
+
56
+ ```bash
57
+ spark-history-cli
58
+ # or specify a server:
59
+ spark-history-cli --server http://my-shs:18080
60
+ ```
61
+
62
+ ### One-Shot Commands
63
+
64
+ ```bash
65
+ # List applications
66
+ spark-history-cli apps
67
+ spark-history-cli apps --status completed --limit 10
68
+
69
+ # Application details
70
+ spark-history-cli app <app-id>
71
+
72
+ # Jobs, stages, executors (requires --app-id or 'use' in REPL)
73
+ spark-history-cli --app-id <id> jobs
74
+ spark-history-cli --app-id <id> stages
75
+ spark-history-cli --app-id <id> executors --all
76
+ spark-history-cli --app-id <id> sql
77
+ spark-history-cli --app-id <id> env
78
+
79
+ # Download event logs
80
+ spark-history-cli --app-id <id> logs output.zip
81
+
82
+ # JSON output for scripting/agents
83
+ spark-history-cli --json apps
84
+ spark-history-cli --json --app-id <id> jobs
85
+ ```
86
+
87
+ ### REPL Commands
88
+
89
+ ```
90
+ apps List applications
91
+ app <id> Show app details and set as current
92
+ use <id> Set current app context
93
+ jobs List jobs for current app
94
+ job <id> Show job details
95
+ stages List stages
96
+ stage <id> [attempt] Show stage details
97
+ executors [--all] List executors
98
+ sql [id] List or show SQL executions
99
+ rdds List cached RDDs
100
+ env Show environment/config
101
+ logs [path] Download event logs
102
+ version Show Spark version
103
+ server <url> Change server URL
104
+ status Show session state
105
+ help Show help
106
+ quit Exit
107
+ ```
108
+
109
+ ### Environment Variables
110
+
111
+ - `SPARK_HISTORY_SERVER` — Default server URL (overrides `http://localhost:18080`)
112
+
113
+ ## API Coverage
114
+
115
+ Wraps all 20 endpoints of the Spark History Server REST API (`/api/v1/`):
116
+
117
+ - Applications (list, get, attempts)
118
+ - Jobs (list, get)
119
+ - Stages (list, get, attempts, task summary, task list)
120
+ - Executors (active, all)
121
+ - SQL Executions (list, get with plan graph)
122
+ - Storage (RDD list, detail)
123
+ - Environment
124
+ - Event Logs (download as ZIP)
125
+ - Miscellaneous Processes
126
+ - Version
127
+
128
+ ## License
129
+
130
+ Apache License 2.0
@@ -0,0 +1,100 @@
1
+ # spark-history-cli
2
+
3
+ A CLI for querying the Apache Spark History Server REST API.
4
+
5
+ ## Prerequisites
6
+
7
+ - **Python 3.10+**
8
+ - **A running Spark History Server** (default: `http://localhost:18080`)
9
+
10
+ Start the History Server:
11
+ ```bash
12
+ $SPARK_HOME/sbin/start-history-server.sh
13
+ ```
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ cd spark-history-cli
19
+ pip install -e .
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ### REPL Mode (default)
25
+
26
+ ```bash
27
+ spark-history-cli
28
+ # or specify a server:
29
+ spark-history-cli --server http://my-shs:18080
30
+ ```
31
+
32
+ ### One-Shot Commands
33
+
34
+ ```bash
35
+ # List applications
36
+ spark-history-cli apps
37
+ spark-history-cli apps --status completed --limit 10
38
+
39
+ # Application details
40
+ spark-history-cli app <app-id>
41
+
42
+ # Jobs, stages, executors (requires --app-id or 'use' in REPL)
43
+ spark-history-cli --app-id <id> jobs
44
+ spark-history-cli --app-id <id> stages
45
+ spark-history-cli --app-id <id> executors --all
46
+ spark-history-cli --app-id <id> sql
47
+ spark-history-cli --app-id <id> env
48
+
49
+ # Download event logs
50
+ spark-history-cli --app-id <id> logs output.zip
51
+
52
+ # JSON output for scripting/agents
53
+ spark-history-cli --json apps
54
+ spark-history-cli --json --app-id <id> jobs
55
+ ```
56
+
57
+ ### REPL Commands
58
+
59
+ ```
60
+ apps List applications
61
+ app <id> Show app details and set as current
62
+ use <id> Set current app context
63
+ jobs List jobs for current app
64
+ job <id> Show job details
65
+ stages List stages
66
+ stage <id> [attempt] Show stage details
67
+ executors [--all] List executors
68
+ sql [id] List or show SQL executions
69
+ rdds List cached RDDs
70
+ env Show environment/config
71
+ logs [path] Download event logs
72
+ version Show Spark version
73
+ server <url> Change server URL
74
+ status Show session state
75
+ help Show help
76
+ quit Exit
77
+ ```
78
+
79
+ ### Environment Variables
80
+
81
+ - `SPARK_HISTORY_SERVER` — Default server URL (overrides `http://localhost:18080`)
82
+
83
+ ## API Coverage
84
+
85
+ Wraps all 20 endpoints of the Spark History Server REST API (`/api/v1/`):
86
+
87
+ - Applications (list, get, attempts)
88
+ - Jobs (list, get)
89
+ - Stages (list, get, attempts, task summary, task list)
90
+ - Executors (active, all)
91
+ - SQL Executions (list, get with plan graph)
92
+ - Storage (RDD list, detail)
93
+ - Environment
94
+ - Event Logs (download as ZIP)
95
+ - Miscellaneous Processes
96
+ - Version
97
+
98
+ ## License
99
+
100
+ Apache License 2.0
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,38 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="spark-history-cli",
5
+ version="1.0.0",
6
+ description="CLI for querying the Apache Spark History Server REST API",
7
+ long_description=open("README.md").read(),
8
+ long_description_content_type="text/markdown",
9
+ author="Apache Spark Contributors",
10
+ url="https://github.com/yaooqinn/spark-history-cli",
11
+ license="Apache-2.0",
12
+ project_urls={
13
+ "Source": "https://github.com/yaooqinn/spark-history-cli",
14
+ "Issues": "https://github.com/yaooqinn/spark-history-cli/issues",
15
+ },
16
+ packages=find_packages(),
17
+ package_data={
18
+ "spark_history_cli": ["skills/*.md"],
19
+ },
20
+ install_requires=[
21
+ "click>=8.0.0",
22
+ "requests>=2.28.0",
23
+ "prompt-toolkit>=3.0.0",
24
+ ],
25
+ entry_points={
26
+ "console_scripts": [
27
+ "spark-history-cli=spark_history_cli.cli:main",
28
+ ],
29
+ },
30
+ python_requires=">=3.10",
31
+ classifiers=[
32
+ "Development Status :: 4 - Beta",
33
+ "Intended Audience :: Developers",
34
+ "License :: OSI Approved :: Apache Software License",
35
+ "Programming Language :: Python :: 3",
36
+ "Topic :: Software Development :: Libraries",
37
+ ],
38
+ )
@@ -0,0 +1,3 @@
1
+ """spark-history-cli: A CLI for querying the Apache Spark History Server REST API."""
2
+
3
+ __version__ = "1.0.0"
@@ -0,0 +1,6 @@
1
+ """Allow running as: python -m spark_history_cli"""
2
+
3
+ from spark_history_cli.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()