-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dashboard): 500 error caused by data_for_slices API #16053
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1217,10 +1217,10 @@ def get_metric_name(metric: Metric) -> str: | |
|
||
|
||
def get_metric_names(metrics: Sequence[Metric]) -> List[str]: | ||
return [get_metric_name(metric) for metric in metrics] | ||
return [metric for metric in map(get_metric_name, metrics) if metric] | ||
|
||
|
||
def get_main_metric_name(metrics: Sequence[Metric]) -> Optional[str]: | ||
def get_first_metric_name(metrics: Sequence[Metric]) -> Optional[str]: | ||
metric_labels = get_metric_names(metrics) | ||
return metric_labels[0] if metric_labels else None | ||
|
||
|
@@ -1427,7 +1427,6 @@ def get_iterable(x: Any) -> List[Any]: | |
:param x: The object | ||
:returns: An iterable representation | ||
""" | ||
|
||
return x if isinstance(x, list) else [x] | ||
|
||
|
||
|
@@ -1464,12 +1463,7 @@ def get_column_names_from_metrics(metrics: List[Metric]) -> List[str]: | |
:param metrics: Ad-hoc metric | ||
:return: column name if simple metric, otherwise None | ||
""" | ||
columns: List[str] = [] | ||
for metric in metrics: | ||
column_name = get_column_name_from_metric(metric) | ||
if column_name: | ||
columns.append(column_name) | ||
return columns | ||
return [col for col in map(get_column_name_from_metric, metrics) if col] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bycatch refactor. No real code logic changes. |
||
|
||
|
||
def extract_dataframe_dtypes(df: pd.DataFrame) -> List[GenericDataType]: | ||
|
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of the for loop is incorrect. Normally it will throw an undefined variable error but since
param
was used in other loops above, the code will still run. Just another example of why too many local variables is not a good thing.