-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathremote_process_impl.cc
48 lines (37 loc) · 1.58 KB
/
remote_process_impl.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "source/client/remote_process_impl.h"
#include <grpc++/grpc++.h>
#include <memory>
#include "nighthawk/client/output_collector.h"
#include "api/client/options.pb.h"
#include "api/client/output.pb.h"
#include "source/client/options_impl.h"
#include "source/common/nighthawk_service_client_impl.h"
#include "source/common/uri_impl.h"
namespace Nighthawk {
namespace Client {
RemoteProcessImpl::RemoteProcessImpl(const Options& options,
nighthawk::client::NighthawkService::Stub& stub)
: options_(options), service_client_(std::make_unique<NighthawkServiceClientImpl>()),
stub_(stub) {}
bool RemoteProcessImpl::run(OutputCollector& collector) {
Nighthawk::Client::CommandLineOptionsPtr options = options_.toCommandLineOptions();
// We don't forward the option that requests remote execution. Today,
// nighthawk_service will ignore the option, but if someone ever changes that this
// is probably desireable.
options->mutable_nighthawk_service()->Clear();
const absl::StatusOr<const nighthawk::client::ExecutionResponse> result =
service_client_->PerformNighthawkBenchmark(&stub_, *options);
if (result.ok()) {
collector.setOutput(result.value().output());
return true;
}
ENVOY_LOG(error, "Remote execution failure: {}", result.status().message());
return false;
}
bool RemoteProcessImpl::requestExecutionCancellation() {
ENVOY_LOG(error, "Remote process cancellation not supported yet");
// TODO(#380): Send a cancel request to the gRPC service.
return false;
}
} // namespace Client
} // namespace Nighthawk