mirror of
https://github.com/wassname/ray.git
synced 2026-08-09 12:20:09 +08:00
Convert task_spec to flatbuffers (#255)
* convert Ray to C++ * convert task_spec to flatbuffers * fix * it compiles * latest * tests are passing * task2 -> task * fix * fix * fix * fix * fix * linting * fix valgrind * upgrade flatbuffers * use debug mode for valgrind * fix naming and comments * downgrade flatbuffers * fix linting * reintroduce TaskSpec_free * rename TaskSpec -> TaskInfo * refactoring * linting
This commit is contained in:
committed by
Robert Nishihara
parent
65a8659f3d
commit
0b8d279ef2
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "event_loop.h"
|
||||
#include "test_common.h"
|
||||
#include "example_task.h"
|
||||
#include "state/db.h"
|
||||
#include "state/object_table.h"
|
||||
#include "state/task_table.h"
|
||||
@@ -16,6 +17,8 @@
|
||||
|
||||
SUITE(db_tests);
|
||||
|
||||
TaskBuilder *g_task_builder = NULL;
|
||||
|
||||
/* Retry 10 times with an 100ms timeout. */
|
||||
const int NUM_RETRIES = 10;
|
||||
const uint64_t TIMEOUT = 50;
|
||||
@@ -149,10 +152,11 @@ TEST task_table_test(void) {
|
||||
db_connect("127.0.0.1", 6379, "local_scheduler", "127.0.0.1", 0, NULL);
|
||||
db_attach(db, loop, false);
|
||||
DBClientID local_scheduler_id = globally_unique_id();
|
||||
task_spec *spec = example_task_spec(1, 1);
|
||||
task_table_test_task =
|
||||
Task_alloc(spec, TASK_STATUS_SCHEDULED, local_scheduler_id);
|
||||
free_task_spec(spec);
|
||||
int64_t task_spec_size;
|
||||
TaskSpec *spec = example_task_spec(1, 1, &task_spec_size);
|
||||
task_table_test_task = Task_alloc(spec, task_spec_size, TASK_STATUS_SCHEDULED,
|
||||
local_scheduler_id);
|
||||
TaskSpec_free(spec);
|
||||
RetryInfo retry = {
|
||||
.num_retries = NUM_RETRIES,
|
||||
.timeout = TIMEOUT,
|
||||
@@ -183,10 +187,13 @@ TEST task_table_all_test(void) {
|
||||
DBHandle *db =
|
||||
db_connect("127.0.0.1", 6379, "local_scheduler", "127.0.0.1", 0, NULL);
|
||||
db_attach(db, loop, false);
|
||||
task_spec *spec = example_task_spec(1, 1);
|
||||
int64_t task_spec_size;
|
||||
TaskSpec *spec = example_task_spec(1, 1, &task_spec_size);
|
||||
/* Schedule two tasks on different local local schedulers. */
|
||||
Task *task1 = Task_alloc(spec, TASK_STATUS_SCHEDULED, globally_unique_id());
|
||||
Task *task2 = Task_alloc(spec, TASK_STATUS_SCHEDULED, globally_unique_id());
|
||||
Task *task1 = Task_alloc(spec, task_spec_size, TASK_STATUS_SCHEDULED,
|
||||
globally_unique_id());
|
||||
Task *task2 = Task_alloc(spec, task_spec_size, TASK_STATUS_SCHEDULED,
|
||||
globally_unique_id());
|
||||
RetryInfo retry = {
|
||||
.num_retries = NUM_RETRIES, .timeout = TIMEOUT, .fail_callback = NULL,
|
||||
};
|
||||
@@ -201,7 +208,7 @@ TEST task_table_all_test(void) {
|
||||
event_loop_add_timer(loop, 200, (event_loop_timer_handler) timeout_handler,
|
||||
NULL);
|
||||
event_loop_run(loop);
|
||||
free_task_spec(spec);
|
||||
TaskSpec_free(spec);
|
||||
db_disconnect(db);
|
||||
destroy_outstanding_callbacks(loop);
|
||||
event_loop_destroy(loop);
|
||||
@@ -237,6 +244,7 @@ SUITE(db_tests) {
|
||||
GREATEST_MAIN_DEFS();
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
g_task_builder = make_task_builder();
|
||||
GREATEST_MAIN_BEGIN();
|
||||
RUN_SUITE(db_tests);
|
||||
GREATEST_MAIN_END();
|
||||
|
||||
Reference in New Issue
Block a user