Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: scripts/master/factory/annotator_factory.py

Issue 860383008: Made annotated_run look up recipe from builders.pyl masters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Master changes to support this Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Utility class to generate and manage a factory to be passed to a 5 """Utility class to generate and manage a factory to be passed to a
6 builder dictionary as the 'factory' member, for each builder in c['builders']. 6 builder dictionary as the 'factory' member, for each builder in c['builders'].
7 7
8 Specifically creates a basic factory that will execute an arbirary annotator 8 Specifically creates a basic factory that will execute an arbirary annotator
9 script. 9 script.
10 """ 10 """
11 11
12 from master.factory import annotator_commands 12 from master.factory import annotator_commands
13 from master.factory import commands 13 from master.factory import commands
14 from master.factory.build_factory import BuildFactory 14 from master.factory.build_factory import BuildFactory
15 15
16 16
17 class AnnotatorFactory(object): 17 class AnnotatorFactory(object):
18 """Encapsulates data and methods common to all annotators.""" 18 """Encapsulates data and methods common to all annotators."""
19 19
20 def __init__(self): 20 def __init__(self):
21 self._factory_properties = None 21 self._factory_properties = None
22 22
23 def BaseFactory(self, recipe, factory_properties=None, triggers=None, 23 def BaseFactory(self, recipe, factory_properties=None, triggers=None,
iannucci 2015/02/03 23:23:18 let's make this =None
24 timeout=1200, max_time=None): 24 timeout=1200, max_time=None):
25 """The primary input for the factory is the |recipe|, which specifies the 25 """The primary input for the factory is the |recipe|, which specifies the
26 name of a recipe file to search for. The recipe file will fill in the rest 26 name of a recipe file to search for. The recipe file will fill in the rest
27 of the |factory_properties|. This setup allows for major changes to factory 27 of the |factory_properties|. This setup allows for major changes to factory
28 properties to occur on slave-side without master restarts. 28 properties to occur on slave-side without master restarts.
29 29
30 NOTE: Please be very discerning with what |factory_properties| you pass to 30 NOTE: Please be very discerning with what |factory_properties| you pass to
31 this method. Ideally, you will pass none, and that will be sufficient in the 31 this method. Ideally, you will pass none, and that will be sufficient in the
32 vast majority of cases. Think very carefully before adding any 32 vast majority of cases. Think very carefully before adding any
33 |factory_properties| here, as changing them will require a master restart. 33 |factory_properties| here, as changing them will require a master restart.
34 34
35 |timeout| refers to the maximum number of seconds a step should be allowed 35 |timeout| refers to the maximum number of seconds a step should be allowed
36 to run without output. After no output for |timeout| seconds, the step is 36 to run without output. After no output for |timeout| seconds, the step is
37 forcibly killed. 37 forcibly killed.
38 38
39 |max_time| refers to the maximum number of seconds a step should be allowed 39 |max_time| refers to the maximum number of seconds a step should be allowed
40 to run, regardless of output. After |max_time| seconds, the step is forcibly 40 to run, regardless of output. After |max_time| seconds, the step is forcibly
41 killed. 41 killed.
42 """ 42 """
43 factory_properties = factory_properties or {} 43 factory_properties = factory_properties or {}
44 factory_properties.update({'recipe': recipe}) 44 if recipe:
45 factory_properties.update({'recipe': recipe})
45 self._factory_properties = factory_properties 46 self._factory_properties = factory_properties
46 factory = BuildFactory() 47 factory = BuildFactory()
47 factory.properties.update(self._factory_properties, 'AnnotatorFactory') 48 factory.properties.update(self._factory_properties, 'AnnotatorFactory')
48 cmd_obj = annotator_commands.AnnotatorCommands(factory) 49 cmd_obj = annotator_commands.AnnotatorCommands(factory)
49 cmd_obj.AddAnnotatedScript( 50 cmd_obj.AddAnnotatedScript(
50 factory_properties, timeout=timeout, max_time=max_time) 51 factory_properties, timeout=timeout, max_time=max_time)
51 52
52 for t in triggers or []: 53 for t in triggers or []:
53 factory.addStep(commands.CreateTriggerStep( 54 factory.addStep(commands.CreateTriggerStep(
54 t, trigger_copy_properties=['swarm_hashes'])) 55 t, trigger_copy_properties=['swarm_hashes']))
55 56
56 return factory 57 return factory
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698