syntax = "proto3"; package task; enum TaskType { // Execute normal code NORMAL_CODE = 0; } /// Language of the code enum Language { PYTHON = 0; NODEJS = 1; SHELL = 2; } enum TaskState { TASK_PENDING = 0; TASK_RUNNING = 1; TASK_SUCCEEDED = 2; TASK_FAILED = 3; } enum TaskExecuteMode { // Execute code in local LOCAL = 0; // Execute code in docker DOCKER = 1; } // Driver is the master node service DriverRpc { rpc RegisterWorker (RegisterWorkerRequest) returns (RegisterWorkerReply); // Task state change message rpc TaskStateChange (TaskStateRequest) returns (TaskStateReply); } // Send request to worker service WorkerRpc { rpc StopWorker (StopWorkerRequest) returns (StopWorkerReply); // Submit task to worker, wait for the task to complete rpc SubmitTask (TaskInfo) returns (TaskStateInfo); } message NormalCode { Language language = 2; string code = 1; } message SerializingData { bytes data = 1; } message TaskDetail { oneof task_detail { NormalCode normal_code = 1; SerializingData serializing_data = 2; } } // TaskInfo is the task information message TaskInfo { TaskType task_type = 1; string name = 2; Language language = 3; bytes task_id = 4; TaskDetail detail = 5; TaskExecuteMode execute_mode = 6; // Unique id of the environment string env_id = 7; } message TaskStateInfo { TaskType task_type = 1; bytes task_id = 2; TaskState state = 3; int64 start_time = 4; int64 end_time = 5; string worker_id = 6; int32 exit_code = 7; string stdout = 8; string stderr = 9; } message TaskRunRequest { string worker_id = 1; } message TaskRunReply { TaskInfo task = 1; } message TaskStateRequest { TaskStateInfo task = 1; } message TaskStateReply { } message WorkerInfo { string worker_id = 1; string address = 2; uint32 total_memory = 3; uint32 used_memory = 4; uint32 total_cpu = 5; uint32 used_cpu = 6; } message RegisterWorkerRequest { WorkerInfo worker = 1; } message RegisterWorkerReply { string status = 1; } message StopWorkerRequest { string worker_id = 1; string message = 2; } message StopWorkerReply { }