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
db503797
Commit
db503797
authored
11 years ago
by
Patrick Wendell
Browse files
Options
Downloads
Patches
Plain Diff
Decoupling spark version from ami
parent
a07bd286
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ec2/spark_ec2.py
+16
-7
16 additions, 7 deletions
ec2/spark_ec2.py
with
16 additions
and
7 deletions
ec2/spark_ec2.py
+
16
−
7
View file @
db503797
...
...
@@ -36,7 +36,7 @@ from boto import ec2
# A URL prefix from which to fetch AMI information
AMI_PREFIX
=
"
https://raw.github.com/pwendell/spark-ec2/ec2-updates/ami-list
"
LATEST_SPARK_VERSION
=
"
0.7.2
"
# Configure and parse our command-line arguments
def
parse_args
():
...
...
@@ -67,6 +67,8 @@ def parse_args():
parser
.
add_option
(
"
-a
"
,
"
--ami
"
,
default
=
"
latest
"
,
help
=
"
Amazon Machine Image ID to use,
'
vX.Y.Z
'
to use version
"
+
"
X.Y.Z of Spark, or
'
latest
'
to use latest AMI (default: latest)
"
)
parser
.
add_option
(
"
-v
"
,
"
--spark-version
"
,
default
=
"
latest
"
,
help
=
"
Version of Spark to use (X.Y.Z or
'
latest
'
to use most recent)
"
)
parser
.
add_option
(
"
-D
"
,
metavar
=
"
[ADDRESS:]PORT
"
,
dest
=
"
proxy_port
"
,
help
=
"
Use SSH dynamic port forwarding to create a SOCKS proxy at
"
+
"
the given local address (for use with login)
"
)
...
...
@@ -156,6 +158,16 @@ def wait_for_instances(conn, instances):
def
is_active
(
instance
):
return
(
instance
.
state
in
[
'
pending
'
,
'
running
'
,
'
stopping
'
,
'
stopped
'
])
# Return correct versions of Spark and Shark, given the supplied spark version
def
get_spark_shark_version
(
opts
):
spark_shark_map
=
[
"
0.7.2
"
,
"
0.7.0
"
]
version
=
opts
.
spark_version
.
replace
(
"
v
"
,
""
)
if
version
not
in
[
"
latest
"
,
"
0.7.2
"
]:
print
>>
stderr
,
"
Don
'
t know about spark version: %s
"
%
version
if
version
==
"
latest
"
:
version
=
LATEST_SPARK_VERSION
return
(
version
,
spark_shark_map
[
version
])
# Attempt to resolve an appropriate AMI given the architecture and
# region of the request.
def
get_spark_ami
(
opts
):
...
...
@@ -187,11 +199,7 @@ def get_spark_ami(opts):
print
>>
stderr
,
\
"
Don
'
t recognize %s, assuming type is pvm
"
%
opts
.
instance_type
version
=
version
.
replace
(
"
v
"
,
""
)
if
version
not
in
[
"
latest
"
,
"
0.7.0
"
]:
print
>>
stderr
,
\
"
Don
'
t know how to resolve AMI for version: %s
"
%
version
ami_path
=
"
%s/%s/%s/%s
"
%
(
AMI_PREFIX
,
version
,
opts
.
region
,
instance_type
)
ami_path
=
"
%s/%s/%s
"
%
(
AMI_PREFIX
,
opts
.
region
,
instance_type
)
try
:
ami
=
urllib2
.
urlopen
(
ami_path
).
read
().
strip
()
print
"
Spark AMI:
"
+
ami
...
...
@@ -452,8 +460,9 @@ def setup_standalone_cluster(master, slave_nodes, opts):
ssh
(
master
,
opts
,
"
/root/spark/bin/start-all.sh
"
)
def
setup_spark_cluster
(
master
,
opts
):
(
spark_v
,
shark_v
)
=
get_spark_shark_version
(
opts
)
ssh
(
master
,
opts
,
"
chmod u+x spark-ec2/setup.sh
"
)
ssh
(
master
,
opts
,
"
spark-ec2/setup.sh
"
)
ssh
(
master
,
opts
,
"
spark-ec2/setup.sh
%s %s
"
%
(
spark_v
,
shark_v
))
)
if
opts
.
cluster_type
==
"
mesos
"
:
print
"
Mesos cluster started at http://%s:8080
"
%
master
elif
opts
.
cluster_type
==
"
standalone
"
:
...
...
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