Skip to content

Commit

Permalink
NoResultException added.
Browse files Browse the repository at this point in the history
Signed-off-by: msvinaykumar <vinakuma@redhat.com>
  • Loading branch information
msvinaykumar committed May 22, 2023
1 parent bf60a9c commit 89e1837
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.autotune.database.table.KruizeRecommendationEntry;
import com.autotune.database.table.KruizeResultsEntry;
import com.autotune.utils.KruizeConstants;
import jakarta.persistence.NoResultException;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
Expand Down Expand Up @@ -252,6 +253,9 @@ public KruizeResultsEntry getKruizeResultsEntry(String experiment_name, Timestam
.setParameter(KruizeConstants.JSONKeys.EXPERIMENT_NAME, experiment_name)
.setParameter(KruizeConstants.JSONKeys.INTERVAL_END_TIME, interval_end_time)
.getSingleResult();
} catch (NoResultException e) {
LOGGER.error("Data not found in kruizeResultsEntry for exp_name:{} interval_end_time:{} ", experiment_name, interval_end_time);
kruizeResultsEntry = null;
} catch (Exception e) {
kruizeResultsEntry = null;
LOGGER.error("Not able to load results due to: {}", e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,11 @@ public boolean updateExperimentStatus(KruizeObject kruizeObject, AnalyzerConstan
public ExperimentResultData getExperimentResultData(String experiment_name, Timestamp interval_end_time) throws Exception {
ExperimentResultData experimentResultData = null;
KruizeResultsEntry kruizeResultsEntry = experimentDAO.getKruizeResultsEntry(experiment_name, interval_end_time);
List<UpdateResultsAPIObject> updateResultsAPIObjects = DBHelpers.Converters.KruizeObjectConverters.convertResultEntryToUpdateResultsAPIObject(Collections.singletonList(kruizeResultsEntry));
if (null != updateResultsAPIObjects && !updateResultsAPIObjects.isEmpty()) {
experimentResultData = Converters.KruizeObjectConverters.convertUpdateResultsAPIObjToExperimentResultData(updateResultsAPIObjects.get(0));
if (null != kruizeResultsEntry) {
List<UpdateResultsAPIObject> updateResultsAPIObjects = DBHelpers.Converters.KruizeObjectConverters.convertResultEntryToUpdateResultsAPIObject(Collections.singletonList(kruizeResultsEntry));
if (null != updateResultsAPIObjects && !updateResultsAPIObjects.isEmpty()) {
experimentResultData = Converters.KruizeObjectConverters.convertUpdateResultsAPIObjToExperimentResultData(updateResultsAPIObjects.get(0));
}
}
return experimentResultData;
}
Expand Down

0 comments on commit 89e1837

Please sign in to comment.