The Assimilation Project  based on Assimilation version 1.1.7.1474836767
docker.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # vim: smartindent tabstop=4 shiftwidth=4 expandtab number colorcolumn=90
3 #
4 # This file is part of the Assimilation Project.
5 #
6 # Author: Alan Robertson <alanr@unix.sh>
7 # Copyright (C) 2014 - Assimilation Systems Limited
8 #
9 # Free support is available from the Assimilation Project community - http://assimproj.org
10 # Paid support is available from Assimilation Systems Limited
11 # - http://assimilationsystems.com
12 #
13 # The Assimilation software is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
17 #
18 # The Assimilation software is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/
25 #
26 #
27 '''
28 This file provides a basic set of classes to allow us to create a semi-realistic test
29 environment for testing the Assimilation project software. We use containers
30 (or potentially virtual machines) to run a CMA and a bunch of nanoprobes on a system.
31 
32 This file does everything to help us be able to manage these systems and the services
33 running on them - for the purpose of testing the Assimilation project.
34 '''
35 import tempfile, subprocess, sys, random, os, time
36 from logwatcher import LogWatcher
37 class TestSystem(object):
38  'This is the base class for managing test systems for testing the Assimilation code'
39  nameindex = 0
40  nameformat = '%s.%05d-%05d'
41  tmpprefix = ''
42  tmpbasedir = '/var/tmp/'
43  tmpsuffix = '.AssimTest'
44  tmpdir = None
45  NOTINIT = 0
46  RUNNING = 1
47  STOPPED = 2
48  ManagedSystems = {}
49 
50  def __init__(self, imagename, cmdargs=None):
51  'Constructor for Abstract class TestSystem'
52  self.name = TestSystem.nameformat % (self.__class__.__name__, os.getpid()
53  , TestSystem.nameindex)
54  TestSystem.nameindex += 1
55  if TestSystem.tmpdir is None:
56  TestSystem.tmpdir = tempfile.mkdtemp(TestSystem.tmpsuffix
57  , TestSystem.tmpprefix, TestSystem.tmpbasedir)
58  self.tmpfile = tempfile.mktemp('.testout', self.__class__.__name__, TestSystem.tmpdir)
59  self.cmdargs = cmdargs
60  self.imagename = imagename
61  self.status = TestSystem.NOTINIT
62  self.pid = None
63  self.hostname = None
64  self.ipaddr = None
65  TestSystem.ManagedSystems[self.name] = self
66 
67  @staticmethod
68  def find(name):
69  'Locate the named TestSystem'
70  return TestSystem.ManagedSystems[name]
71 
72  @staticmethod
73  def delete(name):
74  'Delete the named TestSystem'
75  del TestSystem.ManagedSystems[name]
76 
77  @staticmethod
78  def cleanupall():
79  'Clean up all our test systems, and all their temp files'
80  if TestSystem.tmpdir is None:
81  return
82  for mgdsys in TestSystem.ManagedSystems:
83  msys = TestSystem.ManagedSystems[mgdsys]
84  msys.stop()
85  TestSystem.ManagedSystems = {}
86  subprocess.call(('rm', '-fr', TestSystem.tmpdir))
87  TestSystem.tmpdir = None
88  #TestSystem.nameindex = 0
89 
90  def start(self):
91  'Unimplemented start action'
92  raise NotImplementedError("Abstract class - doesn't implement start")
93 
94  def stop(self):
95  'Unimplemented stop action'
96  raise NotImplementedError("Abstract class - doesn't implement stop")
97 
98  def destroy(self):
99  'Unimplemented destroy action'
100  raise NotImplementedError("Abstract class - doesn't implement destroy")
101 
102  def startservice(self, servicename, async=False):
103  'Unimplemented start service action'
104  raise NotImplementedError("Abstract class - doesn't implement startservice")
105 
106  def stopservice(self, servicename, async=False):
107  'Unimplemented stop service action'
108  raise NotImplementedError("Abstract class - doesn't implement stopservice")
109 
110 
112  'This class implements managing local Docker-based test systems'
113  dockercmd = '/usr/bin/docker'
114  servicecmd = '/usr/bin/service'
115  nsentercmd = '/usr/bin/nsenter'
116 
117  def __init__(self, imagename, cmdargs=None, dockerargs=None, cleanupwhendone=False):
118  'Constructor for DockerSystem class'
119  if dockerargs is None:
120  dockerargs = []
121  self.dockerargs = dockerargs
122  self.runningservices = []
123  self.hostname = 'unknown'
124  self.ipaddr = 'unknown'
125  self.pid = 'unknown'
126  self.debug = 0
127  self.cleanupwhendone = cleanupwhendone
128  TestSystem.__init__(self, imagename, cmdargs=cmdargs)
129 
130  def __del__(self):
131  "Invoke our destroy operation when we're deleted"
132  #self.destroy()
133 
134  @staticmethod
135  def run(*dockerargs):
136  'Runs the docker command given by dockerargs'
137  cmd = [DockerSystem.dockercmd,]
138  cmd.extend(dockerargs)
139  #print >> sys.stderr, 'RUNNING cmd:', cmd
140  rc = subprocess.check_call(cmd)
141  return rc == 0
142 
143 
144  def start(self):
145  'Start a docker instance'
146  if self.status == TestSystem.NOTINIT:
147  runargs = ['run', '--detach=true', '-v', '/dev/urandom:/dev/random', '--privileged'
148  , '--name=%s' % self.name]
149  if self.dockerargs is not None:
150  runargs.extend(self.dockerargs)
151  runargs.append(self.imagename)
152  if self.cmdargs is not None:
153  runargs.extend(self.cmdargs)
154  DockerSystem.run(*runargs)
155  self.status = TestSystem.RUNNING
156  fd = os.popen('%s %s %s %s %s'
157  % (DockerSystem.dockercmd , 'inspect', '--format', '{{.Config.Hostname}}', self.name))
158  self.hostname = fd.readline().rstrip()
159  fd.close()
160  fd = os.popen('%s %s %s %s %s'
161  % (DockerSystem.dockercmd , 'inspect', '--format', '{{.NetworkSettings.IPAddress}}'
162  , self.name))
163  self.ipaddr = fd.readline().rstrip()
164  fd.close()
165  self.pid = self._get_docker_pid()
166  elif self.status == TestSystem.STOPPED:
167  DockerSystem.run('start', self.name)
168  self.status = TestSystem.RUNNING
169  elif self.status == TestSystem.RUNNING:
170  self.stop()
171  self.start()
172 
173  def _get_docker_pid(self):
174  'Return the PID of a docker instance - retrying in case of error'
175  j=0
176  while j < 10:
177  fd = os.popen('%s %s %s %s %s'
178  % (DockerSystem.dockercmd , 'inspect', '--format', '{{.State.Pid}}', self.name))
179  line = fd.readline().rstrip()
180  pid = int(line)
181  fd.close()
182  if pid > 0:
183  return pid
184  print >> sys.stderr, ('.State.Pid is currently zero for instance %s/%s [%s]'
185  % (self.name, self.hostname, line))
186  time.sleep(.1)
187  j += 1
188  raise RuntimeError('.State.Pid is zero for instance %s/%s [%s]'
189  % (self.name, self.hostname, line))
190 
191  def stop(self):
192  'Stop a docker instance'
193  if self.status != TestSystem.RUNNING:
194  return
195  os.system("logger -s 'Running services in %s: %s'" % (self.name, str(self.runningservices)))
196  #self.runinimage(('/bin/echo', 'THIS IS', '/tmp/cores/*',), detached=False)
197  #DockerSystem.run('top', self.name)
198  DockerSystem.run('stop', self.name)
199  self.status = TestSystem.STOPPED
200  self.pid = None
201 
202  def destroy(self):
203  'Destroy a docker instance (after stopping it if necessary)'
204  if self.status == TestSystem.RUNNING:
205  os.system("logger -s 'Running services in %s: %s'"
206  % (self.name, str(self.runningservices)))
207  #self.runinimage(('/bin/echo', 'THIS IS', '/tmp/cores/*',), detached=False)
208  #DockerSystem.run('top', self.name)
209  DockerSystem.run('rm', '-f', self.name)
210  self.status = TestSystem.NOTINIT
211 
212 
213  def runinimage(self, cmdargs, detached=True):
214  'Runs the given command on our running docker image'
215  detached = detached
216  if self.status != TestSystem.RUNNING:
217  raise RuntimeError('Docker Container %s is not running - docker exec not possible'
218  % self.name)
219  #self.docker_nsenter(cmdargs, detached)
220  self.docker_exec(cmdargs, detached)
221 
222  def docker_nsenter(self, cmdargs, detached=True):
223  'Runs the given command on our running docker image using nseneter'
224  detached=detached
225  args = [DockerSystem.nsentercmd, '--target', str(self.pid), '--mount'
226  , '--uts', '--ipc', '--pid', '--net', '--']
227  args.extend(cmdargs)
228  #print >> sys.stderr, 'RUNNING nsenter cmd:', args
229  subprocess.check_call(args)
230 
231  def docker_exec(self, cmdargs, detached=True):
232  'Runs the given command on our running docker image using docker exec'
233  if self.status != TestSystem.RUNNING:
234  raise RuntimeError('Docker Container %s is not running - docker exec not possible'
235  % self.name)
236  if detached:
237  args = [DockerSystem.dockercmd, 'exec', '-d', str(self.name) ]
238  else:
239  args = [DockerSystem.dockercmd, 'exec', str(self.name) ]
240  args.extend(cmdargs)
241  print >> sys.stderr, ('%s: RUNNING docker exec cmd: %s'
242  % (time.asctime(), str(args)))
243  subprocess.check_call(args)
244 
245  def startservice(self, servicename, async=False):
246  'docker-exec-based start service action for docker'
247  if servicename in self.runningservices:
248  print >> sys.stderr, ('WARNING: Service %s already running in docker system %s'
249  % (servicename, self.name))
250  else:
251  self.runningservices.append(servicename)
252  if servicename == 'neo4j':
253  return self.startneo4j()
254  if async:
255  self.runinimage(('/bin/bash', '-c', '/etc/init.d/%s start &' % servicename,))
256  #self.runinimage(('/bin/bash', '-c', '/usr/sbin/service %s restart &' % servicename,))
257  else:
258  #self.runinimage(('/bin/bash', ('/etc/init.d/%s' % servicename), 'start',))
259  self.runinimage(('/etc/init.d/'+servicename, 'start'))
260  #self.runinimage(('/usr/sbin/service', servicename, 'restart'))
261 
262  def stopservice(self, servicename, async=False):
263  'docker-exec-based stop service action for docker'
264  if servicename in self.runningservices:
265  self.runningservices.remove(servicename)
266  else:
267  print >> sys.stderr, ('WARNING: Service %s not running in docker system %s'
268  % (servicename, self.name))
269  if servicename == 'neo4j':
270  return self.stopneo4j()
271  if async:
272  self.runinimage(('/bin/sh', '-c', '/etc/init.d/%s stop &' % servicename,))
273  else:
274  self.runinimage(('/etc/init.d/'+servicename, 'stop'))
275 
276  def startneo4j(self):
277  'Start Neo4j'
278  self.runinimage(('/bin/bash', '-c',
279  'NEO4J_CONF=/etc/neo4j /usr/share/neo4j/bin/neo4j start; '
280  'sleep 20'), detached=False)
281  def stopneo4j(self):
282  'Stop Neo4j'
283  self.runinimage(('/bin/bash', '-c',
284  'NEO4J_CONF=/etc/neo4j /usr/share/neo4j/bin/neo4j stop'),
285  detached=False)
286 
287 class SystemTestEnvironment(object):
288  'A basic system test environment'
289  CMASERVICE = 'cma'
290  NANOSERVICE = 'nanoprobe'
291  NEO4JSERVICE = 'neo4j'
292  LOGGINGSERVICE = 'rsyslog'
293  NEO4JPASS='neo4j2'
294  NEO4JLOGIN='neo4j'
295  # pylint - too many arguments
296  # pylint: disable=R0913
297  def __init__(self, logname, nanocount=10
298  , cmaimage='assimilation/build-wily', nanoimages=('assimilation/build-wily',)
299  #, cmaimage='3f06b7c84030', nanoimages=('3f06b7c84030',)
300  , sysclass=DockerSystem, cleanupwhendone=False, nanodebug=0, cmadebug=0, chunksize=20):
301  'Init/constructor for our SystemTestEnvironment'
302  self.sysclass = sysclass
303  self.cmaimage = cmaimage
304  self.nanoimages = nanoimages
305  self.nanoprobes = []
306  self.cma = None
307  self.debug = 0
308  self.cleanupwhendone = cleanupwhendone
309  self.logname = logname
310  watch = LogWatcher(logname, [])
311  watch.setwatch()
312  nanodebug=1
313  cmadebug=2
314  self.nanodebug = nanodebug
315  self.cmadebug = nanodebug
316  self.spawncma(nanodebug=nanodebug, cmadebug=cmadebug)
317  regex = (' %s .* INFO: Neo4j version .* // py2neo version .*'
318  ' // Python version .* // (java|openjdk) version.*') % self.cma.hostname
319  watch.setregexes((regex,))
320  if watch.lookforall(timeout=60) is None:
321  print >> sys.stderr, 'CMA did not start!!'
322  raise RuntimeError('CMA did not start')
323  print >> sys.stderr, 'nanocount is', nanocount
324  print >> sys.stderr, 'self.nanoimages is', self.nanoimages
325  # We do this in chunks to manage stress on our test environment
326  children_left = range(0, nanocount)
327  while (len(children_left) > 0):
328  self._create_nano_chunk(children_left[0:chunksize])
329  del children_left[0:chunksize]
330 
331  def _create_nano_chunk(self, childnos):
332  'Create a chunk of nanoprobes'
333  watch = LogWatcher(self.logname, [], debug=0)
334  watch.setwatch()
335  regexes = []
336  for childcount in childnos:
337  childcount = childcount # Make pylint happy...
338  nano = self.spawnnanoprobe(debug=self.nanodebug)
339  regexes .extend([
340  r' %s nanoprobe\[.*]: NOTICE: Connected to CMA. Happiness :-D'
341  % (nano.hostname),
342  r' %s cma INFO: Drone %s registered from address \[::ffff:%s]'
343  % (self.cma.hostname, nano.hostname, nano.ipaddr),
344  r' %s cma INFO: Processed u?n?changed tcpdiscovery'
345  r' JSON data from %s into graph.'
346  % (self.cma.hostname, nano.hostname),
347  ])
348  self.nanoprobes.append(nano)
349  print >> sys.stderr, len(regexes), 'NANOPROBE REGEXES ARE:', (regexes)
350  watch.setregexes(regexes)
351  if watch.lookforall(timeout=60) is None:
352  raise RuntimeError('Nanoprobes did not start - missing %s'
353  % (str(watch.unmatched)))
354 
355 
356  @staticmethod
357  def _waitforloadavg(maxloadavg, maxwait=30):
358  'Wait for the load average to drop below our maximum - not currently used...'
359  fd = open('/proc/loadavg', 'r')
360  for waittry in range(0, maxwait):
361  waittry = waittry # Make pylint happy
362  fd.seek(0)
363  loadavg = float(fd.readline().split(' ')[0])
364  if loadavg < maxloadavg:
365  break
366  time.sleep(1)
367  fd.close()
368 
369 
370 
371  def _spawnsystem(self, imagename):
372  'Spawn a system image'
373  while True:
374  try:
375  # Docker has a bug where it will screw up and give us
376  system = self.sysclass(imagename
377  , ('/bin/bash', '-c', 'while sleep 10; do wait -n; done'))
378  system.start()
379  break
380  except RuntimeError:
381  # So, let's try that again...
382  # This will leave some gaps in the system names, but we don't use them for anything.
383  print >> sys.stderr, ('Destroying system %s and trying again...' % (system.name))
384  system.destroy()
385  system = None
386 
387  system.runinimage(('/bin/bash', '-c', 'mkdir -p /tmp/cores'))
388  #system.runinimage(('/bin/bash', '-c'
389  #, 'echo "/tmp/cores/core.%e.%p" > /proc/sys/kernel/core_pattern'))
390  # Set up logging to be forwarded to our parent logger
391  system.runinimage(('/bin/bash', '-c'
392  , '''PARENT=$(/sbin/route | grep '^default' | cut -c17-32); PARENT=$(echo $PARENT);'''
393  + ''' echo '*.* @@'"${PARENT}:514" > /etc/rsyslog.d/99-remote.conf'''))
394  # And of course, start logging...
395  system.stopservice(SystemTestEnvironment.LOGGINGSERVICE)
396  system.startservice(SystemTestEnvironment.LOGGINGSERVICE)
397  system.startservice(SystemTestEnvironment.LOGGINGSERVICE)
398  return system
399 
400  def set_nanoconfig(self, nano, debug=0, tcpdump=False):
401  'Set up our nanoprobe configuration file'
402  lines = (
403  ('NANOPROBE_DYNAMIC=%d' % (1 if nano is self.cma else 0)),
404  ('NANOPROBE_DEBUG=%d' % (debug)),
405  ('NANOPROBE_CORELIMIT=unlimited'),
406  ('NANOPROBE_CMAADDR=%s:1984' % self.cma.ipaddr)
407  )
408 
409  if tcpdump:
410  nano.runinimage(('/bin/bash', '-c'
411  , 'nohup /usr/sbin/tcpdump -C 10 -U -s 1024 '
412  '-w /tmp/tcpdump udp port 1984>/dev/null 2>&1 &'))
413  print >> sys.stderr, ('NANOPROBE CONFIG [%s] %s' % (nano.hostname, nano.name))
414  for j in range(0, len(lines)):
415  nano.runinimage(('/bin/bash', '-c'
416  , "echo '%s' >>/etc/default/nanoprobe" % lines[j]))
417  #print >> sys.stderr, ('NANOPROBE [%s]' % lines[j])
418 
419  def set_cmaconfig(self, debug=0):
420  'Set up our CMA configuration file'
421  lines = ( ('CMA_DEBUG=%d' % (debug)),
422  ('CMA_CORELIMIT=unlimited'),
423  #('CMA_STRACEFILE=/tmp/cma.strace')
424  )
425  print >> sys.stderr, ('CMA CONFIG [%s]' % self.cma.hostname)
426  for j in range(0, len(lines)):
427  self.cma.runinimage(('/bin/bash', '-c'
428  , "echo '%s' >>/etc/default/cma" % lines[j]))
429  print >> sys.stderr, ('CMA [%s]' % lines[j])
430 
431  def fixneo4jpass(self):
432  'Fix up the neo4j password for our test copy of neo4j'
433  self.cma.runinimage(('assimcli', 'neo4jpass', self.NEO4JPASS), detached=False)
434  self.cma.runinimage(('cat', '/usr/share/assimilation/crypto.d/neo4j.creds'), detached=False)
435  self.cma.runinimage(('ls', '-al', '/usr/share/assimilation/crypto.d/'), detached=False)
436 
437  def spawncma(self, nanodebug=0, cmadebug=0):
438  'Spawn a CMA instance'
439  self.cma = self._spawnsystem(self.cmaimage)
440  self.cma.runinimage(('/bin/bash', '-c'
441  , 'echo "dbms.connector.http.address=0.0.0.0:7474"'
442  '>> /etc/neo4j/neo4j.conf'))
443  self.cma.runinimage(('/bin/rm', '-fr'
444  , '/usr/share/assimilation/crypto.d/#CMA#00001.secret'
445  , '/var/lib/neo4j/data/databases/graph.db'))
446  self.cma.startservice(SystemTestEnvironment.NEO4JSERVICE)
447  time.sleep(20)
448  self.fixneo4jpass()
449  self.set_cmaconfig(debug=cmadebug)
450  self.cma.startservice(SystemTestEnvironment.CMASERVICE)
451  self.set_nanoconfig(self.cma, debug=nanodebug)
452  self.cma.startservice(SystemTestEnvironment.NANOSERVICE)
453  return self.cma
454 
455  def spawnnanoprobe(self, debug=0):
456  'Spawn a nanoprobe instance randomly chosen from our set of possible nanoprobes'
457  image = random.choice(self.nanoimages)
458  system = self._spawnsystem(image)
459  system.debug = debug
460  self.set_nanoconfig(system, debug=debug)
461  system.startservice(SystemTestEnvironment.NANOSERVICE)
462  return system
463 
464  def up_nanoprobes(self):
465  'Return the set of nanoprobe systems which are currently running'
466  return [nano for nano in self.nanoprobes if nano.status == TestSystem.RUNNING]
467 
468  def down_nanoprobes(self):
469  'Return the set of nanoprobe systems which are currently down'
470  return [nano for nano in self.nanoprobes if nano.status != TestSystem.RUNNING]
471 
472  def select_nanoprobe(self, count=1):
473  'Select a system at random'
474  result = []
475  while len(self.nanoprobes) > 0:
476  nano = random.choice(self.nanoprobes)
477  if nano not in result:
478  result.append(nano)
479  if len(result) == count:
480  break
481  return result
482 
483  def select_up_nanoprobe(self, count=1):
484  'Select a nanoprobe system at random which is currently up'
485  result = []
486  uplist = self.up_nanoprobes()
487  while len(uplist) > 0:
488  nano = random.choice(uplist)
489  if nano not in result:
490  result.append(nano)
491  uplist.remove(nano)
492  if len(result) == count or len(uplist) == 0:
493  break
494  return result
495 
496  def select_down_nanoprobe(self, count=1):
497  'Select a nanoprobe system at random which is currently down'
498  result = []
499  downlist = self.down_nanoprobes()
500  while True:
501  nano = random.choice(downlist)
502  if nano not in result:
503  result.append(nano)
504  downlist.remove(nano)
505  if len(result) == count or len(downlist) == 0:
506  break
507  return result
508 
509  def select_nano_service(self, service=NANOSERVICE, count=1):
510  'Select a system currently running the given service'
511  result = []
512  servlist = [nano for nano in self.nanoprobes
513  if nano.status == TestSystem.RUNNING and service in nano.runningservices]
514  while len(servlist) > 0:
515  nano = random.choice(servlist)
516  if nano not in result:
517  result.append(nano)
518  servlist.remove(nano)
519  if len(result) == count or len(servlist) == 0:
520  break
521  return result
522 
523  def select_nano_noservice(self, service=NANOSERVICE, count=1):
524  'Select a system NOT currently running the given service'
525  result = []
526  servlist = [nano for nano in self.nanoprobes
527  if nano.status == TestSystem.RUNNING and service not in nano.runningservices]
528  while len(servlist) > 0:
529  nano = random.choice(servlist)
530  if nano not in result:
531  result.append(nano)
532  servlist.remove(nano)
533  if len(result) == count or len(servlist) == 0:
534  break
535  return result
536 
537 
538  def stop(self):
539  'Stop our entire SystemTestEnvironment'
540  for onenano in self.nanoprobes:
541  onenano.stop()
542  self.cma.stop()
543 
544  def __del__(self):
545  'Clean up any images we created'
546  if self.cleanupwhendone:
547  for nano in self.nanoprobes:
548  if nano.cleanupwhendone:
549  nano.destroy()
550  self.nanoprobes = []
551  if self.cma is not None:
552  if self.cma.cleanupwhendone:
553  self.cma.destroy()
554  self.cma = None
555 
556 
557 # A little test code...
558 if __name__ == '__main__':
559  def testmain(logname):
560  'A simple test main program'
561  print >> sys.stderr, 'Initializing:'
562  env = SystemTestEnvironment(logname, 3)
563  print >> sys.stderr, 'Systems all up and running!'
564  for j in range(0,len(env.nanoprobes)):
565  nano = env.nanoprobes[j]
566  print >> sys.stderr, 'Stopping nanoprobe on the %d one [%s]!' % (j, nano.name)
567  nano.stopservice(SystemTestEnvironment.NANOSERVICE)
568  env.stop()
569  env = None
570  print >> sys.stderr, 'All systems after deletion:', TestSystem.ManagedSystems
571  testmain('/var/log/syslog')
def startservice(self, servicename, async=False)
Definition: docker.py:102
def startneo4j(self)
Definition: docker.py:276
def select_nano_noservice(self, service=NANOSERVICE, count=1)
Definition: docker.py:523
def cleanupall()
Definition: docker.py:78
def docker_nsenter(self, cmdargs, detached=True)
Definition: docker.py:222
def __init__(self, logname, nanocount=10, cmaimage='assimilation/build-wily', nanoimages=('assimilation/build-wily',)#, cmaimage='3f06b7c84030', nanoimages=('3f06b7c84030',), sysclass=DockerSystem, cleanupwhendone=False, nanodebug=0, cmadebug=0, chunksize=20)
Definition: docker.py:300
def destroy(self)
Definition: docker.py:98
def run(dockerargs)
Definition: docker.py:135
def set_cmaconfig(self, debug=0)
Definition: docker.py:419
def __del__(self)
Definition: docker.py:130
def testmain(logname)
Definition: docker.py:559
def delete(name)
Definition: docker.py:73
def spawnnanoprobe(self, debug=0)
Definition: docker.py:455
def runinimage(self, cmdargs, detached=True)
Definition: docker.py:213
def start(self)
Definition: docker.py:144
def select_down_nanoprobe(self, count=1)
Definition: docker.py:496
def _spawnsystem(self, imagename)
Definition: docker.py:371
def stop(self)
Definition: docker.py:191
def _create_nano_chunk(self, childnos)
Definition: docker.py:331
def __init__(self, imagename, cmdargs=None)
Definition: docker.py:50
def docker_exec(self, cmdargs, detached=True)
Definition: docker.py:231
def select_nano_service(self, service=NANOSERVICE, count=1)
Definition: docker.py:509
def __init__(self, imagename, cmdargs=None, dockerargs=None, cleanupwhendone=False)
Definition: docker.py:117
def _get_docker_pid(self)
Definition: docker.py:173
def destroy(self)
Definition: docker.py:202
def stopservice(self, servicename, async=False)
Definition: docker.py:106
def stopservice(self, servicename, async=False)
Definition: docker.py:262
def set_nanoconfig(self, nano, debug=0, tcpdump=False)
Definition: docker.py:400
def startservice(self, servicename, async=False)
Definition: docker.py:245
def spawncma(self, nanodebug=0, cmadebug=0)
Definition: docker.py:437
def start(self)
Definition: docker.py:90
def stop(self)
Definition: docker.py:94
def select_up_nanoprobe(self, count=1)
Definition: docker.py:483
def find(name)
Definition: docker.py:68
def select_nanoprobe(self, count=1)
Definition: docker.py:472
def stopneo4j(self)
Definition: docker.py:281