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

Side by Side Diff: utils/threading_utils.py

Issue 25530003: Rename load_test to isolateserver_load_test, create swarming_load_test. (Closed) Base URL: https://chromium.googlesource.com/a/chromium/tools/swarm_client@2_exception
Patch Set: This CL will get in one way or another Created 7 years, 2 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 | « tools/swarming_load_test_client.py ('k') | no next file » | 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 Chromium Authors. All rights reserved. 1 # Copyright 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 """Classes and functions related to threading.""" 5 """Classes and functions related to threading."""
6 6
7 import functools 7 import functools
8 import inspect 8 import inspect
9 import logging 9 import logging
10 import os 10 import os
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 # Setting it to True forces a print on the first print_update() call. 416 # Setting it to True forces a print on the first print_update() call.
417 self._value_changed = True 417 self._value_changed = True
418 418
419 # To be used in all threads. 419 # To be used in all threads.
420 self._queued_updates = Queue.Queue() 420 self._queued_updates = Queue.Queue()
421 421
422 def update_item(self, name, raw=False, **kwargs): 422 def update_item(self, name, raw=False, **kwargs):
423 """Queue information to print out. 423 """Queue information to print out.
424 424
425 Arguments: 425 Arguments:
426 name: string to print out to describe something that was completed.
426 raw: if True, prints the data without the header. 427 raw: if True, prints the data without the header.
427 <name>: argument name is a name of a column. it's value is the increment 428 raw: if True, prints the data without the header.
428 to the column, value is usually 0 or 1. 429 <kwargs>: argument name is a name of a column. it's value is the increment
430 to the column, value is usually 0 or 1.
429 """ 431 """
430 assert isinstance(name, str) 432 assert isinstance(name, str)
431 assert isinstance(raw, bool) 433 assert isinstance(raw, bool)
432 assert all(isinstance(v, int) for v in kwargs.itervalues()) 434 assert all(isinstance(v, int) for v in kwargs.itervalues())
433 args = [(self._columns_lookup[k], v) for k, v in kwargs.iteritems() if v] 435 args = [(self._columns_lookup[k], v) for k, v in kwargs.iteritems() if v]
434 self._queued_updates.put((name, raw, args)) 436 self._queued_updates.put((name, raw, args))
435 437
436 def print_update(self): 438 def print_update(self):
437 """Prints the current status.""" 439 """Prints the current status."""
438 # Flush all the logging output so it doesn't appear within this output. 440 # Flush all the logging output so it doesn't appear within this output.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 # Multiprocessing 738 # Multiprocessing
737 import multiprocessing 739 import multiprocessing
738 return multiprocessing.cpu_count() 740 return multiprocessing.cpu_count()
739 except: # pylint: disable=W0702 741 except: # pylint: disable=W0702
740 try: 742 try:
741 # Mac OS 10.6 743 # Mac OS 10.6
742 return int(os.sysconf('SC_NPROCESSORS_ONLN')) # pylint: disable=E1101 744 return int(os.sysconf('SC_NPROCESSORS_ONLN')) # pylint: disable=E1101
743 except: 745 except:
744 # Some of the windows builders seem to get here. 746 # Some of the windows builders seem to get here.
745 return 4 747 return 4
OLDNEW
« no previous file with comments | « tools/swarming_load_test_client.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698