Exemplo n.º 1
0
def add_start_date_comment_task(experiment_id):
    experiment = Experiment.objects.get(id=experiment_id)
    metrics.incr("add_start_data_comment.started")
    logger.info("Adding Bugzilla Start Date Comment")
    comment = "Start Date: {} End Date: {}".format(experiment.start_date,
                                                   experiment.end_date)
    try:
        bugzilla_id = experiment.bugzilla_id
        bugzilla.add_experiment_comment(bugzilla_id, comment)
        logger.info("Bugzilla Comment Added")
        metrics.incr("add_start_date_comment.completed")
    except bugzilla.BugzillaError as e:
        logger.info("Comment start date failed to be added")
        metrics.incr("add_start_date_comment.failed")
        raise e
Exemplo n.º 2
0
def update_ds_bug_task(experiment_id):
    metrics.incr("update_ds_bug.started")
    experiment = Experiment.objects.get(id=experiment_id)
    ds_bug_url = experiment.data_science_bugzilla_url
    ds_bug_id = bugzilla.get_bugzilla_id(ds_bug_url)
    comment = """[Experiment]{name} status has been changed to: {status}
            url:{url}"""
    comment = comment.format(
        name=experiment.name, status=experiment.status, url=experiment.experiment_url
    )
    try:
        logger.info("adding comment to ds bug")
        bugzilla.add_experiment_comment(ds_bug_id, comment)
        metrics.incr("update_ds_bug.completed")
        logger.info("Data Science Bug status comment sent")
    except bugzilla.BugzillaError as e:
        metrics.incr("update_ds_bug.failed")
        logger.info("Failed to add a status comment to db bugzilla ticket")
        raise e
Exemplo n.º 3
0
    def test_add_bugzilla_comment_pref_experiment(self):
        experiment = ExperimentFactory.create_with_status(
            Experiment.STATUS_DRAFT,
            name="An Experiment",
            bugzilla_id="123",
            type=Experiment.TYPE_PREF,
        )
        comment = "Start Date: {} End Date: {}".format(experiment.start_date,
                                                       experiment.end_date)

        comment_id = add_experiment_comment(experiment.bugzilla_id, comment)

        self.assertEqual(comment_id, self.bugzilla_id)

        self.mock_bugzilla_requests_post.assert_called_with(
            settings.BUGZILLA_COMMENT_URL.format(id=experiment.bugzilla_id),
            {"comment": comment},
        )