Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
bbaa9d7d
Commit
bbaa9d7d
authored
11 years ago
by
Matei Zaharia
Browse files
Options
Downloads
Patches
Plain Diff
Add banner to PySpark and make wordcount output nicer
parent
12495ec6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/examples/wordcount.py
+1
-1
1 addition, 1 deletion
python/examples/wordcount.py
python/pyspark/shell.py
+13
-0
13 additions, 0 deletions
python/pyspark/shell.py
with
14 additions
and
1 deletion
python/examples/wordcount.py
+
1
−
1
View file @
bbaa9d7d
...
...
@@ -32,4 +32,4 @@ if __name__ == "__main__":
.
reduceByKey
(
add
)
output
=
counts
.
collect
()
for
(
word
,
count
)
in
output
:
print
"
%s
: %i
"
%
(
word
,
count
)
print
"
%s: %i
"
%
(
word
,
count
)
This diff is collapsed.
Click to expand it.
python/pyspark/shell.py
+
13
−
0
View file @
bbaa9d7d
...
...
@@ -21,6 +21,7 @@ An interactive shell.
This file is designed to be launched as a PYTHONSTARTUP script.
"""
import
os
import
platform
import
pyspark
from
pyspark.context
import
SparkContext
...
...
@@ -28,6 +29,18 @@ from pyspark.context import SparkContext
add_files
=
os
.
environ
.
get
(
"
ADD_FILES
"
).
split
(
'
,
'
)
if
os
.
environ
.
get
(
"
ADD_FILES
"
)
!=
None
else
None
sc
=
SparkContext
(
os
.
environ
.
get
(
"
MASTER
"
,
"
local
"
),
"
PySparkShell
"
,
pyFiles
=
add_files
)
print
"""
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/
'
_/
/__ / .__/\_,_/_/ /_/\_\ version 0.8.0
/_/
"""
print
"
Using Python version %s (%s, %s)
"
%
(
platform
.
python_version
(),
platform
.
python_build
()[
0
],
platform
.
python_build
()[
1
])
print
"
Spark context avaiable as sc.
"
if
add_files
!=
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment