Skip to content
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

[TE] clean up decprecated/unused code #5435

Merged
merged 6 commits into from Jun 4, 2020

Conversation

vincentchenjl
Copy link
Contributor

  • Clean up deprecated code

  • Refactor a bit to remove class dependency

Copy link
Contributor

@harleyjj harleyjj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-8215, that's some serious cleaning.

Copy link

@xiaohui-sun xiaohui-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great progress. @kishoreg FYI

@@ -261,13 +261,4 @@ public static DateTimeFormatter getDateTimeFormatterForDataset(TimeSpec timeSpec
return bucketNameToCountStar;
}

public static double getPercentCompleteness(PercentCompletenessFunctionInput input) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole class could be deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is used in Wo4WAvgDataCompletenessAlgorithm. We need to drop both of them if we want to drop this. Wo4WAvgDataCompletenessAlgorithm cannot be dropped due to the issue below.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove it and also remove getter/setter.
That should be safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remove Wo4WAvgDataCompletenessAlgorithm completely and also the field DatasetConfigBean.dataCompletenessAlgorithm from DatasetConfigBean.

Copy link
Member

@jihaozh jihaozh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Thank you for keeping the code base healthy!

Copy link
Contributor

@akshayrai akshayrai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice diligent effort!
Make sure to remove any traces in db and config if any.

@@ -160,14 +155,12 @@ public void run(ThirdEyeDashboardConfiguration config, Environment env)

AnomalyFunctionFactory anomalyFunctionFactory = new AnomalyFunctionFactory(config.getFunctionConfigPath());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AnomalyFunctionFactory is not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anomalyFunctionFactory is used to initialize AnomalyResource, DataResource, and AnomaliesResource. Could we confirm all these three resources are not used?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jihaozh can you check which resource is used? I believe most endpoints in AnomalyResource and AnomaliesResource are not used. From Harley's doc only "/anomalies/search/time/" is used, but let's double check with them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think AnomalyResource is not used. In AnomaliesResource, only the search endpoints listed by Harley is used. DataResource is being used, but it shouldn't need anomalyFunctionFactory anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we search for anomalies by using /anomalies/search/time/, we construct AnomalyDetails, and it requires BaseAnomalyFunction to do it.

private DatasetConfigManager datasetConfigDAO;
private AnomalyFunctionFactory anomalyFunctionFactory;
private AlertFilterFactory alertFilterFactory;
private LoadingCache<String, Long> collectionMaxDataTimeCache;

private static final DAORegistry DAO_REGISTRY = DAORegistry.getInstance();

public AnomalyResource(AnomalyFunctionFactory anomalyFunctionFactory, AlertFilterFactory alertFilterFactory,
AlertFilterAutotuneFactory alertFilterAutotuneFactory) {
public AnomalyResource(AnomalyFunctionFactory anomalyFunctionFactory, AlertFilterFactory alertFilterFactory) {
this.anomalyFunctionDAO = DAO_REGISTRY.getAnomalyFunctionDAO();
this.anomalyMergedResultDAO = DAO_REGISTRY.getMergedAnomalyResultDAO();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between anomalyMergedResultDAO and mergedAnomalyResultDAO. Seems duplicate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both these two are used in the class. If we r sure AnomalyResource is not used, we can remove the whole class.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question is duplication. We should remove one of them.

@@ -101,21 +99,18 @@
private MergedAnomalyResultManager anomalyMergedResultDAO;
private AlertConfigManager emailConfigurationDAO;
private MergedAnomalyResultManager mergedAnomalyResultDAO;
private AutotuneConfigManager autotuneConfigDAO;
private DatasetConfigManager datasetConfigDAO;
private AnomalyFunctionFactory anomalyFunctionFactory;
private AlertFilterFactory alertFilterFactory;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in line 141.
anomalyResults = AlertFilterHelper.applyFiltrationRule(anomalyResults, alertFilterFactory);

autotuneConfigDTO.setPerformance(performance);
return autotuneConfigDTO;
}

public static ClassificationConfigDTO getTestClassificationConfig(String name, List<Long> mainFunctionIdList,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed in next PR with all the unused DAO objects.

@xiaohui-sun
Copy link

@cecilynie @cyenjung FYI.

Copy link

@xiaohui-sun xiaohui-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for cleaning it up.

@xiaohui-sun xiaohui-sun merged commit 7ac4cd2 into apache:master Jun 4, 2020
@vincentchenjl vincentchenjl deleted the code_cleanup branch June 26, 2020 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants