MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CreateHttpRequest

Method CreateHttpRequest

tensorflow/core/platform/cloud/gcs_file_system.cc:1758–1788  ·  view source on GitHub ↗

Creates an HttpRequest and sets several parameters that are common to all requests. All code (in GcsFileSystem) that creates an HttpRequest should go through this method, rather than directly using http_request_factory_.

Source from the content-addressed store, hash-verified

1756// requests. All code (in GcsFileSystem) that creates an HttpRequest should
1757// go through this method, rather than directly using http_request_factory_.
1758Status GcsFileSystem::CreateHttpRequest(std::unique_ptr<HttpRequest>* request) {
1759 std::unique_ptr<HttpRequest> new_request{http_request_factory_->Create()};
1760 if (dns_cache_) {
1761 dns_cache_->AnnotateRequest(new_request.get());
1762 }
1763
1764 string auth_token;
1765 {
1766 tf_shared_lock l(mu_);
1767 TF_RETURN_IF_ERROR(
1768 AuthProvider::GetToken(auth_provider_.get(), &auth_token));
1769 }
1770
1771 new_request->AddAuthBearerHeader(auth_token);
1772
1773 if (additional_header_) {
1774 new_request->AddHeader(additional_header_->first,
1775 additional_header_->second);
1776 }
1777
1778 if (stats_ != nullptr) {
1779 new_request->SetRequestStats(stats_->HttpStats());
1780 }
1781
1782 if (!throttle_.AdmitRequest()) {
1783 return errors::Unavailable("Request throttled");
1784 }
1785
1786 *request = std::move(new_request);
1787 return Status::OK();
1788}
1789
1790} // namespace tensorflow
1791

Callers 4

UploadToSessionMethod · 0.80
TESTFunction · 0.80

Calls 9

UnavailableFunction · 0.85
AnnotateRequestMethod · 0.80
HttpStatsMethod · 0.80
AdmitRequestMethod · 0.80
CreateMethod · 0.45
getMethod · 0.45
AddAuthBearerHeaderMethod · 0.45
AddHeaderMethod · 0.45
SetRequestStatsMethod · 0.45

Tested by 1

TESTFunction · 0.64