Admin UI add maintenance menu (#6944)
* add ui for maintenance * valid config loading. fix workers page. * refactor * grpc between admin and workers * add a long-running bidirectional grpc call between admin and worker * use the grpc call to heartbeat * use the grpc call to communicate * worker can remove the http client * admin uses http port + 10000 as its default grpc port * one task one package * handles connection failures gracefully with exponential backoff * grpc with insecure tls * grpc with optional tls * fix detecting tls * change time config from nano seconds to seconds * add tasks with 3 interfaces * compiles reducing hard coded * remove a couple of tasks * remove hard coded references * reduce hard coded values * remove hard coded values * remove hard coded from templ * refactor maintenance package * fix import cycle * simplify * simplify * auto register * auto register factory * auto register task types * self register types * refactor * simplify * remove one task * register ui * lazy init executor factories * use registered task types * DefaultWorkerConfig remove hard coded task types * remove more hard coded * implement get maintenance task * dynamic task configuration * "System Settings" should only have system level settings * adjust menu for tasks * ensure menu not collapsed * render job configuration well * use templ for ui of task configuration * fix ordering * fix bugs * saving duration in seconds * use value and unit for duration * Delete WORKER_REFACTORING_PLAN.md * Delete maintenance.json * Delete custom_worker_example.go * remove address from workers * remove old code from ec task * remove creating collection button * reconnect with exponential backoff * worker use security.toml * start admin server with tls info from security.toml * fix "weed admin" cli description
This commit is contained in:
142
weed/pb/worker.proto
Normal file
142
weed/pb/worker.proto
Normal file
@@ -0,0 +1,142 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package worker_pb;
|
||||
|
||||
option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/worker_pb";
|
||||
|
||||
// WorkerService provides bidirectional communication between admin and worker
|
||||
service WorkerService {
|
||||
// WorkerStream maintains a bidirectional stream for worker communication
|
||||
rpc WorkerStream(stream WorkerMessage) returns (stream AdminMessage);
|
||||
}
|
||||
|
||||
// WorkerMessage represents messages from worker to admin
|
||||
message WorkerMessage {
|
||||
string worker_id = 1;
|
||||
int64 timestamp = 2;
|
||||
|
||||
oneof message {
|
||||
WorkerRegistration registration = 3;
|
||||
WorkerHeartbeat heartbeat = 4;
|
||||
TaskRequest task_request = 5;
|
||||
TaskUpdate task_update = 6;
|
||||
TaskComplete task_complete = 7;
|
||||
WorkerShutdown shutdown = 8;
|
||||
}
|
||||
}
|
||||
|
||||
// AdminMessage represents messages from admin to worker
|
||||
message AdminMessage {
|
||||
string admin_id = 1;
|
||||
int64 timestamp = 2;
|
||||
|
||||
oneof message {
|
||||
RegistrationResponse registration_response = 3;
|
||||
HeartbeatResponse heartbeat_response = 4;
|
||||
TaskAssignment task_assignment = 5;
|
||||
TaskCancellation task_cancellation = 6;
|
||||
AdminShutdown admin_shutdown = 7;
|
||||
}
|
||||
}
|
||||
|
||||
// WorkerRegistration message when worker connects
|
||||
message WorkerRegistration {
|
||||
string worker_id = 1;
|
||||
string address = 2;
|
||||
repeated string capabilities = 3;
|
||||
int32 max_concurrent = 4;
|
||||
map<string, string> metadata = 5;
|
||||
}
|
||||
|
||||
// RegistrationResponse confirms worker registration
|
||||
message RegistrationResponse {
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
string assigned_worker_id = 3;
|
||||
}
|
||||
|
||||
// WorkerHeartbeat sent periodically by worker
|
||||
message WorkerHeartbeat {
|
||||
string worker_id = 1;
|
||||
string status = 2;
|
||||
int32 current_load = 3;
|
||||
int32 max_concurrent = 4;
|
||||
repeated string current_task_ids = 5;
|
||||
int32 tasks_completed = 6;
|
||||
int32 tasks_failed = 7;
|
||||
int64 uptime_seconds = 8;
|
||||
}
|
||||
|
||||
// HeartbeatResponse acknowledges heartbeat
|
||||
message HeartbeatResponse {
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
// TaskRequest from worker asking for new tasks
|
||||
message TaskRequest {
|
||||
string worker_id = 1;
|
||||
repeated string capabilities = 2;
|
||||
int32 available_slots = 3;
|
||||
}
|
||||
|
||||
// TaskAssignment from admin to worker
|
||||
message TaskAssignment {
|
||||
string task_id = 1;
|
||||
string task_type = 2;
|
||||
TaskParams params = 3;
|
||||
int32 priority = 4;
|
||||
int64 created_time = 5;
|
||||
map<string, string> metadata = 6;
|
||||
}
|
||||
|
||||
// TaskParams contains task-specific parameters
|
||||
message TaskParams {
|
||||
uint32 volume_id = 1;
|
||||
string server = 2;
|
||||
string collection = 3;
|
||||
string data_center = 4;
|
||||
string rack = 5;
|
||||
repeated string replicas = 6;
|
||||
map<string, string> parameters = 7;
|
||||
}
|
||||
|
||||
// TaskUpdate reports task progress
|
||||
message TaskUpdate {
|
||||
string task_id = 1;
|
||||
string worker_id = 2;
|
||||
string status = 3;
|
||||
float progress = 4;
|
||||
string message = 5;
|
||||
map<string, string> metadata = 6;
|
||||
}
|
||||
|
||||
// TaskComplete reports task completion
|
||||
message TaskComplete {
|
||||
string task_id = 1;
|
||||
string worker_id = 2;
|
||||
bool success = 3;
|
||||
string error_message = 4;
|
||||
int64 completion_time = 5;
|
||||
map<string, string> result_metadata = 6;
|
||||
}
|
||||
|
||||
// TaskCancellation from admin to cancel a task
|
||||
message TaskCancellation {
|
||||
string task_id = 1;
|
||||
string reason = 2;
|
||||
bool force = 3;
|
||||
}
|
||||
|
||||
// WorkerShutdown notifies admin that worker is shutting down
|
||||
message WorkerShutdown {
|
||||
string worker_id = 1;
|
||||
string reason = 2;
|
||||
repeated string pending_task_ids = 3;
|
||||
}
|
||||
|
||||
// AdminShutdown notifies worker that admin is shutting down
|
||||
message AdminShutdown {
|
||||
string reason = 1;
|
||||
int32 graceful_shutdown_seconds = 2;
|
||||
}
|
||||
Reference in New Issue
Block a user