mirror of
https://github.com/wassname/ray.git
synced 2026-09-11 12:43:20 +08:00
Treat actor creation like a regular task. (#1668)
* Treat actor creation like a regular task. * Small cleanups. * Change semantics of actor resource handling. * Bug fix. * Minor linting * Bug fix * Fix jenkins test. * Fix actor tests * Some cleanups * Bug fix * Fix bug. * Remove cached actor tasks when a driver is removed. * Add more info to taskspec in global state API. * Fix cyclic import bug in tune. * Fix * Fix linting. * Fix linting. * Don't schedule any tasks (especially actor creaiton tasks) on local schedulers with 0 CPUs. * Bug fix. * Add test for 0 CPU case * Fix linting * Address comments. * Fix typos and add comment. * Add assertion and fix test.
This commit is contained in:
committed by
Stephanie Wang
parent
3c080f4baa
commit
96913be939
@@ -14,8 +14,8 @@ static inline TaskExecutionSpec example_task_execution_spec_with_args(
|
||||
TaskID parent_task_id = TaskID::from_random();
|
||||
FunctionID func_id = FunctionID::from_random();
|
||||
TaskSpec_start_construct(g_task_builder, UniqueID::nil(), parent_task_id, 0,
|
||||
ActorID::nil(), ActorID::nil(), 0, false, func_id,
|
||||
num_returns);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, func_id, num_returns);
|
||||
for (int64_t i = 0; i < num_args; ++i) {
|
||||
ObjectID arg_id;
|
||||
if (arg_ids == NULL) {
|
||||
|
||||
@@ -16,8 +16,8 @@ TEST task_test(void) {
|
||||
FunctionID func_id = FunctionID::from_random();
|
||||
TaskBuilder *builder = make_task_builder();
|
||||
TaskSpec_start_construct(builder, DriverID::nil(), parent_task_id, 0,
|
||||
ActorID::nil(), ActorID::nil(), 0, false, func_id,
|
||||
2);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, func_id, 2);
|
||||
|
||||
UniqueID arg1 = UniqueID::from_random();
|
||||
TaskSpec_args_add_ref(builder, &arg1, 1);
|
||||
@@ -56,8 +56,8 @@ TEST deterministic_ids_test(void) {
|
||||
|
||||
/* Construct a first task. */
|
||||
TaskSpec_start_construct(builder, DriverID::nil(), parent_task_id, 0,
|
||||
ActorID::nil(), ActorID::nil(), 0, false, func_id,
|
||||
3);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, func_id, 3);
|
||||
TaskSpec_args_add_ref(builder, &arg1, 1);
|
||||
TaskSpec_args_add_val(builder, arg2, 11);
|
||||
int64_t size1;
|
||||
@@ -65,8 +65,8 @@ TEST deterministic_ids_test(void) {
|
||||
|
||||
/* Construct a second identical task. */
|
||||
TaskSpec_start_construct(builder, DriverID::nil(), parent_task_id, 0,
|
||||
ActorID::nil(), ActorID::nil(), 0, false, func_id,
|
||||
3);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, func_id, 3);
|
||||
TaskSpec_args_add_ref(builder, &arg1, 1);
|
||||
TaskSpec_args_add_val(builder, arg2, 11);
|
||||
int64_t size2;
|
||||
@@ -86,8 +86,8 @@ TEST deterministic_ids_test(void) {
|
||||
|
||||
/* Construct a task with a different parent task ID. */
|
||||
TaskSpec_start_construct(builder, DriverID::nil(), TaskID::from_random(), 0,
|
||||
ActorID::nil(), ActorID::nil(), 0, false, func_id,
|
||||
3);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, func_id, 3);
|
||||
TaskSpec_args_add_ref(builder, &arg1, 1);
|
||||
TaskSpec_args_add_val(builder, arg2, 11);
|
||||
int64_t size3;
|
||||
@@ -95,8 +95,8 @@ TEST deterministic_ids_test(void) {
|
||||
|
||||
/* Construct a task with a different parent counter. */
|
||||
TaskSpec_start_construct(builder, DriverID::nil(), parent_task_id, 1,
|
||||
ActorID::nil(), ActorID::nil(), 0, false, func_id,
|
||||
3);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, func_id, 3);
|
||||
TaskSpec_args_add_ref(builder, &arg1, 1);
|
||||
TaskSpec_args_add_val(builder, arg2, 11);
|
||||
int64_t size4;
|
||||
@@ -104,8 +104,9 @@ TEST deterministic_ids_test(void) {
|
||||
|
||||
/* Construct a task with a different function ID. */
|
||||
TaskSpec_start_construct(builder, DriverID::nil(), parent_task_id, 0,
|
||||
ActorID::nil(), ActorID::nil(), 0, false,
|
||||
FunctionID::from_random(), 3);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, FunctionID::from_random(),
|
||||
3);
|
||||
TaskSpec_args_add_ref(builder, &arg1, 1);
|
||||
TaskSpec_args_add_val(builder, arg2, 11);
|
||||
int64_t size5;
|
||||
@@ -113,8 +114,8 @@ TEST deterministic_ids_test(void) {
|
||||
|
||||
/* Construct a task with a different object ID argument. */
|
||||
TaskSpec_start_construct(builder, DriverID::nil(), parent_task_id, 0,
|
||||
ActorID::nil(), ActorID::nil(), 0, false, func_id,
|
||||
3);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, func_id, 3);
|
||||
ObjectID object_id = ObjectID::from_random();
|
||||
TaskSpec_args_add_ref(builder, &object_id, 1);
|
||||
TaskSpec_args_add_val(builder, arg2, 11);
|
||||
@@ -123,8 +124,8 @@ TEST deterministic_ids_test(void) {
|
||||
|
||||
/* Construct a task with a different value argument. */
|
||||
TaskSpec_start_construct(builder, DriverID::nil(), parent_task_id, 0,
|
||||
ActorID::nil(), ActorID::nil(), 0, false, func_id,
|
||||
3);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, func_id, 3);
|
||||
TaskSpec_args_add_ref(builder, &arg1, 1);
|
||||
TaskSpec_args_add_val(builder, (uint8_t *) "hello_world", 11);
|
||||
int64_t size7;
|
||||
@@ -168,8 +169,8 @@ TEST send_task(void) {
|
||||
TaskID parent_task_id = TaskID::from_random();
|
||||
FunctionID func_id = FunctionID::from_random();
|
||||
TaskSpec_start_construct(builder, DriverID::nil(), parent_task_id, 0,
|
||||
ActorID::nil(), ActorID::nil(), 0, false, func_id,
|
||||
2);
|
||||
ActorID::nil(), ObjectID::nil(), ActorID::nil(),
|
||||
ActorID::nil(), 0, false, func_id, 2);
|
||||
ObjectID object_id = ObjectID::from_random();
|
||||
TaskSpec_args_add_ref(builder, &object_id, 1);
|
||||
TaskSpec_args_add_val(builder, (uint8_t *) "Hello", 5);
|
||||
|
||||
Reference in New Issue
Block a user