Build with Visual C++ (#9190)

Co-authored-by: Mehrdad <noreply@github.com>
Co-authored-by: Simon Mo <xmo@berkeley.edu>
This commit is contained in:
mehrdadn
2020-07-02 09:34:24 -07:00
committed by GitHub
co-authored by Mehrdad Simon Mo
parent bfb8a28a3c
commit 29acf272b7
16 changed files with 120 additions and 53 deletions
@@ -169,7 +169,7 @@ class MockRayletClient : public WorkerLeaseInterface {
};
TEST(TestMemoryStore, TestPromoteToPlasma) {
bool num_plasma_puts = 0;
size_t num_plasma_puts = 0;
auto mem = std::make_shared<CoreWorkerMemoryStore>(
[&](const RayObject &obj, const ObjectID &obj_id) { num_plasma_puts += 1; });
ObjectID obj1 = ObjectID::FromRandom();
+11 -8
View File
@@ -306,7 +306,7 @@ class TaskTableTestHelper {
std::shared_ptr<gcs::RedisGcsClient> client) {
// Add a table entry.
const auto task_id = RandomTaskId();
const int num_modifications = 3;
uint64_t num_modifications = 3;
const auto data = CreateTaskTableData(task_id, 0);
RAY_CHECK_OK(client->raylet_task_table().Add(job_id, task_id, data, nullptr));
@@ -318,8 +318,9 @@ class TaskTableTestHelper {
// The callback for a notification from the table. This should only be
// received for keys that we requested notifications for.
auto notification_callback = [task_id](gcs::RedisGcsClient *client, const TaskID &id,
const TaskTableData &data) {
auto notification_callback = [task_id, num_modifications](gcs::RedisGcsClient *client,
const TaskID &id,
const TaskTableData &data) {
ASSERT_EQ(id, task_id);
// Check that we only get notifications for the first and last writes,
// since notifications are canceled in between.
@@ -337,7 +338,8 @@ class TaskTableTestHelper {
// The callback for a notification from the table. This should only be
// received for keys that we requested notifications for.
auto subscribe_callback = [job_id, task_id](gcs::RedisGcsClient *client) {
auto subscribe_callback = [job_id, task_id,
num_modifications](gcs::RedisGcsClient *client) {
// Request notifications, then cancel immediately. We should receive a
// notification for the current value at the key.
RAY_CHECK_OK(client->raylet_task_table().RequestNotifications(
@@ -1330,7 +1332,7 @@ class HashTableTestHelper {
public:
static void TestHashTable(const JobID &job_id,
std::shared_ptr<gcs::RedisGcsClient> client) {
const int expected_count = 14;
uint64_t expected_count = 14;
ClientID client_id = ClientID::FromRandom();
// Prepare the first resource map: data_map1.
DynamicResourceTable::DataMap data_map1;
@@ -1368,7 +1370,7 @@ class HashTableTestHelper {
test->IncrementNumCallbacks();
};
auto notification_callback =
[data_map1, data_map2, compare_test](
[data_map1, data_map2, compare_test, expected_count](
RedisGcsClient *client, const ClientID &id,
const std::vector<ResourceChangeNotification> &result) {
RAY_CHECK(result.size() == 1);
@@ -1464,8 +1466,9 @@ class HashTableTestHelper {
// Step 4: Removing all elements will remove the home Hash table from GCS.
RAY_CHECK_OK(client->resource_table().RemoveEntries(
job_id, client_id, {"GPU", "CPU", "CUSTOM", "None-Existent"}, nullptr));
auto lookup_callback5 = [](RedisGcsClient *client, const ClientID &id,
const DynamicResourceTable::DataMap &callback_data) {
auto lookup_callback5 = [expected_count](
RedisGcsClient *client, const ClientID &id,
const DynamicResourceTable::DataMap &callback_data) {
ASSERT_EQ(callback_data.size(), 0);
test->IncrementNumCallbacks();
// It is not sure which of notification or lookup callback will come first.
+12 -12
View File
@@ -52,18 +52,18 @@ void MetricExporter::ExportToPoints(
}
}
hist_mean /= view_data.size();
MetricPoint mean_point{.metric_name = metric_name + ".mean",
.timestamp = current_sys_time_ms(),
.value = hist_mean,
.tags = tags};
MetricPoint max_point{.metric_name = metric_name + ".max",
.timestamp = current_sys_time_ms(),
.value = hist_max,
.tags = tags};
MetricPoint min_point{.metric_name = metric_name + ".min",
.timestamp = current_sys_time_ms(),
.value = hist_min,
.tags = tags};
MetricPoint mean_point = {metric_name + ".mean",
current_sys_time_ms(),
hist_mean,
tags};
MetricPoint max_point = {metric_name + ".max",
current_sys_time_ms(),
hist_max,
tags};
MetricPoint min_point = {metric_name + ".min",
current_sys_time_ms(),
hist_min,
tags};
points.push_back(std::move(mean_point));
points.push_back(std::move(max_point));
points.push_back(std::move(min_point));
+4 -4
View File
@@ -63,10 +63,10 @@ class MetricExporter final : public opencensus::stats::StatsExporter::Handler {
tags[keys[i]] = row.first[i];
}
// Current timestamp is used for point not view data time.
MetricPoint point{.metric_name = metric_name,
.timestamp = current_sys_time_ms(),
.value = static_cast<double>(row.second),
.tags = tags};
MetricPoint point{metric_name,
current_sys_time_ms(),
static_cast<double>(row.second),
tags};
RAY_LOG(DEBUG) << "Metric name " << metric_name << ", value " << point.value;
points.push_back(std::move(point));
if (points.size() >= report_batch_size_) {
+7
View File
@@ -26,7 +26,14 @@
#ifdef RAY_USE_GLOG
#include <sys/stat.h>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4722) // Ignore non-returning destructor warning in GLOG
#endif
#include "glog/logging.h"
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
#include "ray/util/filesystem.h"
+1 -1
View File
@@ -48,7 +48,7 @@ TEST(UtilTest, ParseCommandLineTest) {
ASSERT_EQ(ParseCommandLine(R"(\" )", syn), ArgList({R"(")"}));
ASSERT_EQ(ParseCommandLine(R"(" a")", syn), ArgList({R"( a)"}));
ASSERT_EQ(ParseCommandLine(R"("\\")", syn), ArgList({R"(\)"}));
ASSERT_EQ(ParseCommandLine(R"("\"")", syn), ArgList({R"(")"}));
ASSERT_EQ(ParseCommandLine(/*R"("\"")"*/ "\"\\\"\"", syn), ArgList({R"(")"}));
ASSERT_EQ(ParseCommandLine(R"(a" b c"d )", syn), ArgList({R"(a b cd)"}));
ASSERT_EQ(ParseCommandLine(R"(\"a b)", syn), ArgList({R"("a)", R"(b)"}));
ASSERT_EQ(ParseCommandLine(R"(| ! ^ # [)", syn), ArgList({"|", "!", "^", "#", "["}));
+1 -1
View File
@@ -35,7 +35,7 @@ pid_t getppid() {
ULONG cb = sizeof(info);
NTSTATUS status = NtQueryInformationProcess(GetCurrentProcess(), 0, &info, cb, &cb);
if ((status >= 0 || status == STATUS_BUFFER_OVERFLOW) && cb >= sizeof(info)) {
ppid = reinterpret_cast<DWORD>(info.Reserved3);
ppid = static_cast<DWORD>(reinterpret_cast<uintptr_t>(info.Reserved3));
}
pid_t result = 0;
if (ppid > 0) {