diff --git a/jetstream/analysis.py b/jetstream/analysis.py index a411500f..4efc58aa 100644 --- a/jetstream/analysis.py +++ b/jetstream/analysis.py @@ -886,7 +886,6 @@ def _create_subset_metric_table_query_covariate( ) if not self.bigquery.column_exists_in_table(covariate_table_name, covariate_metric_name): - normalized_slug = bq_normalize_name(self.config.experiment.normandy_slug) log_msg = ( f"Covariate adjustment table {covariate_table_name} does not exist " f"(or `{covariate_metric_name}` not found in table), " @@ -895,7 +894,7 @@ def _create_subset_metric_table_query_covariate( logger.warning( log_msg, extra={ - "experiment": normalized_slug, + "experiment": self.config.experiment.normandy_slug, "metric": metric.name, "analysis_basis": analysis_basis.value, "segment": segment, diff --git a/jetstream/cli.py b/jetstream/cli.py index 0455ca16..d492f375 100644 --- a/jetstream/cli.py +++ b/jetstream/cli.py @@ -269,6 +269,15 @@ def execute( else: dataset_id = self.dataset_id + # `do_rerun`` experiment should only run OVERALL + analysis_periods = self.analysis_periods + if config.experiment.do_rerun: + analysis_periods = [AnalysisPeriod.OVERALL] + logger.warning( + "`do_rerun` experiment: skipping non-overall periods.", + extra={"experiment": config.experiment.normandy_slug}, + ) + # run the analysis analysis = self.analysis_class( self.project_id, @@ -276,7 +285,7 @@ def execute( config, self.log_config, None, - self.analysis_periods, + analysis_periods, self.sql_output_dir, ) analysis.run( @@ -483,7 +492,7 @@ def _experiment_configs_to_analyse( for e in experiments.ended_after_or_live(ended_threshold) .of_type(RECOGNIZED_EXPERIMENT_TYPES) .experiments - if not e.is_rollout + if not e.is_rollout and not e.do_rerun ] launched_configs = self._experiments_to_configs(launched_experiments, config_getter) @@ -1317,6 +1326,19 @@ def rerun_config_changed( experiments_with_updated_defaults + [conf.slug for conf in updated_configs] ) + # get the experiments from Experimenter API that are explicitly marked for rerun + # and are out of date + all_experiments = ExperimentCollection.from_experimenter() + rerun_experiments = [exp for exp in all_experiments if exp.do_rerun] + client = BigQueryClient(project_id, dataset_id) + for exp in rerun_experiments: + first_updated = client.experiment_table_first_updated(exp.normandy_slug) + # if exp was never run (has no results tables) or was last run before new rerun trigger + if first_updated is None or ( + exp.do_rerun_timestamp is not None and first_updated < exp.do_rerun_timestamp + ): + experiment_slugs.add(exp.normandy_slug) + # update the table timestamps which indicate whether a experiment needs to be rerun client = BigQueryClient(project_id, dataset_id) for slug in experiment_slugs: