-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EMR Service does not have a usable "Resource" #1189
Comments
I think part of this issue comes from the fact that the EMR API has changed as well - |
Let's work through the current state, especially since there is a forced migration from emr = Aws::EMR::Client.new(http_wire_trace: true)
emr.describe_cluster(cluster_id: "j-1foobar") The body of the {
"__type": "InvalidRequestException",
"ErrorCode": "MalformedClusterId",
"Message": "Cluster id 'j-1foobar' is not valid."
} I want to emphasize, again, that V1 of the SDK is going to have this same issue as |
Messing around, you can actually expose this error. It's not the cleanest code (and not tested in detail), but while we figure out the best way to expose this, it illustrates how you could more reliably pull out the error code from the response body: def exists?(cluster_id)
begin
emr.describe_cluster(cluster_id: cluster_id)
true
rescue Aws::EMR::Errors::InvalidRequestException => e
if JSON.parse(e.context.http_response.body_contents)["ErrorCode"] == "MalformedClusterId"
false
else
raise e
end
end
end |
Added to feature request backlog. |
Hi,
We're currently working on switching a service we have using
aws-sdk-v1
toaws-sdk (v2)
.One thing we quickly noticed is that the EMR client in v2 does not have a OO / expressive
Resource
type, forcing us to use theClient
type. This experience is much worse than v1. For example, trying to determine if a job flow existed in v1 allowed us to do something like:flow = emr.job_flows[id]
and thenflow.exists?
. In v2, we must doemr.describe_cluster({:cluster_id => id})
, which will in the "doesn't exist" case will then explode with a generic exception classAws::EMR::Errors::InvalidRequestException
with the stringCluster id 'j-[IDNUMBERHERE]' is not valid.
SinceInvalidRequestException
could mean many things, we're must then either contextually assume our flow doesn't exist, which seems like a bad idea, or string match on the exception string, which is even worse.Also, the client documentation for EMR in aws-sdk V2 is confusing or misleading. For example if we do
run_job_flow
, that will return aRunJobFlowOutput
object, which only has one method,job_flow_id
, which then returns a string.describe_cluster
however is documented as taking acluster_id
, which while we were able to eventually figure out that they are the same thing, nothing in the documentation indicated as such.The text was updated successfully, but these errors were encountered: