How to use Info method of execution Package

Best Gauge code snippet using execution.Info

history_execution_child_workflow_test.go

Source:history_execution_child_workflow_test.go Github

copy

Full Screen

...68 workflowID := shuffle.String(testHistoryExecutionWorkflowID)69 runID := primitives.NewUUID()70 initiatedID := rand.Int63()71 childWorkflow := s.newRandomExecutionChildWorkflowRow(shardID, namespaceID, workflowID, runID, initiatedID)72 result, err := s.store.ReplaceIntoChildExecutionInfoMaps(newExecutionContext(), []sqlplugin.ChildExecutionInfoMapsRow{childWorkflow})73 s.NoError(err)74 rowsAffected, err := result.RowsAffected()75 s.NoError(err)76 s.Equal(1, int(rowsAffected))77}78func (s *historyExecutionChildWorkflowSuite) TestReplace_Multiple() {79 shardID := rand.Int31()80 namespaceID := primitives.NewUUID()81 workflowID := shuffle.String(testHistoryExecutionWorkflowID)82 runID := primitives.NewUUID()83 childWorkflow1 := s.newRandomExecutionChildWorkflowRow(shardID, namespaceID, workflowID, runID, rand.Int63())84 childWorkflow2 := s.newRandomExecutionChildWorkflowRow(shardID, namespaceID, workflowID, runID, rand.Int63())85 result, err := s.store.ReplaceIntoChildExecutionInfoMaps(newExecutionContext(), []sqlplugin.ChildExecutionInfoMapsRow{childWorkflow1, childWorkflow2})86 s.NoError(err)87 rowsAffected, err := result.RowsAffected()88 s.NoError(err)89 s.Equal(2, int(rowsAffected))90}91func (s *historyExecutionChildWorkflowSuite) TestReplaceSelect_Single() {92 shardID := rand.Int31()93 namespaceID := primitives.NewUUID()94 workflowID := shuffle.String(testHistoryExecutionWorkflowID)95 runID := primitives.NewUUID()96 initiatedID := rand.Int63()97 childWorkflow := s.newRandomExecutionChildWorkflowRow(shardID, namespaceID, workflowID, runID, initiatedID)98 result, err := s.store.ReplaceIntoChildExecutionInfoMaps(newExecutionContext(), []sqlplugin.ChildExecutionInfoMapsRow{childWorkflow})99 s.NoError(err)100 rowsAffected, err := result.RowsAffected()101 s.NoError(err)102 s.Equal(1, int(rowsAffected))103 selectFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{104 ShardID: shardID,105 NamespaceID: namespaceID,106 WorkflowID: workflowID,107 RunID: runID,108 }109 rows, err := s.store.SelectAllFromChildExecutionInfoMaps(newExecutionContext(), selectFilter)110 s.NoError(err)111 rowMap := map[int64]sqlplugin.ChildExecutionInfoMapsRow{}112 for _, childWorkflow := range rows {113 rowMap[childWorkflow.InitiatedID] = childWorkflow114 }115 s.Equal(map[int64]sqlplugin.ChildExecutionInfoMapsRow{116 childWorkflow.InitiatedID: childWorkflow,117 }, rowMap)118}119func (s *historyExecutionChildWorkflowSuite) TestReplaceSelect_Multiple() {120 numChildWorkflows := 20121 shardID := rand.Int31()122 namespaceID := primitives.NewUUID()123 workflowID := shuffle.String(testHistoryExecutionWorkflowID)124 runID := primitives.NewUUID()125 var childWorkflows []sqlplugin.ChildExecutionInfoMapsRow126 for i := 0; i < numChildWorkflows; i++ {127 childWorkflow := s.newRandomExecutionChildWorkflowRow(shardID, namespaceID, workflowID, runID, rand.Int63())128 childWorkflows = append(childWorkflows, childWorkflow)129 }130 result, err := s.store.ReplaceIntoChildExecutionInfoMaps(newExecutionContext(), childWorkflows)131 s.NoError(err)132 rowsAffected, err := result.RowsAffected()133 s.NoError(err)134 s.Equal(numChildWorkflows, int(rowsAffected))135 selectFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{136 ShardID: shardID,137 NamespaceID: namespaceID,138 WorkflowID: workflowID,139 RunID: runID,140 }141 rows, err := s.store.SelectAllFromChildExecutionInfoMaps(newExecutionContext(), selectFilter)142 s.NoError(err)143 childWorkflowMap := map[int64]sqlplugin.ChildExecutionInfoMapsRow{}144 for _, childWorkflow := range childWorkflows {145 childWorkflowMap[childWorkflow.InitiatedID] = childWorkflow146 }147 rowMap := map[int64]sqlplugin.ChildExecutionInfoMapsRow{}148 for _, childWorkflow := range rows {149 rowMap[childWorkflow.InitiatedID] = childWorkflow150 }151 s.Equal(childWorkflowMap, rowMap)152}153func (s *historyExecutionChildWorkflowSuite) TestDeleteSelect_Single() {154 shardID := rand.Int31()155 namespaceID := primitives.NewUUID()156 workflowID := shuffle.String(testHistoryExecutionWorkflowID)157 runID := primitives.NewUUID()158 initiatedID := rand.Int63()159 deleteFilter := sqlplugin.ChildExecutionInfoMapsFilter{160 ShardID: shardID,161 NamespaceID: namespaceID,162 WorkflowID: workflowID,163 RunID: runID,164 InitiatedIDs: []int64{initiatedID},165 }166 result, err := s.store.DeleteFromChildExecutionInfoMaps(newExecutionContext(), deleteFilter)167 s.NoError(err)168 rowsAffected, err := result.RowsAffected()169 s.NoError(err)170 s.Equal(0, int(rowsAffected))171 selectFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{172 ShardID: shardID,173 NamespaceID: namespaceID,174 WorkflowID: workflowID,175 RunID: runID,176 }177 rows, err := s.store.SelectAllFromChildExecutionInfoMaps(newExecutionContext(), selectFilter)178 s.NoError(err)179 s.Equal([]sqlplugin.ChildExecutionInfoMapsRow(nil), rows)180}181func (s *historyExecutionChildWorkflowSuite) TestDeleteSelect_Multiple() {182 shardID := rand.Int31()183 namespaceID := primitives.NewUUID()184 workflowID := shuffle.String(testHistoryExecutionWorkflowID)185 runID := primitives.NewUUID()186 deleteFilter := sqlplugin.ChildExecutionInfoMapsFilter{187 ShardID: shardID,188 NamespaceID: namespaceID,189 WorkflowID: workflowID,190 RunID: runID,191 InitiatedIDs: []int64{rand.Int63(), rand.Int63()},192 }193 result, err := s.store.DeleteFromChildExecutionInfoMaps(newExecutionContext(), deleteFilter)194 s.NoError(err)195 rowsAffected, err := result.RowsAffected()196 s.NoError(err)197 s.Equal(0, int(rowsAffected))198 selectFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{199 ShardID: shardID,200 NamespaceID: namespaceID,201 WorkflowID: workflowID,202 RunID: runID,203 }204 rows, err := s.store.SelectAllFromChildExecutionInfoMaps(newExecutionContext(), selectFilter)205 s.NoError(err)206 s.Equal([]sqlplugin.ChildExecutionInfoMapsRow(nil), rows)207}208func (s *historyExecutionChildWorkflowSuite) TestDeleteSelect_All() {209 shardID := rand.Int31()210 namespaceID := primitives.NewUUID()211 workflowID := shuffle.String(testHistoryExecutionWorkflowID)212 runID := primitives.NewUUID()213 deleteFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{214 ShardID: shardID,215 NamespaceID: namespaceID,216 WorkflowID: workflowID,217 RunID: runID,218 }219 result, err := s.store.DeleteAllFromChildExecutionInfoMaps(newExecutionContext(), deleteFilter)220 s.NoError(err)221 rowsAffected, err := result.RowsAffected()222 s.NoError(err)223 s.Equal(0, int(rowsAffected))224 selectFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{225 ShardID: shardID,226 NamespaceID: namespaceID,227 WorkflowID: workflowID,228 RunID: runID,229 }230 rows, err := s.store.SelectAllFromChildExecutionInfoMaps(newExecutionContext(), selectFilter)231 s.NoError(err)232 s.Equal([]sqlplugin.ChildExecutionInfoMapsRow(nil), rows)233}234func (s *historyExecutionChildWorkflowSuite) TestReplaceDeleteSelect_Single() {235 shardID := rand.Int31()236 namespaceID := primitives.NewUUID()237 workflowID := shuffle.String(testHistoryExecutionWorkflowID)238 runID := primitives.NewUUID()239 initiatedID := rand.Int63()240 childWorkflow := s.newRandomExecutionChildWorkflowRow(shardID, namespaceID, workflowID, runID, initiatedID)241 result, err := s.store.ReplaceIntoChildExecutionInfoMaps(newExecutionContext(), []sqlplugin.ChildExecutionInfoMapsRow{childWorkflow})242 s.NoError(err)243 rowsAffected, err := result.RowsAffected()244 s.NoError(err)245 s.Equal(1, int(rowsAffected))246 deleteFilter := sqlplugin.ChildExecutionInfoMapsFilter{247 ShardID: shardID,248 NamespaceID: namespaceID,249 WorkflowID: workflowID,250 RunID: runID,251 InitiatedIDs: []int64{initiatedID},252 }253 result, err = s.store.DeleteFromChildExecutionInfoMaps(newExecutionContext(), deleteFilter)254 s.NoError(err)255 rowsAffected, err = result.RowsAffected()256 s.NoError(err)257 s.Equal(1, int(rowsAffected))258 selectFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{259 ShardID: shardID,260 NamespaceID: namespaceID,261 WorkflowID: workflowID,262 RunID: runID,263 }264 rows, err := s.store.SelectAllFromChildExecutionInfoMaps(newExecutionContext(), selectFilter)265 s.NoError(err)266 s.Equal([]sqlplugin.ChildExecutionInfoMapsRow(nil), rows)267}268func (s *historyExecutionChildWorkflowSuite) TestReplaceDeleteSelect_Multiple() {269 numChildWorkflows := 20270 shardID := rand.Int31()271 namespaceID := primitives.NewUUID()272 workflowID := shuffle.String(testHistoryExecutionWorkflowID)273 runID := primitives.NewUUID()274 var childWorkflows []sqlplugin.ChildExecutionInfoMapsRow275 var childWorkflowInitiatedIDs []int64276 for i := 0; i < numChildWorkflows; i++ {277 childWorkflowInitiatedID := rand.Int63()278 childWorkflow := s.newRandomExecutionChildWorkflowRow(shardID, namespaceID, workflowID, runID, childWorkflowInitiatedID)279 childWorkflowInitiatedIDs = append(childWorkflowInitiatedIDs, childWorkflowInitiatedID)280 childWorkflows = append(childWorkflows, childWorkflow)281 }282 result, err := s.store.ReplaceIntoChildExecutionInfoMaps(newExecutionContext(), childWorkflows)283 s.NoError(err)284 rowsAffected, err := result.RowsAffected()285 s.NoError(err)286 s.Equal(numChildWorkflows, int(rowsAffected))287 deleteFilter := sqlplugin.ChildExecutionInfoMapsFilter{288 ShardID: shardID,289 NamespaceID: namespaceID,290 WorkflowID: workflowID,291 RunID: runID,292 InitiatedIDs: childWorkflowInitiatedIDs,293 }294 result, err = s.store.DeleteFromChildExecutionInfoMaps(newExecutionContext(), deleteFilter)295 s.NoError(err)296 rowsAffected, err = result.RowsAffected()297 s.NoError(err)298 s.Equal(numChildWorkflows, int(rowsAffected))299 selectFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{300 ShardID: shardID,301 NamespaceID: namespaceID,302 WorkflowID: workflowID,303 RunID: runID,304 }305 rows, err := s.store.SelectAllFromChildExecutionInfoMaps(newExecutionContext(), selectFilter)306 s.NoError(err)307 s.Equal([]sqlplugin.ChildExecutionInfoMapsRow(nil), rows)308}309func (s *historyExecutionChildWorkflowSuite) TestReplaceDeleteSelect_All() {310 numChildWorkflows := 20311 shardID := rand.Int31()312 namespaceID := primitives.NewUUID()313 workflowID := shuffle.String(testHistoryExecutionWorkflowID)314 runID := primitives.NewUUID()315 var childWorkflows []sqlplugin.ChildExecutionInfoMapsRow316 for i := 0; i < numChildWorkflows; i++ {317 childWorkflow := s.newRandomExecutionChildWorkflowRow(shardID, namespaceID, workflowID, runID, rand.Int63())318 childWorkflows = append(childWorkflows, childWorkflow)319 }320 result, err := s.store.ReplaceIntoChildExecutionInfoMaps(newExecutionContext(), childWorkflows)321 s.NoError(err)322 rowsAffected, err := result.RowsAffected()323 s.NoError(err)324 s.Equal(numChildWorkflows, int(rowsAffected))325 deleteFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{326 ShardID: shardID,327 NamespaceID: namespaceID,328 WorkflowID: workflowID,329 RunID: runID,330 }331 result, err = s.store.DeleteAllFromChildExecutionInfoMaps(newExecutionContext(), deleteFilter)332 s.NoError(err)333 rowsAffected, err = result.RowsAffected()334 s.NoError(err)335 s.Equal(numChildWorkflows, int(rowsAffected))336 selectFilter := sqlplugin.ChildExecutionInfoMapsAllFilter{337 ShardID: shardID,338 NamespaceID: namespaceID,339 WorkflowID: workflowID,340 RunID: runID,341 }342 rows, err := s.store.SelectAllFromChildExecutionInfoMaps(newExecutionContext(), selectFilter)343 s.NoError(err)344 s.Equal([]sqlplugin.ChildExecutionInfoMapsRow(nil), rows)345}346func (s *historyExecutionChildWorkflowSuite) newRandomExecutionChildWorkflowRow(347 shardID int32,348 namespaceID primitives.UUID,349 workflowID string,350 runID primitives.UUID,351 initiatedID int64,352) sqlplugin.ChildExecutionInfoMapsRow {353 return sqlplugin.ChildExecutionInfoMapsRow{354 ShardID: shardID,355 NamespaceID: namespaceID,356 WorkflowID: workflowID,357 RunID: runID,358 InitiatedID: initiatedID,359 Data: shuffle.Bytes(testHistoryExecutionChildWorkflowData),360 DataEncoding: testHistoryExecutionChildWorkflowEncoding,361 }362}...

