Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flaky test caused by "_created_time" cloning race condition (#2307)
Summary: Pull Request resolved: #2307 This equality check is failing sometimes in Python 3.9 on open source ( T184131441 ): ``` def test_clone_with(self) -> None: experiment = get_experiment() cloned_experiment = experiment.clone_with() self.assertEqual(cloned_experiment.name, "cloned_experiment_" + experiment.name) cloned_experiment._name = experiment.name self.assertEqual(cloned_experiment, experiment) ``` The error is ``` Experiment(test) (type <class 'ax.core.experiment.Experiment'>) != Experiment(test) (type <class 'ax.core.experiment.Experiment'>). Fields with different values: 1) _time_created: 2024-04-01 05:05:13.000613 (type <class 'datetime.datetime'>) != 2024-04-01 05:05:12.998793 (type <class 'datetime.datetime'>). ``` This is a race condition, where if "get_experiment" and "clone_with" execute quickly the _time_created field will be equal, but if there is delay they'll be unequal. Approach: reset the time of the cloned experiment to that of the original Reviewed By: esantorella Differential Revision: D55596348 fbshipit-source-id: a4ab76df266fb779370c4b4679c21c2712064c06
- Loading branch information