1# Copyright 2016 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5from __future__ import print_function 6from __future__ import division 7from __future__ import absolute_import 8 9import logging 10import webapp2 11 12from dashboard.pinpoint.models import job as job_module 13from dashboard.pinpoint.models import task as task_module 14from dashboard.pinpoint.models import event as event_module 15from dashboard.pinpoint.models.tasks import evaluator 16 17 18class Run(webapp2.RequestHandler): 19 """Handler that runs a Pinpoint job.""" 20 21 def post(self, job_id): 22 job = job_module.JobFromId(job_id) 23 if job.use_execution_engine: 24 event = event_module.Event(type='initiate', target_task=None, payload={}) 25 logging.info('Execution Engine: Evaluating initiate event.') 26 task_module.Evaluate(job, event, evaluator.ExecutionEngine(job)) 27 logging.info('Execution Engine: Evaluation done.') 28 else: 29 job.Run() 30