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

Side by Side Diff: appengine/swarming/swarming_bot/bot_code/bot_main.py

Issue 2705273003: Roll infra_libs and gae_ts_mon in luci-py, and add field_specs to all metrics (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « appengine/machine_provider/metrics.py ('k') | appengine/swarming/ts_mon_metrics.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The LUCI Authors. All rights reserved. 1 # Copyright 2013 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Swarming bot main process. 5 """Swarming bot main process.
6 6
7 This is the program that communicates with the Swarming server, ensures the code 7 This is the program that communicates with the Swarming server, ensures the code
8 is always up to date and executes a child process to run tasks and upload 8 is always up to date and executes a child process to run tasks and upload
9 results back. 9 results back.
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 }, 102 },
103 } 103 }
104 104
105 ### Monitoring 105 ### Monitoring
106 106
107 107
108 _bucketer = ts_mon.GeometricBucketer(growth_factor=10**0.07, 108 _bucketer = ts_mon.GeometricBucketer(growth_factor=10**0.07,
109 num_finite_buckets=100) 109 num_finite_buckets=100)
110 110
111 hooks_durations = ts_mon.CumulativeDistributionMetric( 111 hooks_durations = ts_mon.CumulativeDistributionMetric(
112 'swarming/bots/hooks/durations', bucketer=_bucketer, 112 'swarming/bots/hooks/durations',
113 description='Duration of bot hook calls in ms', 113 'Duration of bot hook calls in ms', [
114 ts_mon.StringField('hookname'),
115 ts_mon.StringField('pool'),
116 ],
117 bucketer=_bucketer,
114 units=ts_mon.MetricsDataUnits.MILLISECONDS) 118 units=ts_mon.MetricsDataUnits.MILLISECONDS)
115 119
116 120
117 def _flatten_dimensions(dimensions): 121 def _flatten_dimensions(dimensions):
118 """Return a canonical string of flattened dimensions.""" 122 """Return a canonical string of flattened dimensions."""
119 iterables = (['%s:%s' % (key, x) for x in values] 123 iterables = (['%s:%s' % (key, x) for x in values]
120 for key, values in dimensions.iteritems() 124 for key, values in dimensions.iteritems()
121 if key not in ('android_devices', 'id')) 125 if key not in ('android_devices', 'id'))
122 return '|'.join(sorted(itertools.chain(*iterables))) 126 return '|'.join(sorted(itertools.chain(*iterables)))
123 127
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 error = None 1220 error = None
1217 if len(args.unsupported) != 0: 1221 if len(args.unsupported) != 0:
1218 error = 'Unexpected arguments: %s' % args 1222 error = 'Unexpected arguments: %s' % args
1219 try: 1223 try:
1220 return _run_bot(error) 1224 return _run_bot(error)
1221 finally: 1225 finally:
1222 _call_hook_safe( 1226 _call_hook_safe(
1223 True, bot.Bot(None, None, None, None, base_dir, None), 1227 True, bot.Bot(None, None, None, None, base_dir, None),
1224 'on_bot_shutdown') 1228 'on_bot_shutdown')
1225 logging.info('main() returning') 1229 logging.info('main() returning')
OLDNEW
« no previous file with comments | « appengine/machine_provider/metrics.py ('k') | appengine/swarming/ts_mon_metrics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698