def create_python_container(test_case, cluster, parameters, script, cleanup=True, additional_arguments=()):
 parameters = parameters.copy()
 parameters[u'image'] = u'python:2.7-slim'
 parameters[u'command_line'] = ([u'python2.7', u'-c', script.getContent().decode('ascii')] + list(additional_arguments))
 if (u'restart_policy' not in parameters):
  parameters[u'restart_policy'] = {u'name': u'never'}
 if (u'name' not in parameters):
  parameters[u'name'] = random_name(test_case)
 creating = cluster.create_container(parameters)
 def created(response):
  if cleanup:
   test_case.addCleanup(cluster.remove_container, parameters[u'name'])
  test_case.assertEqual(response, parameters)
  return response
 creating.addCallback(created)
 return creating

def create_python_container ( test_case , cluster , parameters , script , cleanup = True , additional_arguments = ( ) ) : parameters = parameters . copy ( ) parameters [ u'image' ] = u'python:2.7-slim' parameters [ u'command_line' ] = ( [ u'python2.7' , u'-c' , script . getContent ( ) . decode ( 'ascii' ) ] + list ( additional_arguments ) ) if ( u'restart_policy' not in parameters ) : parameters [ u'restart_policy' ] = { u'name' : u'never' } if ( u'name' not in parameters ) : parameters [ u'name' ] = random_name ( test_case ) creating = cluster . create_container ( parameters ) def created ( response ) : if cleanup : test_case . addCleanup ( cluster . remove_container , parameters [ u'name' ] ) test_case . assertEqual ( response , parameters ) return response creating . addCallback ( created ) return creating
create a python container that runs a given script .