Skip to content

Commit

Permalink
Closes #16: Generate dashboards from experiments json definition in a…
Browse files Browse the repository at this point in the history
… lambda handler.
  • Loading branch information
Marina Samuel committed Jun 2, 2017
1 parent 543aeec commit b1ff05c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/dashboards/dashboard_instances/lambda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os

from src.redash_client import RedashClient
from src.utils import read_experiment_definition, format_date
from src.dashboards.ActivityStreamExperimentDashboard import (
ActivityStreamExperimentDashboard)

DIRECTORY_NAME = "experiments/json_definitions"
FILENAME = "experiments2.json"


def handler():
api_key = os.environ["REDASH_API_KEY"]
redash_client = RedashClient(api_key)

experiments = read_experiment_definition(FILENAME)
print experiments
for experiment in experiments:
dash = ActivityStreamExperimentDashboard(
redash_client,
experiment["name"],
experiment["variant"]["experiment_variant_slug"],
experiment["addon_versions"],
format_date(experiment["start_date"]),
)

dash.add_event_graphs(dash.DEFAULT_EVENTS)
dash.add_event_graphs(
dash.MASGA_EVENTS, events_table="activity_stream_masga")
dash.add_events_per_user(dash.DEFAULT_EVENTS)
dash.add_ttable()
dash.update_refresh_schedule(43200)

0 comments on commit b1ff05c

Please sign in to comment.