@@ -149,6 +149,75 @@ def drop_tables(ensemble, table_names):
149149 for table_name in table_names :
150150 r .drop_table (table_name )
151151
152+ def output_logs_detached (docker_containers , path = "/src/tmp" ):
153+ if not os .path .exists (path ):
154+ os .makedirs (path )
155+ for container in docker_containers :
156+ outfile = '%s/%s.out' % (path , container .name )
157+ f = open (outfile , 'wb' )
158+ # make a stream of output logs to iterate and write to file
159+ # (uses less memory than storing the container log as a string),
160+ # and don't keep the stream open for new logs, since we want
161+ # to get thru outputting whatever we got for this container
162+ # before doing same for next container.
163+ for line in container .logs (stream = True , follow = False ):
164+ f .write (line )
165+ f .close ()
166+
167+ def output_zk_detached (ensemble , path = "/src/tmp" ):
168+ if not os .path .exists (path ):
169+ os .makedirs (path )
170+ zk_client = get_zookeeper_client (ensemble )
171+ zk_table_configs = [
172+ ZkTableConfiguration (
173+ outfile = "config.out" ,
174+ zk_path = "/zookeeper/config" ,
175+ proto = "string" ,
176+ is_leaf = True ),
177+ ZkTableConfiguration (
178+ outfile = "quota.out" ,
179+ zk_path = "/zookeeper/quota" ,
180+ proto = "string" ,
181+ is_leaf = True ),
182+ ZkTableConfiguration (
183+ outfile = "coordinatorClusterClock.out" ,
184+ zk_path = "/ramcloud/main/coordinatorClusterClock" ,
185+ proto = CoordinatorClusterClock_pb2 .CoordinatorClusterClock (),
186+ is_leaf = True ),
187+ ZkTableConfiguration (
188+ outfile = "tables.out" ,
189+ zk_path = "/ramcloud/main/tables" ,
190+ proto = Table_pb2 .Table (),
191+ is_leaf = False ),
192+ ZkTableConfiguration (
193+ outfile = "tableManager.out" ,
194+ zk_path = "/ramcloud/main/tableManager" ,
195+ proto = TableManager_pb2 .TableManager (),
196+ is_leaf = True ),
197+ ZkTableConfiguration (
198+ outfile = "coordinator.out" ,
199+ zk_path = "/ramcloud/main/coordinator" ,
200+ proto = "string" ,
201+ is_leaf = True ),
202+ ZkTableConfiguration (
203+ outfile = "servers.out" ,
204+ zk_path = "/ramcloud/main/servers" ,
205+ proto = ServerListEntry_pb2 .ServerListEntry (),
206+ is_leaf = False ),
207+ ZkTableConfiguration (
208+ outfile = "coordinatorUpdateManager.out" ,
209+ zk_path = "/ramcloud/main/coordinatorUpdateManager" ,
210+ proto = CoordinatorUpdateInfo_pb2 .CoordinatorUpdateInfo (),
211+ is_leaf = True ),
212+ ZkTableConfiguration (
213+ outfile = "clientLeaseAuthority.out" ,
214+ zk_path = "/ramcloud/main/clientLeaseAuthority" ,
215+ proto = "string" ,
216+ is_leaf = False ),
217+ ]
218+ for zk_table_config in zk_table_configs :
219+ zk_table_config .dump (path , zk_client )
220+
152221# ClusterTest Usage in Python interpreter:
153222# >>> import cluster_test_utils as ctu
154223# >>> x = ctu.ClusterTest()
0 commit comments