mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
admin: filter plugin jobs and activities by volume id (#13077)
* admin: keep the volume id on tracked plugin jobs Volume-scoped jobs carry their volume in the volume_id parameter, but the in-memory job list drops parameters, so nothing could select a volume's jobs without reading every job detail file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: filter plugin jobs and activities by volume id /api/plugin/jobs and /api/plugin/activities accept volume_id, applied before the limit like the lane filter. Activities follow the tracked jobs of that volume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: volume id filter on the plugin monitor A Volume ID box next to the execution state filter narrows the queue, execution jobs and activities to that volume's jobs, fetched with the volume_id API filter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: keep detection scans visible under the volume filter Detection activities belong to no job, so the volume-filtered activity window had none of them and the Detection Jobs table went empty. That table now reads its own job-type window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: accept zero-padded volume ids in the monitor filter Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: drop a monitor refresh that finishes after a newer one Two refreshes of the same scope can finish out of order; the older one then replaced the newer rows, with empty lists when its volume-filtered fetch failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: keep rows committed for the scope when a plugin monitor refresh fails A failed request fell back to the rows captured when the refresh started, so a refresh overlapping one that had already committed the new scope's rows cleared them. Resolve the fallback when the refresh commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: validate the monitor volume id before fetching Out-of-range ids went to the APIs and came back 400. The filter is now applied only from a valid change event, so the periodic refresh no longer reads a value still being typed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: volume id filter on the job queue view The queue renders the volume-scoped rows, but the only filter box sat on the execution view, so an active filter was invisible and could not be cleared there. Both views now carry a box kept in sync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: reject unparsable volume id text instead of clearing the filter A number input holding text like "1e" reports an empty value with validity.badInput set; treat it as invalid rather than as a cleared box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ec34160a1a
commit
40a95a8ef5
7 files changed
+271
-18
No files matched your search
@@ -170,6 +170,51 @@ func TestTrackExecutionQueuedMarksPendingState(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrackedJobsKeepVolumeID(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
pluginSvc, err := New(Options{})
|
||||
if err != nil {
|
||||
t.Fatalf("New: %v", err)
|
||||
}
|
||||
defer pluginSvc.Shutdown()
|
||||
|
||||
pluginSvc.trackExecutionQueued(&plugin_pb.JobSpec{
|
||||
JobId: "job-ec-17",
|
||||
JobType: "erasure_coding",
|
||||
Parameters: map[string]*plugin_pb.ConfigValue{
|
||||
"volume_id": {Kind: &plugin_pb.ConfigValue_Int64Value{Int64Value: 17}},
|
||||
},
|
||||
})
|
||||
pluginSvc.trackExecutionStart("req-1", "worker-a", &plugin_pb.JobSpec{
|
||||
JobId: "job-vacuum-23",
|
||||
JobType: "vacuum",
|
||||
Parameters: map[string]*plugin_pb.ConfigValue{
|
||||
"volume_id": {Kind: &plugin_pb.ConfigValue_StringValue{StringValue: "23"}},
|
||||
},
|
||||
}, 1)
|
||||
pluginSvc.trackExecutionQueued(&plugin_pb.JobSpec{JobId: "job-no-volume", JobType: "iceberg"})
|
||||
|
||||
want := map[string]uint32{"job-ec-17": 17, "job-vacuum-23": 23, "job-no-volume": 0}
|
||||
jobs := pluginSvc.ListTrackedJobs("", "", 0)
|
||||
if len(jobs) != len(want) {
|
||||
t.Fatalf("expected %d tracked jobs, got %d", len(want), len(jobs))
|
||||
}
|
||||
for _, job := range jobs {
|
||||
if job.VolumeID != want[job.JobID] {
|
||||
t.Fatalf("job %s: volume id %d, want %d", job.JobID, job.VolumeID, want[job.JobID])
|
||||
}
|
||||
}
|
||||
|
||||
detail, found, err := pluginSvc.BuildJobDetail("job-ec-17", 10, 0)
|
||||
if err != nil || !found || detail.Job == nil {
|
||||
t.Fatalf("BuildJobDetail: found=%v err=%v", found, err)
|
||||
}
|
||||
if detail.Job.VolumeID != 17 {
|
||||
t.Fatalf("detail volume id %d, want 17", detail.Job.VolumeID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleJobProgressUpdateCarriesWorkerIDInActivities(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in new issue
Block a user