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

Side by Side Diff: testing/legion/rpc_methods.py

Issue 985503004: Removing the implicit delete from Terminate and Kill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """Defines the task RPC methods.""" 5 """Defines the task RPC methods."""
6 6
7 import os 7 import os
8 import sys 8 import sys
9 import logging 9 import logging
10 import threading 10 import threading
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if pipe == 'stdout': 78 if pipe == 'stdout':
79 self.stdout += data 79 self.stdout += data
80 else: 80 else:
81 self.stderr += data 81 self.stderr += data
82 82
83 @classmethod 83 @classmethod
84 def Popen(cls, cmd): 84 def Popen(cls, cmd):
85 with cls._creation_lock: 85 with cls._creation_lock:
86 key = 'Process%d' % cls._process_next_id 86 key = 'Process%d' % cls._process_next_id
87 cls._process_next_id += 1 87 cls._process_next_id += 1
88 logging.debug('Creating process %s', key) 88 logging.debug('Creating process %r', key)
89 process = cls(cmd) 89 process = cls(cmd)
90 cls._processes[key] = process 90 cls._processes[key] = process
91 return key 91 return key
92 92
93 @classmethod 93 @classmethod
94 def Terminate(cls, key): 94 def Terminate(cls, key):
95 logging.debug('Terminating and deleting process %s', key) 95 logging.debug('Terminating process %s', key)
96 return cls._processes.pop(key).proc.terminate() 96 return cls._processes[key].proc.terminate()
97 97
98 @classmethod 98 @classmethod
99 def Kill(cls, key): 99 def Kill(cls, key):
100 logging.debug('Killing and deleting process %s', key) 100 logging.debug('Killing process %s', key)
101 return cls._processes.pop(key).proc.kill() 101 return cls._processes[key].proc.kill()
102 102
103 @classmethod 103 @classmethod
104 def Delete(cls, key): 104 def Delete(cls, key):
105 logging.debug('Deleting process %s', key) 105 logging.debug('Deleting process %s', key)
106 cls._processes.pop(key) 106 cls._processes.pop(key)
107 107
108 @classmethod 108 @classmethod
109 def GetReturncode(cls, key): 109 def GetReturncode(cls, key):
110 return cls._processes[key].proc.returncode 110 return cls._processes[key].proc.returncode
111 111
(...skipping 30 matching lines...) Expand all
142 def Wait(cls, key): 142 def Wait(cls, key):
143 return cls._processes[key].proc.wait() 143 return cls._processes[key].proc.wait()
144 144
145 @classmethod 145 @classmethod
146 def Poll(cls, key): 146 def Poll(cls, key):
147 return cls._processes[key].proc.poll() 147 return cls._processes[key].proc.poll()
148 148
149 @classmethod 149 @classmethod
150 def GetPid(cls, key): 150 def GetPid(cls, key):
151 return cls._processes[key].proc.pid 151 return cls._processes[key].proc.pid
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698