From e21e15975ad80010f2153877e71ece3c095d4637 Mon Sep 17 00:00:00 2001 From: Lena Kashtelyan Date: Thu, 12 Nov 2020 08:09:01 -0800 Subject: [PATCH] 7.6/n: Set db_id on user-facing classes in fb-only save functions Summary: Applying `_set_db_ids` to fb-only functions Reviewed By: ldworkin Differential Revision: D24788807 fbshipit-source-id: cfa2b5d75bed8aa68ac4ebd316f53295b1d47e18 --- ax/utils/common/equality.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ax/utils/common/equality.py b/ax/utils/common/equality.py index 75068875e95..adf5015c234 100644 --- a/ax/utils/common/equality.py +++ b/ax/utils/common/equality.py @@ -104,7 +104,10 @@ def object_attribute_dicts_equal( def object_attribute_dicts_find_unequal_fields( - one_dict: Dict[str, Any], other_dict: Dict[str, Any], fast_return: bool = True + one_dict: Dict[str, Any], + other_dict: Dict[str, Any], + fast_return: bool = True, + skip_db_id_check: bool = False, ) -> Tuple[Dict[str, Tuple[Any, Any]], Dict[str, Tuple[Any, Any]]]: """Utility for finding out what attributes of two objects' attribute dicts are unequal. @@ -136,6 +139,11 @@ def object_attribute_dicts_find_unequal_fields( if field == "_experiment": # prevent infinite loop when checking equality of Trials equal = one_val is other_val is None or (one_val._name == other_val._name) + elif field == "analysis_scheduler": + # prevent infinite loop when checking equality of analysis runs + equal = one_val is other_val is None or (one_val.db_id == other_val.db_id) + elif field == "_db_id": + equal = skip_db_id_check or one_val == other_val elif field == "_model": # pragma: no cover (tested in modelbridge) # TODO[T52643706]: replace with per-`ModelBridge` method like # `equivalent_models`, to compare models more meaningfully.