in jetstream/experimenter.py [0:0]
def to_experiment(self) -> experiment.Experiment:
"""Convert to Experiment."""
return experiment.Experiment(
normandy_slug=self.slug,
experimenter_slug=None,
type="v6", # currently using v8 API, but attribute remains from v6 API
status=(
"Live"
if (
self.endDate
and pytz.utc.localize(self.endDate) >= pytz.utc.localize(dt.datetime.now())
)
or self.endDate is None
else "Complete"
),
start_date=pytz.utc.localize(self.startDate) if self.startDate else None,
end_date=pytz.utc.localize(self.endDate) if self.endDate else None,
proposed_enrollment=self.proposedEnrollment,
branches=self.branches,
reference_branch=self.referenceBranch,
is_high_population=False,
app_name=self.appName,
app_id=self.appId,
outcomes=[o.slug for o in self.outcomes] if self.outcomes else [],
segments=[s.slug for s in self.segments] if self.segments else [],
enrollment_end_date=(
pytz.utc.localize(self.enrollmentEndDate) if self.enrollmentEndDate else None
),
is_enrollment_paused=bool(self.isEnrollmentPaused),
is_rollout=self.isRollout,
bucket_config=self.bucketConfig,
)