Full Screen

Full Screen

size.go

Source:size.go Github

copy

Full Screen

...29) *MutableStateStatistics {30 if state == nil {31 return nil32 }33 executionInfoSize := sizeOfBlob(state.ExecutionInfo)34 executionStateSize := sizeOfBlob(state.ExecutionState)35 activityInfoCount := len(state.ActivityInfos)36 activityInfoSize := sizeOfInt64BlobMap(state.ActivityInfos)37 timerInfoCount := len(state.TimerInfos)38 timerInfoSize := sizeOfStringBlobMap(state.TimerInfos)39 childExecutionInfoCount := len(state.ChildExecutionInfos)40 childExecutionInfoSize := sizeOfInt64BlobMap(state.ChildExecutionInfos)41 requestCancelInfoCount := len(state.RequestCancelInfos)42 requestCancelInfoSize := sizeOfInt64BlobMap(state.RequestCancelInfos)43 signalInfoCount := len(state.SignalInfos)44 signalInfoSize := sizeOfInt64BlobMap(state.SignalInfos)45 signalRequestIDCount := len(state.SignalRequestedIDs)46 signalRequestIDSize := sizeOfStringSlice(state.SignalRequestedIDs)47 bufferedEventsCount := len(state.BufferedEvents)48 bufferedEventsSize := sizeOfBlobSlice(state.BufferedEvents)49 totalSize := executionInfoSize50 totalSize += executionStateSize51 totalSize += activityInfoSize52 totalSize += timerInfoSize53 totalSize += childExecutionInfoSize54 totalSize += requestCancelInfoSize55 totalSize += signalInfoSize56 totalSize += signalRequestIDSize57 totalSize += bufferedEventsSize58 return &MutableStateStatistics{59 TotalSize: totalSize,60 HistoryStatistics: historyStatistics,61 ExecutionInfoSize: executionInfoSize,62 ExecutionStateSize: executionStateSize,63 ActivityInfoSize: activityInfoSize,64 ActivityInfoCount: activityInfoCount,65 TimerInfoSize: timerInfoSize,66 TimerInfoCount: timerInfoCount,67 ChildInfoSize: childExecutionInfoSize,68 ChildInfoCount: childExecutionInfoCount,69 RequestCancelInfoSize: requestCancelInfoSize,70 RequestCancelInfoCount: requestCancelInfoCount,71 SignalInfoSize: signalInfoSize,72 SignalInfoCount: signalInfoCount,73 SignalRequestIDSize: signalRequestIDSize,74 SignalRequestIDCount: signalRequestIDCount,75 BufferedEventsSize: bufferedEventsSize,76 BufferedEventsCount: bufferedEventsCount,77 }78}79func statusOfInternalWorkflowMutation(80 mutation *InternalWorkflowMutation,81 historyStatistics *HistoryStatistics,82) *MutableStateStatistics {83 if mutation == nil {84 return nil85 }86 executionInfoSize := sizeOfBlob(mutation.ExecutionInfoBlob)87 executionStateSize := sizeOfBlob(mutation.ExecutionStateBlob)88 activityInfoCount := len(mutation.UpsertActivityInfos)89 activityInfoCount += len(mutation.DeleteActivityInfos)90 activityInfoSize := sizeOfInt64BlobMap(mutation.UpsertActivityInfos)91 activityInfoSize += sizeOfInt64Set(mutation.DeleteActivityInfos)92 timerInfoCount := len(mutation.UpsertTimerInfos)93 timerInfoCount += len(mutation.DeleteTimerInfos)94 timerInfoSize := sizeOfStringBlobMap(mutation.UpsertTimerInfos)95 timerInfoSize += sizeOfStringSet(mutation.DeleteTimerInfos)96 childExecutionInfoCount := len(mutation.UpsertChildExecutionInfos)97 childExecutionInfoCount += len(mutation.DeleteChildExecutionInfos)98 childExecutionInfoSize := sizeOfInt64BlobMap(mutation.UpsertChildExecutionInfos)99 childExecutionInfoSize += sizeOfInt64Set(mutation.DeleteChildExecutionInfos)100 requestCancelInfoCount := len(mutation.UpsertRequestCancelInfos)101 requestCancelInfoCount += len(mutation.DeleteRequestCancelInfos)102 requestCancelInfoSize := sizeOfInt64BlobMap(mutation.UpsertRequestCancelInfos)103 requestCancelInfoSize += sizeOfInt64Set(mutation.DeleteRequestCancelInfos)104 signalInfoCount := len(mutation.UpsertSignalInfos)105 signalInfoCount += len(mutation.DeleteSignalInfos)106 signalInfoSize := sizeOfInt64BlobMap(mutation.UpsertSignalInfos)107 signalInfoSize += sizeOfInt64Set(mutation.DeleteSignalInfos)108 signalRequestIDCount := len(mutation.UpsertSignalRequestedIDs)109 signalRequestIDCount += len(mutation.DeleteSignalRequestedIDs)110 signalRequestIDSize := sizeOfStringSet(mutation.UpsertSignalRequestedIDs)111 signalRequestIDSize += sizeOfStringSet(mutation.DeleteSignalRequestedIDs)112 bufferedEventsCount := 0113 bufferedEventsSize := 0114 if mutation.NewBufferedEvents != nil {115 bufferedEventsCount = 1116 bufferedEventsSize = mutation.NewBufferedEvents.Size()117 }118 taskCountByCategory := taskCountsByCategory(&mutation.Tasks)119 // TODO what about checksum?120 totalSize := executionInfoSize121 totalSize += executionStateSize122 totalSize += activityInfoSize123 totalSize += timerInfoSize124 totalSize += childExecutionInfoSize125 totalSize += requestCancelInfoSize126 totalSize += signalInfoSize127 totalSize += signalRequestIDSize128 totalSize += bufferedEventsSize129 return &MutableStateStatistics{130 TotalSize: totalSize,131 HistoryStatistics: historyStatistics,132 ExecutionInfoSize: executionInfoSize,133 ExecutionStateSize: executionStateSize,134 ActivityInfoSize: activityInfoSize,135 ActivityInfoCount: activityInfoCount,136 TimerInfoSize: timerInfoSize,137 TimerInfoCount: timerInfoCount,138 ChildInfoSize: childExecutionInfoSize,139 ChildInfoCount: childExecutionInfoCount,140 RequestCancelInfoSize: requestCancelInfoSize,141 RequestCancelInfoCount: requestCancelInfoCount,142 SignalInfoSize: signalInfoSize,143 SignalInfoCount: signalInfoCount,144 SignalRequestIDSize: signalRequestIDSize,145 SignalRequestIDCount: signalRequestIDCount,146 BufferedEventsSize: bufferedEventsSize,147 BufferedEventsCount: bufferedEventsCount,148 TaskCountByCategory: taskCountByCategory,149 }150}151func taskCountsByCategory(t *map[tasks.Category][]InternalHistoryTask) map[string]int {152 counts := make(map[string]int)153 for category, tasks := range *t {154 counts[category.Name()] = len(tasks)155 }156 return counts157}158func statusOfInternalWorkflowSnapshot(159 snapshot *InternalWorkflowSnapshot,160 historyStatistics *HistoryStatistics,161) *MutableStateStatistics {162 if snapshot == nil {163 return nil164 }165 executionInfoSize := sizeOfBlob(snapshot.ExecutionInfoBlob)166 executionStateSize := sizeOfBlob(snapshot.ExecutionStateBlob)167 activityInfoCount := len(snapshot.ActivityInfos)168 activityInfoSize := sizeOfInt64BlobMap(snapshot.ActivityInfos)169 timerInfoCount := len(snapshot.TimerInfos)170 timerInfoSize := sizeOfStringBlobMap(snapshot.TimerInfos)171 childExecutionInfoCount := len(snapshot.ChildExecutionInfos)172 childExecutionInfoSize := sizeOfInt64BlobMap(snapshot.ChildExecutionInfos)173 requestCancelInfoCount := len(snapshot.RequestCancelInfos)174 requestCancelInfoSize := sizeOfInt64BlobMap(snapshot.RequestCancelInfos)175 signalInfoCount := len(snapshot.SignalInfos)176 signalInfoSize := sizeOfInt64BlobMap(snapshot.SignalInfos)177 signalRequestIDCount := len(snapshot.SignalRequestedIDs)178 signalRequestIDSize := sizeOfStringSet(snapshot.SignalRequestedIDs)179 bufferedEventsCount := 0180 bufferedEventsSize := 0181 totalSize := executionInfoSize182 totalSize += executionStateSize183 totalSize += activityInfoSize184 totalSize += timerInfoSize185 totalSize += childExecutionInfoSize186 totalSize += requestCancelInfoSize187 totalSize += signalInfoSize188 totalSize += signalRequestIDSize189 totalSize += bufferedEventsSize190 taskCountByCategory := taskCountsByCategory(&snapshot.Tasks)191 return &MutableStateStatistics{192 TotalSize: totalSize,193 HistoryStatistics: historyStatistics,194 ExecutionInfoSize: executionInfoSize,195 ExecutionStateSize: executionStateSize,196 ActivityInfoSize: activityInfoSize,197 ActivityInfoCount: activityInfoCount,198 TimerInfoSize: timerInfoSize,199 TimerInfoCount: timerInfoCount,200 ChildInfoSize: childExecutionInfoSize,201 ChildInfoCount: childExecutionInfoCount,202 RequestCancelInfoSize: requestCancelInfoSize,203 RequestCancelInfoCount: requestCancelInfoCount,204 SignalInfoSize: signalInfoSize,205 SignalInfoCount: signalInfoCount,206 SignalRequestIDSize: signalRequestIDSize,207 SignalRequestIDCount: signalRequestIDCount,208 BufferedEventsSize: bufferedEventsSize,209 BufferedEventsCount: bufferedEventsCount,210 TaskCountByCategory: taskCountByCategory,211 }212}...

Full Screen

Full Screen

executionmode.go

Source:executionmode.go Github

copy

Full Screen

...47 "update", "patch",48 "delete", "destroy",49 "import_spreadsheet", "import_sqlserver"}[e]50}51// ExecutionModeInfo is used to hold configuration data for52// program control flow53type ExecutionModeInfo struct {54 ModeDir string55 TestPropertiesFile string56 TestDataDir string57}58// ExecutionModes is a global map of ExecutionModeInfo objects59var (60 ExecutionModes map[ExecutionMode]*ExecutionModeInfo61)62// InitExecutionModes is invoked once ONLY at program start to load63// configuration data for program execution64func InitExecutionModes() {65 log.Printf("InitExecutionModes() executing")66 ExecutionModes = make(map[ExecutionMode]*ExecutionModeInfo)67 ExecutionModes[PullMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(PullMode)}68 ExecutionModes[PushMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(PushMode)}69 ExecutionModes[BackupMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(BackupMode)}70 ExecutionModes[RestoreMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(RestoreMode)}71 ExecutionModes[UpdateMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(UpdateMode)}72 ExecutionModes[PatchMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(PatchMode)}73 ExecutionModes[DeleteMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(DeleteMode)}74 ExecutionModes[DestroyMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(DestroyMode)}75 ExecutionModes[ImportSqlserverMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(ImportSqlserverMode)}76 ExecutionModes[ImportSpreadsheetMode] = &ExecutionModeInfo{ModeDir: fmt.Sprint(ImportSpreadsheetMode)}77 for _, v := range ExecutionModes {78 v.TestDataDir = fmt.Sprintf("TestProcess%s", strcase.ToCamel(v.ModeDir))79 v.TestPropertiesFile = fmt.Sprintf("%s.properties", v.TestDataDir)80 }81 log.Printf("InitExecutionModes() completed")82}...

Full Screen

Full Screen

Info

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls", "-l")4 err := cmd.Run()5 if err != nil {6 fmt.Println(err)7 }8 fmt.Println("Process ID:", cmd.Process.Pid)9 fmt.Println("Process State:", cmd.ProcessState)10 fmt.Println("Process Path:", cmd.Path)11 fmt.Println("Process Args:", cmd.Args)12}

Full Screen

Full Screen

Info

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 executablePath, err := exec.LookPath("ls")4 if err != nil {5 fmt.Println(err)6 os.Exit(1)7 }8 fmt.Println("Executable Path: ", executablePath)9}

Full Screen

Full Screen

Info

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls", "-ltr")4 stdout, err := cmd.StdoutPipe()5 if err != nil {6 fmt.Println(err)7 os.Exit(1)8 }9 if err := cmd.Start(); err != nil {10 fmt.Println(err)11 os.Exit(1)12 }13 if err := stdout.Close(); err != nil {14 fmt.Println(err)15 os.Exit(1)16 }17}

Full Screen

Full Screen

Info

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls", "-l")4 err := cmd.Start()5 if err != nil {6 panic(err)7 }8 fmt.Println("Waiting for command to finish...")9 err = cmd.Wait()10 fmt.Printf("Command finished with error: %v", err)11}

Full Screen

Full Screen

Info

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls")4 info := cmd.Info()5 fmt.Println("Process ID: ", info.Pid())6 fmt.Println("Process Name: ", info.Name())7 fmt.Println("Process State: ", info.State())8 fmt.Println("Process User: ", info.User())9 fmt.Println("Process Group: ", info.Group())10 fmt.Println("Process Arguments: ", info.Args())11 fmt.Println("Process Environment Variables: ", info.Env())12 fmt.Println("Process Working Directory: ", info.Dir())13 fmt.Println("Process Creation Time: ", info.Sys())14 fmt.Println("Process Exit Code: ", info.Sys())15 fmt.Println("Process Exit Signal: ", info.Sys())16 err := cmd.Start()17 if err != nil {18 fmt.Println(err)19 os.Exit(1)20 }21 err = cmd.Wait()22 if err != nil {23 fmt.Println(err)24 os.Exit(1)25 }26 fmt.Println("Command finished successfully")27}

Full Screen

Full Screen

Info

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Executing ls command using GoLang...")4 cmd := exec.Command("ls")5 cmd.Run()6}

Full Screen

Full Screen

Info

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 execution := exec.Command("ls")4 fmt.Println(execution.Path)5 fmt.Println(execution.Args)6 fmt.Println(execution.Env)7 fmt.Println(execution.Dir)8 fmt.Println(execution.ProcessState)9 fmt.Println(execution.Process)10 fmt.Println(execution.StdinPipe)11 fmt.Println(execution.StdoutPipe)12 fmt.Println(execution.StderrPipe)13 fmt.Println(execution.ExtraFiles)14 fmt.Println(execution.SysProcAttr)15 fmt.Println(execution.ProcessAttr)16 fmt.Println(execution.Stdin)17 fmt.Println(execution.Stdout)18 fmt.Println(execution.Stderr)19 fmt.Println(execution.Sys)20 fmt.Println(execution.LookPathError)21 fmt.Println(execution.StartTime)22 fmt.Println(execution.RunTime)23 fmt.Println(execution.ProcessState)24 fmt.Println(execution.Process)25 fmt.Println(execution.ExitCode)26 fmt.Println(execution.Pid)27 fmt.Println(execution.StdinPipe)28 fmt.Println(execution.StdoutPipe)29 fmt.Println(execution.StderrPipe)30 fmt.Println(execution.ExtraFiles)

Full Screen

Full Screen

Info

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 proc := os.Getpid()4 fmt.Println("Process ID:", proc)5 exec := exec.Command("ls")6 fmt.Println("Process ID:", exec.Process.Pid)7}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Gauge automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful