commands.go ×9

Frontier kind: Code frontier

unlabeled · c_0b2e70b94850

6 tests · 3265 LOC · 142 files · introduces 0 tests · 45 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges45 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
415 ranges3265 lines · 142 files · Browse complete extent
All tests (intent)
6 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 45 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/tools/tdbg/commands.go 45 introduced LOC · 9 ranges

Open complete file

912 return fmt.Errorf("--%s cannot be combined with --%s", FlagFromVisibility, FlagScheduleID)
913 }
914 > return migrateSchedulesFromVisibility(c, clientFactory, target, targetStr) commands.go
915 case scheduleID != "":
916 return migrateSingleSchedule(c, clientFactory, target, targetStr, scheduleID)
1022 target adminservice.MigrateScheduleRequest_SchedulerTarget,
1023 targetStr string,
1024 > ) error { commands.go
1025 > ns, err := getRequiredOption(c, FlagNamespace)
1026 > if err != nil {
1027 return err
1028 }
1031 // to CHASM (V2) selects the running V1 (workflow-backed) schedules to move forward, while
1032 // migrating to workflow (V1) selects the running V2 (CHASM) schedules to roll back.
1033 > query := c.String(FlagVisibilityQuery) commands.go
1034 > if query == "" {
1035 if target == adminservice.MigrateScheduleRequest_SCHEDULER_TARGET_CHASM {
1036 // Forward migration V1 -> V2: all running V1 (workflow-backed) schedules.
1042 }
1043
1044 > execute := c.Bool(FlagExecute) commands.go
1045 > workers := max(c.Int(FlagWorkers), 1)
1046 > wfClient := clientFactory.WorkflowClient(c)
1047 > adminClient := clientFactory.AdminClient(c)
1048 >
1049 > // Schedules are listed (paginated) on this goroutine and fed to a pool of workers
1050 > // that migrate them concurrently.
1051 > var summary migrateSummary
1052 > closeLog, err := openMigrateLog(c, &summary)
1053 > if err != nil {
1054 return err
1055 }
1056 > defer closeLog() commands.go
1057 > jobs := make(chan migrateJob)
1058 > var wg sync.WaitGroup
1059 > for range workers {
1060 > wg.Go(func() {
1061 > for job := range jobs {
1062 migrateOne(c, adminClient, job.namespace, job.scheduleID, target, targetStr, execute, &summary)
1063 }
1065 }
1066
1067 > var listErr error commands.go
1068 > var nextPageToken []byte
1069 > for {
1070 > ctx, cancel := newContext(c)
1071 > resp, err := wfClient.ListWorkflowExecutions(ctx, &workflowservice.ListWorkflowExecutionsRequest{
1072 > Namespace: ns,
1073 > Query: query,
1074 > NextPageToken: nextPageToken,
1075 > })
1076 > cancel()
1077 > if err != nil {
1078 listErr = fmt.Errorf("unable to list schedules from visibility: %w", err)
1079 break
1080 }
1081
1082 > for _, exec := range resp.GetExecutions() { commands.go
1083 workflowID := exec.GetExecution().GetWorkflowId()
1084 // CHASM scheduler executions store the schedule id directly as the workflow id;
1088 }
1089
1090 > nextPageToken = resp.GetNextPageToken() commands.go
1091 > if len(nextPageToken) == 0 {
1092 > break
1093 }
1094 }
1095 > close(jobs) commands.go
1096 > wg.Wait()
1097 >
1098 > // Always report what was migrated before surfacing a listing error: if pagination fails
1099 > // partway through, workers may have already migrated the schedules listed so far, and the
1100 > // user needs to see that partial progress.
1101 > summary.print(c, execute)
1102 > return listErr
1103 }
1104