original_docstring: Check total memory from within a docker container
docstring: Check total memory from within a docker container
docstring_tokens: Check total memory from within a docker container
code: def check_memory(image):
      """Check total memory from within a docker container"""
      ret = subprocess.run(['docker', 'run', '--rm', '--entrypoint=free',
                            image, '-m'],
                           stdout=subprocess.PIPE)
      if ret.returncode:
          return -1
  
      mem = [line.decode().split()[1]
             for line in ret.stdout.splitlines()
             if line.startswith(b'Mem:')][0]
      return int(mem)
code_tokens: def check_memory ( image ) : ret = subprocess . run ( [ 'docker' , 'run' , '--rm' , '--entrypoint=free' , image , '-m' ] , stdout = subprocess . PIPE ) if ret . returncode : return - 1 mem = [ line . decode ( ) . split ( ) [ 1 ] for line in ret . stdout . splitlines ( ) if line . startswith ( b'Mem:' ) ] [ 0 ] return int ( mem )
short_docstring: Check total memory from within a docker container
short_docstring_tokens: Check total memory from within a docker container
comment: """Check total memory from within a docker container"""