<s> import docker <EOL> '''<STR_LIT>''' <EOL> class BasicContainer ( object ) : <EOL> def __init__ ( self ) : <EOL> self . client = self . create_docker_client ( ) <EOL> self . image = "<STR_LIT>" <EOL> self . command = "<STR_LIT>" <EOL> self . file_extension = "<STR_LIT>" <EOL> '''<STR_LIT>''' <EOL> def create_docker_client ( self ) : <EOL> client = docker . Client ( base_url = "<STR_LIT>" , <EOL> version = "<STR_LIT>" ) <EOL> return client <EOL> '''<STR_LIT>''' <EOL> def create_lambda_container ( self , user_file_path , container_memory = "<STR_LIT>" , container_cpu_shares = <NUM_LIT> ) : <EOL> tmp_path = "<STR_LIT>" <EOL> container = self . client . create_container ( image = self . image , <EOL> command = self . command , <EOL> volumes = [ tmp_path ] , <EOL> working_dir = tmp_path , <EOL> host_config = self . client . create_host_config ( <EOL> binds = { <EOL> user_file_path : { <EOL> "<STR_LIT>" : tmp_path , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> } , <EOL> } , <EOL> mem_limit = container_memory , <EOL> ) , <EOL> cpu_shares = container_cpu_shares , <EOL> ) <EOL> return container <EOL> '''<STR_LIT>''' <EOL> def start_lambda_container ( self , container ) : <EOL> container_id = container . get ( "<STR_LIT>" ) <EOL> print ( container_id ) <EOL> self . client . start ( container_id ) <EOL> '''<STR_LIT>''' <EOL> def get_container_log ( self , container ) : <EOL> container_id = container . get ( "<STR_LIT>" ) <EOL> log = self . client . logs ( container_id ) <EOL> return log </s>
