Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
Public Member Functions | |
PendingRequest (const llama::TUniqueId &reservation_id, const llama::TUniqueId &request_id, bool is_expansion) | |
Promise< bool > * | promise () |
void | GetResources (ResourceMap *resources) |
void | SetResources (const std::vector< llama::TAllocatedResource > &resources) |
const llama::TUniqueId & | request_id () const |
const llama::TUniqueId & | reservation_id () const |
bool | is_expansion () const |
Private Attributes | |
Promise< bool > | promise_ |
Promise object that WaitForNotification() waits on and AMNotification() signals. More... | |
std::vector < llama::TAllocatedResource > | allocated_resources_ |
llama::TUniqueId | reservation_id_ |
llama::TUniqueId | request_id_ |
bool | is_expansion_ |
True if this is an expansion request, false if it is a reservation request. More... | |
A PendingRequest tracks a single reservation or expansion request that is in flight to Llama. A new PendingRequest is created in either Expand() or Reserve(), and its promise() is blocked on there until a response is received for that request from Llama via AMNotification(), or until a timeout occurs. Every request has a unique request_id which is assigned by the resource broker. Each request is also associated with exactly one reservation, via reservation_id(). This allows us to track which resources belong to which reservation, and to make sure that all are correctly accounted for when the reservation is released. Each reservation ID will belong to exactly one reservation request, and 0 or more expansion requests.
Definition at line 284 of file resource-broker.h.
|
inline |
Definition at line 286 of file resource-broker.h.
void impala::ResourceBroker::PendingRequest::GetResources | ( | ResourceMap * | resources | ) |
Called by WaitForNotification() to populate a map of resources once the corresponding request has returned successfully (and promise() therefore has returned true).
Definition at line 450 of file resource-broker.cc.
References allocated_resources_, impala::MakeNetworkAddress(), reservation_id_, and VLOG_QUERY.
Referenced by impala::ResourceBroker::WaitForNotification().
|
inline |
Definition at line 310 of file resource-broker.h.
References is_expansion_.
Referenced by impala::ResourceBroker::WaitForNotification().
Promise is set to true if the reservation or expansion request was granted, false if it was rejected by Yarn. When promise()->Get() returns true, allocated_resources_ will be populated and it will be safe to call GetResources().
Definition at line 296 of file resource-broker.h.
References promise_.
Referenced by impala::ResourceBroker::WaitForNotification().
|
inline |
Definition at line 307 of file resource-broker.h.
References request_id_.
Referenced by impala::ResourceBroker::Expand(), impala::ResourceBroker::Reserve(), and impala::ResourceBroker::WaitForNotification().
|
inline |
Definition at line 308 of file resource-broker.h.
References reservation_id_.
Referenced by impala::ResourceBroker::Reserve(), and impala::ResourceBroker::WaitForNotification().
void impala::ResourceBroker::PendingRequest::SetResources | ( | const std::vector< llama::TAllocatedResource > & | resources | ) |
Populates allocated_resources_ from all members of resources that match the given reservation id. Called in AMNotification().
Definition at line 460 of file resource-broker.cc.
|
private |
Filled in by AMNotification(), so that WaitForNotification() can read the set of allocated_resources without AMNotification() having to wait (hence the copy is deliberate, since the original copy may go out of scope).
Definition at line 319 of file resource-broker.h.
Referenced by GetResources().
|
private |
True if this is an expansion request, false if it is a reservation request.
Definition at line 330 of file resource-broker.h.
Referenced by is_expansion().
Promise object that WaitForNotification() waits on and AMNotification() signals.
Definition at line 314 of file resource-broker.h.
Referenced by promise().
|
private |
The unique ID for this request. If this is a reservation request, request_id_ == reservation_id_, otherwise this is generated during Expand().
Definition at line 327 of file resource-broker.h.
Referenced by request_id().
|
private |
The ID for the reservation associated with this request. There is always exactly one reservation associated with every request.
Definition at line 323 of file resource-broker.h.
Referenced by GetResources(), and reservation_id().