Github user meawoppl commented on a diff in the pull request:
https://github.com/apache/spark/pull/6336#discussion_r30908913
--- Diff: ec2/spark_ec2.py ---
@@ -423,13 +426,14 @@ def get_spark_ami(opts):
b=opts.spark_ec2_git_branch)
ami_path = "%s/%s/%s" % (ami_prefix, opts.region, instance_type)
+ reader = codecs.getreader("ascii")
try:
- ami = urlopen(ami_path).read().strip()
- print("Spark AMI: " + ami)
+ ami = reader(urlopen(ami_path)).read().strip()
--- End diff --
This is a little bit cleaner, as the codec reader can be passed a string or
bytes. Otherwise introducing the .decode() will bork py2's urlopen which
returns a string. The new streaming operators are a bit faster generally, but
in this case the total bytestream is like 10 characters, so it probably dosen't
matter.
This was the hardest to figure out as the blanket try-except made this look
like a network issue or similar.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]