Update experiment export query to include feature ids and branch feature config values (#4477)
* Update experiment export query to include feature ids and branch feature config value. * Add view skip for broken view * add skip to dry run as well
This commit is contained in:
Родитель
a03d875019
Коммит
fac37452ab
|
@ -20,6 +20,7 @@ dry_run:
|
|||
function: https://us-central1-moz-fx-data-shared-prod.cloudfunctions.net/bigquery-etl-dryrun
|
||||
skip:
|
||||
# Access Denied
|
||||
- sql/moz-fx-data-shared-prod/ads/nt_visits_to_sessions_conversion_factors_daily/view.sql
|
||||
- sql/moz-fx-data-shared-prod/account_ecosystem_derived/ecosystem_client_id_lookup_v1/query.sql
|
||||
- sql/moz-fx-data-shared-prod/account_ecosystem_derived/desktop_clients_daily_v1/query.sql
|
||||
- sql/moz-fx-data-shared-prod/account_ecosystem_restricted/ecosystem_client_id_deletion_v1/query.sql
|
||||
|
@ -362,6 +363,7 @@ view:
|
|||
# tests
|
||||
- sql/moz-fx-data-test-project/test/simple_view/view.sql
|
||||
# Access Denied
|
||||
- sql/moz-fx-data-shared-prod/ads/nt_visits_to_sessions_conversion_factors_daily/view.sql
|
||||
- sql/moz-fx-data-shared-prod/telemetry/experiment_enrollment_cumulative_population_estimate/view.sql
|
||||
- sql/moz-fx-data-shared-prod/mlhackweek_search/events/view.sql
|
||||
- sql/moz-fx-data-shared-prod/regrets_reporter_ucs/deletion_request/view.sql
|
||||
|
|
|
@ -38,6 +38,7 @@ class Branch:
|
|||
|
||||
slug: str
|
||||
ratio: int
|
||||
features: Optional[dict]
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
|
@ -61,6 +62,7 @@ class Experiment:
|
|||
targeting: str
|
||||
targeted_percent: float
|
||||
namespace: Optional[str]
|
||||
feature_ids: List[str]
|
||||
|
||||
|
||||
def _coerce_none_to_zero(x: Optional[int]) -> int:
|
||||
|
@ -113,7 +115,8 @@ class ExperimentV1:
|
|||
def to_experiment(self) -> "Experiment":
|
||||
"""Convert to Experiment."""
|
||||
branches = [
|
||||
Branch(slug=variant.slug, ratio=variant.ratio) for variant in self.variants
|
||||
Branch(slug=variant.slug, ratio=variant.ratio, features=None)
|
||||
for variant in self.variants
|
||||
]
|
||||
control_slug = None
|
||||
|
||||
|
@ -141,6 +144,7 @@ class ExperimentV1:
|
|||
targeting="",
|
||||
targeted_percent=float(self.population_percent) / 100.0,
|
||||
namespace=None,
|
||||
feature_ids=[],
|
||||
)
|
||||
|
||||
|
||||
|
@ -160,6 +164,7 @@ class ExperimentV6:
|
|||
channel: str
|
||||
targeting: str
|
||||
bucketConfig: dict
|
||||
featureIds: list[str]
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, d) -> "ExperimentV6":
|
||||
|
@ -173,7 +178,9 @@ class ExperimentV6:
|
|||
)
|
||||
converter.register_structure_hook(
|
||||
Branch,
|
||||
lambda b, _: Branch(slug=b["slug"], ratio=b["ratio"]),
|
||||
lambda b, _: Branch(
|
||||
slug=b["slug"], ratio=b["ratio"], features=b["features"]
|
||||
),
|
||||
)
|
||||
return converter.structure(d, cls)
|
||||
|
||||
|
@ -205,6 +212,7 @@ class ExperimentV6:
|
|||
targeting=self.targeting,
|
||||
targeted_percent=self.bucketConfig["count"] / self.bucketConfig["total"],
|
||||
namespace=self.bucketConfig["namespace"],
|
||||
feature_ids=self.featureIds,
|
||||
)
|
||||
|
||||
|
||||
|
@ -278,6 +286,7 @@ def main():
|
|||
fields=[
|
||||
bigquery.SchemaField("slug", "STRING"),
|
||||
bigquery.SchemaField("ratio", "INTEGER"),
|
||||
bigquery.SchemaField("features", "JSON"),
|
||||
],
|
||||
),
|
||||
bigquery.SchemaField("app_id", "STRING"),
|
||||
|
@ -286,6 +295,7 @@ def main():
|
|||
bigquery.SchemaField("targeting", "STRING"),
|
||||
bigquery.SchemaField("targeted_percent", "FLOAT"),
|
||||
bigquery.SchemaField("namespace", "STRING"),
|
||||
bigquery.SchemaField("feature_ids", "STRING", mode="REPEATED"),
|
||||
)
|
||||
|
||||
job_config = bigquery.LoadJobConfig(
|
||||
|
|
Загрузка…
Ссылка в новой задаче