Implement concurrent targets in config command#328
Merged
Conversation
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements concurrent processing of targets in the config command and updates related data structures. Key changes include:
- Refactoring TargetScriptOutputs in common.go to use exported field names.
- Converting synchronous configuration changes into concurrent operations with improved spinner usage and error reporting.
- Enhancing the printConfig logic to process and display table outputs concurrently.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/common/common.go | Updated struct field names for TargetScriptOutputs for concurrency support. |
| cmd/config/config.go | Refactored the config command to run target operations concurrently with improved status updates and error handling. |
Comments suppressed due to low confidence (1)
internal/common/common.go:46
- [nitpick] The renaming of the struct fields to exported names is clear; ensure that all consuming code and documentation are updated to reflect these changes.
type TargetScriptOutputs struct {
TargetName string
ScriptOutputs map[string]script.ScriptOutput
TableNames []string
}
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements concurrent updates to the configuration command by refactoring flag functions and target operations to use asynchronous channel‐based error handling. Key changes include:
- Renaming struct fields and updating accessors in internal/common/common.go to export necessary values.
- Changing flag definitions and their corresponding set functions (in cmd/config/flag.go and flag_groups.go) to accept channel and index parameters to support concurrent execution.
- Refactoring the configuration update and reporting logic in cmd/config/config.go to run updates concurrently using goroutines and channels.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/common/common.go | Updates exported field names and accessors for consistency. |
| cmd/config/flag_groups.go | Adds an "Other Options" group and updates flag callback signatures. |
| cmd/config/flag.go | Modifies flag functions to include concurrency parameters. |
| cmd/config/config.go | Refactors config update logic for concurrent target processing. |
Comments suppressed due to low confidence (2)
cmd/config/config.go:176
- Consider assigning len(successMessages)-1 to a local variable before launching the goroutine to ensure the intended index is reliably captured.
go flag.intSetFunc(value, myTarget, localTempDir, channelSetComplete, len(successMessages)-1)
cmd/config/config.go:240
- The error received from channelError is logged but not propagated back to the caller, which could lead to silent failures. Consider returning or otherwise handling the error to ensure proper error reporting.
select { case scriptOutputs := <-channelTargetScriptOutputs: ... case err := <-channelError: ... }
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
echiugoog
pushed a commit
to echiugoog/PerfSpect
that referenced
this pull request
May 21, 2025
* Implement concurrent targets in config command Signed-off-by: Harper, Jason M <jason.m.harper@intel.com> * Add detailed status messages for configuration changes on target Signed-off-by: Harper, Jason M <jason.m.harper@intel.com> * no-summary option Signed-off-by: Harper, Jason M <jason.m.harper@intel.com> * const str Signed-off-by: Harper, Jason M <jason.m.harper@intel.com> * parallelize the set functions Signed-off-by: Harper, Jason M <jason.m.harper@intel.com> * Refactor setOutput struct definition for clarity and consistency Signed-off-by: Harper, Jason M <jason.m.harper@intel.com> --------- Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.