diff --git a/weed/admin/dash/plugin_api.go b/weed/admin/dash/plugin_api.go index c3f936723..8eacd1557 100644 --- a/weed/admin/dash/plugin_api.go +++ b/weed/admin/dash/plugin_api.go @@ -936,8 +936,8 @@ func applyDescriptorDefaultsToPersistedConfig( if descriptor.AdminRuntimeDefaults != nil { runtime := config.AdminRuntime defaults := descriptor.AdminRuntimeDefaults - if runtime.DetectionIntervalSeconds <= 0 { - runtime.DetectionIntervalSeconds = defaults.DetectionIntervalSeconds + if runtime.DetectionIntervalMinutes <= 0 { + runtime.DetectionIntervalMinutes = defaults.DetectionIntervalMinutes } if runtime.DetectionTimeoutSeconds <= 0 { runtime.DetectionTimeoutSeconds = defaults.DetectionTimeoutSeconds diff --git a/weed/admin/dash/plugin_api_test.go b/weed/admin/dash/plugin_api_test.go index 77a1ac5d6..bc74188aa 100644 --- a/weed/admin/dash/plugin_api_test.go +++ b/weed/admin/dash/plugin_api_test.go @@ -137,7 +137,7 @@ func TestApplyDescriptorDefaultsToPersistedConfigBackfillsAdminDefaults(t *testi }, }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ - DetectionIntervalSeconds: 60, + DetectionIntervalMinutes: 60, DetectionTimeoutSeconds: 300, }, } @@ -152,7 +152,7 @@ func TestApplyDescriptorDefaultsToPersistedConfigBackfillsAdminDefaults(t *testi if !ok || scriptKind.StringValue == "" { t.Fatalf("expected non-empty script default, got=%+v", script) } - if config.AdminRuntime.DetectionIntervalSeconds != 60 { + if config.AdminRuntime.DetectionIntervalMinutes != 60 { t.Fatalf("expected runtime detection interval default to be backfilled") } } diff --git a/weed/admin/plugin/plugin.go b/weed/admin/plugin/plugin.go index 32a472484..a48670d40 100644 --- a/weed/admin/plugin/plugin.go +++ b/weed/admin/plugin/plugin.go @@ -1036,7 +1036,7 @@ func (r *Plugin) ensureJobTypeConfigFromDescriptor(jobType string, descriptor *p defaults := descriptor.AdminRuntimeDefaults adminRuntime = &plugin_pb.AdminRuntimeConfig{ Enabled: defaults.Enabled, - DetectionIntervalSeconds: defaults.DetectionIntervalSeconds, + DetectionIntervalMinutes: defaults.DetectionIntervalMinutes, DetectionTimeoutSeconds: defaults.DetectionTimeoutSeconds, MaxJobsPerDetection: defaults.MaxJobsPerDetection, GlobalExecutionConcurrency: defaults.GlobalExecutionConcurrency, diff --git a/weed/admin/plugin/plugin_config_bootstrap_test.go b/weed/admin/plugin/plugin_config_bootstrap_test.go index 83eacf284..f1d153e7c 100644 --- a/weed/admin/plugin/plugin_config_bootstrap_test.go +++ b/weed/admin/plugin/plugin_config_bootstrap_test.go @@ -30,7 +30,7 @@ func TestEnsureJobTypeConfigFromDescriptorBootstrapsDefaults(t *testing.T) { }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ Enabled: true, - DetectionIntervalSeconds: 60, + DetectionIntervalMinutes: 60, DetectionTimeoutSeconds: 20, MaxJobsPerDetection: 30, GlobalExecutionConcurrency: 4, diff --git a/weed/admin/plugin/plugin_scheduler.go b/weed/admin/plugin/plugin_scheduler.go index 6628f444f..83c04f0f4 100644 --- a/weed/admin/plugin/plugin_scheduler.go +++ b/weed/admin/plugin/plugin_scheduler.go @@ -466,7 +466,7 @@ func (r *Plugin) loadSchedulerPolicy(jobType string) (schedulerPolicy, bool, err } policy := schedulerPolicy{ - DetectionInterval: durationFromSeconds(adminRuntime.DetectionIntervalSeconds, defaultScheduledDetectionInterval), + DetectionInterval: durationFromMinutes(adminRuntime.DetectionIntervalMinutes, defaultScheduledDetectionInterval), DetectionTimeout: durationFromSeconds(adminRuntime.DetectionTimeoutSeconds, defaultScheduledDetectionTimeout), ExecutionTimeout: durationFromSeconds(adminRuntime.ExecutionTimeoutSeconds, defaultScheduledExecutionTimeout), JobTypeMaxRuntime: durationFromSeconds(adminRuntime.JobTypeMaxRuntimeSeconds, defaultScheduledJobTypeMaxRuntime), @@ -548,7 +548,7 @@ func (r *Plugin) ListSchedulerStates() ([]SchedulerJobTypeState, error) { } else { state.Enabled = enabled if enabled { - state.DetectionIntervalSeconds = secondsFromDuration(policy.DetectionInterval) + state.DetectionIntervalMinutes = minutesFromDuration(policy.DetectionInterval) state.DetectionTimeoutSeconds = secondsFromDuration(policy.DetectionTimeout) state.ExecutionTimeoutSeconds = secondsFromDuration(policy.ExecutionTimeout) state.JobTypeMaxRuntimeSeconds = secondsFromDuration(policy.JobTypeMaxRuntime) @@ -613,8 +613,8 @@ func deriveSchedulerAdminRuntime( // default instead of the handler's declared baseline. if descriptor != nil && descriptor.AdminRuntimeDefaults != nil { defaults := descriptor.AdminRuntimeDefaults - if adminConfig.DetectionIntervalSeconds <= 0 { - adminConfig.DetectionIntervalSeconds = defaults.DetectionIntervalSeconds + if adminConfig.DetectionIntervalMinutes <= 0 { + adminConfig.DetectionIntervalMinutes = defaults.DetectionIntervalMinutes } if adminConfig.DetectionTimeoutSeconds <= 0 { adminConfig.DetectionTimeoutSeconds = defaults.DetectionTimeoutSeconds @@ -648,7 +648,7 @@ func deriveSchedulerAdminRuntime( defaults := descriptor.AdminRuntimeDefaults return &plugin_pb.AdminRuntimeConfig{ Enabled: defaults.Enabled, - DetectionIntervalSeconds: defaults.DetectionIntervalSeconds, + DetectionIntervalMinutes: defaults.DetectionIntervalMinutes, DetectionTimeoutSeconds: defaults.DetectionTimeoutSeconds, MaxJobsPerDetection: defaults.MaxJobsPerDetection, GlobalExecutionConcurrency: defaults.GlobalExecutionConcurrency, @@ -1366,6 +1366,13 @@ func durationFromSeconds(seconds int32, defaultValue time.Duration) time.Duratio return time.Duration(seconds) * time.Second } +func durationFromMinutes(minutes int32, defaultValue time.Duration) time.Duration { + if minutes <= 0 { + return defaultValue + } + return time.Duration(minutes) * time.Minute +} + func secondsFromDuration(duration time.Duration) int32 { if duration <= 0 { return 0 @@ -1373,6 +1380,13 @@ func secondsFromDuration(duration time.Duration) int32 { return int32(duration / time.Second) } +func minutesFromDuration(duration time.Duration) int32 { + if duration <= 0 { + return 0 + } + return int32(duration / time.Minute) +} + func waitForShutdownOrTimerWithContext(shutdown <-chan struct{}, ctx context.Context, duration time.Duration) bool { if duration <= 0 { return true diff --git a/weed/admin/plugin/plugin_scheduler_test.go b/weed/admin/plugin/plugin_scheduler_test.go index 80fdf8a1f..cf876f3b4 100644 --- a/weed/admin/plugin/plugin_scheduler_test.go +++ b/weed/admin/plugin/plugin_scheduler_test.go @@ -23,7 +23,7 @@ func TestLoadSchedulerPolicyUsesAdminConfig(t *testing.T) { JobType: "vacuum", AdminRuntime: &plugin_pb.AdminRuntimeConfig{ Enabled: true, - DetectionIntervalSeconds: 30, + DetectionIntervalMinutes: 30, DetectionTimeoutSeconds: 20, MaxJobsPerDetection: 123, GlobalExecutionConcurrency: 5, @@ -74,7 +74,7 @@ func TestLoadSchedulerPolicyUsesDescriptorDefaultsWhenConfigMissing(t *testing.T JobType: "ec", AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ Enabled: true, - DetectionIntervalSeconds: 60, + DetectionIntervalMinutes: 60, DetectionTimeoutSeconds: 25, MaxJobsPerDetection: 30, GlobalExecutionConcurrency: 4, @@ -397,7 +397,7 @@ func TestListSchedulerStatesIncludesPolicyAndState(t *testing.T) { JobType: jobType, AdminRuntime: &plugin_pb.AdminRuntimeConfig{ Enabled: true, - DetectionIntervalSeconds: 45, + DetectionIntervalMinutes: 45, DetectionTimeoutSeconds: 30, MaxJobsPerDetection: 80, GlobalExecutionConcurrency: 3, @@ -448,8 +448,8 @@ func TestListSchedulerStatesIncludesPolicyAndState(t *testing.T) { if state.NextDetectionAt.Unix() != nextDetectionAt.Unix() { t.Fatalf("unexpected next detection time: got=%v want=%v", state.NextDetectionAt, nextDetectionAt) } - if state.DetectionIntervalSeconds != 45 { - t.Fatalf("unexpected detection interval: got=%d", state.DetectionIntervalSeconds) + if state.DetectionIntervalMinutes != 45 { + t.Fatalf("unexpected detection interval: got=%d", state.DetectionIntervalMinutes) } if state.DetectionTimeoutSeconds != 30 { t.Fatalf("unexpected detection timeout: got=%d", state.DetectionTimeoutSeconds) @@ -657,7 +657,7 @@ func TestRunLaneSchedulerIterationLockBehavior(t *testing.T) { JobType: tt.jobType, AdminRuntime: &plugin_pb.AdminRuntimeConfig{ Enabled: true, - DetectionIntervalSeconds: 1, + DetectionIntervalMinutes: 1, }, }) if err != nil { diff --git a/weed/admin/plugin/scheduler_status.go b/weed/admin/plugin/scheduler_status.go index d5a33069a..7359d7344 100644 --- a/weed/admin/plugin/scheduler_status.go +++ b/weed/admin/plugin/scheduler_status.go @@ -47,7 +47,7 @@ type SchedulerJobTypeStatus struct { Enabled bool `json:"enabled"` DetectionInFlight bool `json:"detection_in_flight"` NextDetectionAt *time.Time `json:"next_detection_at,omitempty"` - DetectionIntervalSeconds int32 `json:"detection_interval_seconds,omitempty"` + DetectionIntervalMinutes int32 `json:"detection_interval_minutes,omitempty"` LastDetectedAt *time.Time `json:"last_detected_at,omitempty"` LastDetectedCount int `json:"last_detected_count,omitempty"` LastDetectionError string `json:"last_detection_error,omitempty"` @@ -347,7 +347,7 @@ func (r *Plugin) GetLaneSchedulerStatus(lane SchedulerLane) SchedulerStatus { Enabled: state.Enabled, DetectionInFlight: state.DetectionInFlight, NextDetectionAt: state.NextDetectionAt, - DetectionIntervalSeconds: state.DetectionIntervalSeconds, + DetectionIntervalMinutes: state.DetectionIntervalMinutes, } if !info.lastDetectedAt.IsZero() { jobStatus.LastDetectedAt = timeToPtr(info.lastDetectedAt) @@ -430,7 +430,7 @@ func (r *Plugin) GetSchedulerStatus() SchedulerStatus { Enabled: state.Enabled, DetectionInFlight: state.DetectionInFlight, NextDetectionAt: state.NextDetectionAt, - DetectionIntervalSeconds: state.DetectionIntervalSeconds, + DetectionIntervalMinutes: state.DetectionIntervalMinutes, } if !info.lastDetectedAt.IsZero() { jobStatus.LastDetectedAt = timeToPtr(info.lastDetectedAt) diff --git a/weed/admin/plugin/scheduler_status_test.go b/weed/admin/plugin/scheduler_status_test.go index c2f175087..5a0c8161a 100644 --- a/weed/admin/plugin/scheduler_status_test.go +++ b/weed/admin/plugin/scheduler_status_test.go @@ -90,7 +90,7 @@ func TestGetLaneSchedulerStatusShowsActiveConcurrentLaneWork(t *testing.T) { JobType: jobType, AdminRuntime: &plugin_pb.AdminRuntimeConfig{ Enabled: true, - DetectionIntervalSeconds: 30, + DetectionIntervalMinutes: 30, DetectionTimeoutSeconds: 15, }, }) diff --git a/weed/admin/plugin/types.go b/weed/admin/plugin/types.go index d4804ac95..8a7df25fc 100644 --- a/weed/admin/plugin/types.go +++ b/weed/admin/plugin/types.go @@ -88,7 +88,7 @@ type SchedulerJobTypeState struct { PolicyError string `json:"policy_error,omitempty"` DetectionInFlight bool `json:"detection_in_flight"` NextDetectionAt *time.Time `json:"next_detection_at,omitempty"` - DetectionIntervalSeconds int32 `json:"detection_interval_seconds,omitempty"` + DetectionIntervalMinutes int32 `json:"detection_interval_minutes,omitempty"` DetectionTimeoutSeconds int32 `json:"detection_timeout_seconds,omitempty"` ExecutionTimeoutSeconds int32 `json:"execution_timeout_seconds,omitempty"` JobTypeMaxRuntimeSeconds int32 `json:"job_type_max_runtime_seconds,omitempty"` diff --git a/weed/admin/view/app/plugin.templ b/weed/admin/view/app/plugin.templ index 8654a0ece..19593acf6 100644 --- a/weed/admin/view/app/plugin.templ +++ b/weed/admin/view/app/plugin.templ @@ -258,7 +258,7 @@ templ Plugin(page string, initialJob string, lane string) {
- +
How often to check for new work.
@@ -2526,7 +2526,7 @@ templ Plugin(page string, initialJob string, lane string) { } document.getElementById('plugin-admin-enabled').checked = pickBool('enabled'); - document.getElementById('plugin-admin-detection-interval').value = String(pickNumber('detection_interval_seconds')); + document.getElementById('plugin-admin-detection-interval').value = String(pickNumber('detection_interval_minutes')); document.getElementById('plugin-admin-detection-timeout').value = String(pickNumber('detection_timeout_seconds')); document.getElementById('plugin-admin-execution-timeout').value = String(pickNumber('execution_timeout_seconds')); document.getElementById('plugin-admin-max-runtime').value = String(pickNumber('job_type_max_runtime_seconds')); @@ -2552,7 +2552,7 @@ templ Plugin(page string, initialJob string, lane string) { return { enabled: !!document.getElementById('plugin-admin-enabled').checked, - detection_interval_seconds: getInt('plugin-admin-detection-interval'), + detection_interval_minutes: getInt('plugin-admin-detection-interval'), detection_timeout_seconds: getInt('plugin-admin-detection-timeout'), execution_timeout_seconds: getInt('plugin-admin-execution-timeout'), job_type_max_runtime_seconds: getInt('plugin-admin-max-runtime'), diff --git a/weed/admin/view/app/plugin_lane.templ b/weed/admin/view/app/plugin_lane.templ index ea49e2b31..bc0ef0039 100644 --- a/weed/admin/view/app/plugin_lane.templ +++ b/weed/admin/view/app/plugin_lane.templ @@ -112,7 +112,7 @@ templ PluginLane(page string, lane string) { html += ''; html += '' + jt.job_type + ''; html += '' + (jt.enabled ? 'Yes' : 'No') + ''; - html += '' + (jt.detection_interval_seconds || '-') + 's'; + html += '' + (jt.detection_interval_minutes || '-') + 'm'; html += '' + (jt.detection_in_flight ? 'Yes' : 'No') + ''; html += '' + (jt.next_detection_at ? new Date(jt.next_detection_at).toLocaleTimeString() : '-') + ''; html += ''; @@ -132,7 +132,7 @@ templ PluginLane(page string, lane string) { html += '' + s.job_type + ''; html += '' + (s.enabled ? 'Yes' : 'No') + ''; html += '' + (s.global_execution_concurrency || 1) + ''; - html += '' + (s.detection_interval_seconds || '-') + 's'; + html += '' + (s.detection_interval_minutes || '-') + 'm'; html += '' + (s.last_run_status || '-') + ''; html += ''; }); diff --git a/weed/admin/view/app/plugin_lane_templ.go b/weed/admin/view/app/plugin_lane_templ.go index 614dd28f8..001266bd9 100644 --- a/weed/admin/view/app/plugin_lane_templ.go +++ b/weed/admin/view/app/plugin_lane_templ.go @@ -85,7 +85,7 @@ func PluginLane(page string, lane string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " scheduling lane.

All Workers
Lane Scheduler Status
Loading scheduler status...
Job Types
Loading job types...
Connected Workers
Loading workers...
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " scheduling lane.

All Workers
Lane Scheduler Status
Loading scheduler status...
Job Types
Loading job types...
Connected Workers
Loading workers...
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/weed/admin/view/app/plugin_templ.go b/weed/admin/view/app/plugin_templ.go index 754f1d731..fd9d9ab84 100644 --- a/weed/admin/view/app/plugin_templ.go +++ b/weed/admin/view/app/plugin_templ.go @@ -104,7 +104,7 @@ func Plugin(page string, initialJob string, lane string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

Workers

0

Active Jobs

0

Activities (recent)

0

Next Run

-

Per Job Type Summary
Job TypeActive JobsRecent Activities
Loading...
Scheduler State
Sequential scheduler with per-job runtime limits
Job TypeEnabledDetectorIn FlightMax RuntimeExec GlobalExec/WorkerExecutor WorkersEffective ExecLast Run
Loading...
Workers
WorkerAddressCapabilitiesLoad
Loading...
Job Type Configuration
Not loaded
Selected Job Type
-
Descriptor
Select a job type to load schema and config.
Admin Config Form
No admin form loaded.
Worker Config Form
No worker form loaded.
Job Scheduling Settings
How often to check for new work.
Per-attempt deadline for one job. Size-aware tasks may extend this automatically.
Next Run
Scheduler
-
Not scheduled
Run History
Keep last 10 success + last 10 errors
Successful Runs
TimeJob IDWorkerDuration
No data
Error Runs
TimeJob IDWorkerError
No data
Detection Results
Run detection to see proposals.
Job Queue
States: pending/assigned/running
Job IDTypeStateProgressWorkerUpdatedMessage
Loading...
Detection Jobs
Detection activities for selected job type
TimeJob TypeRequest IDWorkerStageSourceMessage
Loading...
Execution Jobs
Job IDTypeStateProgressWorkerUpdatedMessage
Loading...
Execution Activities
Non-detection events only
TimeJob TypeJob IDSourceStageMessage
Loading...
Job Detail
Select a job to view details.
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

Workers

0

Active Jobs

0

Activities (recent)

0

Next Run

-

Per Job Type Summary
Job TypeActive JobsRecent Activities
Loading...
Scheduler State
Sequential scheduler with per-job runtime limits
Job TypeEnabledDetectorIn FlightMax RuntimeExec GlobalExec/WorkerExecutor WorkersEffective ExecLast Run
Loading...
Workers
WorkerAddressCapabilitiesLoad
Loading...
Job Type Configuration
Not loaded
Selected Job Type
-
Descriptor
Select a job type to load schema and config.
Admin Config Form
No admin form loaded.
Worker Config Form
No worker form loaded.
Job Scheduling Settings
How often to check for new work.
Per-attempt deadline for one job. Size-aware tasks may extend this automatically.
Next Run
Scheduler
-
Not scheduled
Run History
Keep last 10 success + last 10 errors
Successful Runs
TimeJob IDWorkerDuration
No data
Error Runs
TimeJob IDWorkerError
No data
Detection Results
Run detection to see proposals.
Job Queue
States: pending/assigned/running
Job IDTypeStateProgressWorkerUpdatedMessage
Loading...
Detection Jobs
Detection activities for selected job type
TimeJob TypeRequest IDWorkerStageSourceMessage
Loading...
Execution Jobs
Job IDTypeStateProgressWorkerUpdatedMessage
Loading...
Execution Activities
Non-detection events only
TimeJob TypeJob IDSourceStageMessage
Loading...
Job Detail
Select a job to view details.
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/weed/pb/plugin.proto b/weed/pb/plugin.proto index 8bf5f10c4..9007908fc 100644 --- a/weed/pb/plugin.proto +++ b/weed/pb/plugin.proto @@ -225,7 +225,7 @@ message ValueMap { message AdminRuntimeDefaults { bool enabled = 1; - int32 detection_interval_seconds = 2; + int32 detection_interval_minutes = 2; int32 detection_timeout_seconds = 3; int32 max_jobs_per_detection = 4; int32 global_execution_concurrency = 5; @@ -241,7 +241,7 @@ message AdminRuntimeDefaults { message AdminRuntimeConfig { bool enabled = 1; - int32 detection_interval_seconds = 2; + int32 detection_interval_minutes = 2; int32 detection_timeout_seconds = 3; int32 max_jobs_per_detection = 4; int32 global_execution_concurrency = 5; diff --git a/weed/pb/plugin_pb/plugin.pb.go b/weed/pb/plugin_pb/plugin.pb.go index e0f08bc84..9a3ecab90 100644 --- a/weed/pb/plugin_pb/plugin.pb.go +++ b/weed/pb/plugin_pb/plugin.pb.go @@ -2485,7 +2485,7 @@ func (x *ValueMap) GetFields() map[string]*ConfigValue { type AdminRuntimeDefaults struct { state protoimpl.MessageState `protogen:"open.v1"` Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - DetectionIntervalSeconds int32 `protobuf:"varint,2,opt,name=detection_interval_seconds,json=detectionIntervalSeconds,proto3" json:"detection_interval_seconds,omitempty"` + DetectionIntervalMinutes int32 `protobuf:"varint,2,opt,name=detection_interval_minutes,json=detectionIntervalMinutes,proto3" json:"detection_interval_minutes,omitempty"` DetectionTimeoutSeconds int32 `protobuf:"varint,3,opt,name=detection_timeout_seconds,json=detectionTimeoutSeconds,proto3" json:"detection_timeout_seconds,omitempty"` MaxJobsPerDetection int32 `protobuf:"varint,4,opt,name=max_jobs_per_detection,json=maxJobsPerDetection,proto3" json:"max_jobs_per_detection,omitempty"` GlobalExecutionConcurrency int32 `protobuf:"varint,5,opt,name=global_execution_concurrency,json=globalExecutionConcurrency,proto3" json:"global_execution_concurrency,omitempty"` @@ -2538,9 +2538,9 @@ func (x *AdminRuntimeDefaults) GetEnabled() bool { return false } -func (x *AdminRuntimeDefaults) GetDetectionIntervalSeconds() int32 { +func (x *AdminRuntimeDefaults) GetDetectionIntervalMinutes() int32 { if x != nil { - return x.DetectionIntervalSeconds + return x.DetectionIntervalMinutes } return 0 } @@ -2604,7 +2604,7 @@ func (x *AdminRuntimeDefaults) GetExecutionTimeoutSeconds() int32 { type AdminRuntimeConfig struct { state protoimpl.MessageState `protogen:"open.v1"` Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - DetectionIntervalSeconds int32 `protobuf:"varint,2,opt,name=detection_interval_seconds,json=detectionIntervalSeconds,proto3" json:"detection_interval_seconds,omitempty"` + DetectionIntervalMinutes int32 `protobuf:"varint,2,opt,name=detection_interval_minutes,json=detectionIntervalMinutes,proto3" json:"detection_interval_minutes,omitempty"` DetectionTimeoutSeconds int32 `protobuf:"varint,3,opt,name=detection_timeout_seconds,json=detectionTimeoutSeconds,proto3" json:"detection_timeout_seconds,omitempty"` MaxJobsPerDetection int32 `protobuf:"varint,4,opt,name=max_jobs_per_detection,json=maxJobsPerDetection,proto3" json:"max_jobs_per_detection,omitempty"` GlobalExecutionConcurrency int32 `protobuf:"varint,5,opt,name=global_execution_concurrency,json=globalExecutionConcurrency,proto3" json:"global_execution_concurrency,omitempty"` @@ -2654,9 +2654,9 @@ func (x *AdminRuntimeConfig) GetEnabled() bool { return false } -func (x *AdminRuntimeConfig) GetDetectionIntervalSeconds() int32 { +func (x *AdminRuntimeConfig) GetDetectionIntervalMinutes() int32 { if x != nil { - return x.DetectionIntervalSeconds + return x.DetectionIntervalMinutes } return 0 } @@ -4121,7 +4121,7 @@ const file_plugin_proto_rawDesc = "" + "\x05value\x18\x02 \x01(\v2\x13.plugin.ConfigValueR\x05value:\x028\x01\"\xbb\x04\n" + "\x14AdminRuntimeDefaults\x12\x18\n" + "\aenabled\x18\x01 \x01(\bR\aenabled\x12<\n" + - "\x1adetection_interval_seconds\x18\x02 \x01(\x05R\x18detectionIntervalSeconds\x12:\n" + + "\x1adetection_interval_minutes\x18\x02 \x01(\x05R\x18detectionIntervalMinutes\x12:\n" + "\x19detection_timeout_seconds\x18\x03 \x01(\x05R\x17detectionTimeoutSeconds\x123\n" + "\x16max_jobs_per_detection\x18\x04 \x01(\x05R\x13maxJobsPerDetection\x12@\n" + "\x1cglobal_execution_concurrency\x18\x05 \x01(\x05R\x1aglobalExecutionConcurrency\x12G\n" + @@ -4134,7 +4134,7 @@ const file_plugin_proto_rawDesc = "" + " \x01(\x05R\x17executionTimeoutSeconds\"\xb9\x04\n" + "\x12AdminRuntimeConfig\x12\x18\n" + "\aenabled\x18\x01 \x01(\bR\aenabled\x12<\n" + - "\x1adetection_interval_seconds\x18\x02 \x01(\x05R\x18detectionIntervalSeconds\x12:\n" + + "\x1adetection_interval_minutes\x18\x02 \x01(\x05R\x18detectionIntervalMinutes\x12:\n" + "\x19detection_timeout_seconds\x18\x03 \x01(\x05R\x17detectionTimeoutSeconds\x123\n" + "\x16max_jobs_per_detection\x18\x04 \x01(\x05R\x13maxJobsPerDetection\x12@\n" + "\x1cglobal_execution_concurrency\x18\x05 \x01(\x05R\x1aglobalExecutionConcurrency\x12G\n" + diff --git a/weed/plugin/worker/admin_script_handler.go b/weed/plugin/worker/admin_script_handler.go index 5ba14019f..344376f9b 100644 --- a/weed/plugin/worker/admin_script_handler.go +++ b/weed/plugin/worker/admin_script_handler.go @@ -22,7 +22,7 @@ const ( adminScriptJobType = "admin_script" maxAdminScriptOutputBytes = 16 * 1024 defaultAdminScriptRunMins = 17 - adminScriptDetectTickSecs = 17 * 60 + adminScriptDetectTickMinutes = 17 ) const defaultAdminScript = `ec.balance -apply @@ -115,7 +115,7 @@ func (h *AdminScriptHandler) Descriptor() *plugin_pb.JobTypeDescriptor { }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ Enabled: true, - DetectionIntervalSeconds: adminScriptDetectTickSecs, + DetectionIntervalMinutes: adminScriptDetectTickMinutes, DetectionTimeoutSeconds: 300, MaxJobsPerDetection: 1, GlobalExecutionConcurrency: 1, diff --git a/weed/plugin/worker/admin_script_handler_test.go b/weed/plugin/worker/admin_script_handler_test.go index 4d29725e4..888a94bab 100644 --- a/weed/plugin/worker/admin_script_handler_test.go +++ b/weed/plugin/worker/admin_script_handler_test.go @@ -18,9 +18,9 @@ func TestAdminScriptDescriptorDefaults(t *testing.T) { if descriptor.AdminRuntimeDefaults == nil { t.Fatalf("expected admin runtime defaults") } - if descriptor.AdminRuntimeDefaults.DetectionIntervalSeconds != adminScriptDetectTickSecs { + if descriptor.AdminRuntimeDefaults.DetectionIntervalMinutes != adminScriptDetectTickMinutes { t.Fatalf("unexpected detection interval seconds: got=%d want=%d", - descriptor.AdminRuntimeDefaults.DetectionIntervalSeconds, adminScriptDetectTickSecs) + descriptor.AdminRuntimeDefaults.DetectionIntervalMinutes, adminScriptDetectTickMinutes) } if descriptor.AdminConfigForm == nil { t.Fatalf("expected admin config form") diff --git a/weed/worker/tasks/balance/plugin_handler.go b/weed/worker/tasks/balance/plugin_handler.go index 7fb36c3fe..d61220a04 100644 --- a/weed/worker/tasks/balance/plugin_handler.go +++ b/weed/worker/tasks/balance/plugin_handler.go @@ -220,7 +220,7 @@ func (h *VolumeBalanceHandler) Descriptor() *plugin_pb.JobTypeDescriptor { }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ Enabled: true, - DetectionIntervalSeconds: 30 * 60, + DetectionIntervalMinutes: 30, DetectionTimeoutSeconds: 120, MaxJobsPerDetection: 100, GlobalExecutionConcurrency: 16, diff --git a/weed/worker/tasks/ec_balance/plugin_handler.go b/weed/worker/tasks/ec_balance/plugin_handler.go index 5015c5bce..5146acc6f 100644 --- a/weed/worker/tasks/ec_balance/plugin_handler.go +++ b/weed/worker/tasks/ec_balance/plugin_handler.go @@ -159,7 +159,7 @@ func (h *ECBalanceHandler) Descriptor() *plugin_pb.JobTypeDescriptor { }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ Enabled: true, - DetectionIntervalSeconds: 60 * 30, + DetectionIntervalMinutes: 30, DetectionTimeoutSeconds: 300, MaxJobsPerDetection: 500, GlobalExecutionConcurrency: 16, diff --git a/weed/worker/tasks/erasure_coding/plugin_handler.go b/weed/worker/tasks/erasure_coding/plugin_handler.go index bc659828a..123829c82 100644 --- a/weed/worker/tasks/erasure_coding/plugin_handler.go +++ b/weed/worker/tasks/erasure_coding/plugin_handler.go @@ -158,7 +158,7 @@ func (h *ErasureCodingHandler) Descriptor() *plugin_pb.JobTypeDescriptor { }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ Enabled: true, - DetectionIntervalSeconds: 17 * 60, + DetectionIntervalMinutes: 17, DetectionTimeoutSeconds: 300, MaxJobsPerDetection: 500, GlobalExecutionConcurrency: 16, diff --git a/weed/worker/tasks/iceberg/handler.go b/weed/worker/tasks/iceberg/handler.go index ea9bde7b2..35b9967a9 100644 --- a/weed/worker/tasks/iceberg/handler.go +++ b/weed/worker/tasks/iceberg/handler.go @@ -324,7 +324,7 @@ func (h *Handler) Descriptor() *plugin_pb.JobTypeDescriptor { }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ Enabled: false, // disabled by default - DetectionIntervalSeconds: 3600, // 1 hour + DetectionIntervalMinutes: 60, // 1 hour DetectionTimeoutSeconds: 300, MaxJobsPerDetection: 100, GlobalExecutionConcurrency: 4, @@ -374,7 +374,7 @@ func (h *Handler) Detect(ctx context.Context, request *plugin_pb.RunDetectionReq return fmt.Errorf("invalid where config: %w", err) } - // Detection interval is managed by the scheduler via AdminRuntimeDefaults.DetectionIntervalSeconds. + // Detection interval is managed by the scheduler via AdminRuntimeDefaults.DetectionIntervalMinutes. // Get filer addresses from cluster context filerAddresses := make([]string, 0) diff --git a/weed/worker/tasks/s3_lifecycle/handler.go b/weed/worker/tasks/s3_lifecycle/handler.go index 4e6f81e60..247616b77 100644 --- a/weed/worker/tasks/s3_lifecycle/handler.go +++ b/weed/worker/tasks/s3_lifecycle/handler.go @@ -141,7 +141,7 @@ func (h *Handler) Descriptor() *plugin_pb.JobTypeDescriptor { }, }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ - DetectionIntervalSeconds: 24 * 60 * 60, // daily + DetectionIntervalMinutes: 24 * 60, // daily DetectionTimeoutSeconds: 60, MaxJobsPerDetection: 1, }, diff --git a/weed/worker/tasks/vacuum/plugin_handler.go b/weed/worker/tasks/vacuum/plugin_handler.go index 1d95f61ea..c533ddcc2 100644 --- a/weed/worker/tasks/vacuum/plugin_handler.go +++ b/weed/worker/tasks/vacuum/plugin_handler.go @@ -178,7 +178,7 @@ func (h *VacuumHandler) Descriptor() *plugin_pb.JobTypeDescriptor { }, AdminRuntimeDefaults: &plugin_pb.AdminRuntimeDefaults{ Enabled: true, - DetectionIntervalSeconds: 17 * 60, + DetectionIntervalMinutes: 17, DetectionTimeoutSeconds: 120, MaxJobsPerDetection: 200, GlobalExecutionConcurrency: 16,