Returns true if all the bytes of the path are cached, false otherwise
(path)
| 300 | |
| 301 | |
| 302 | def is_path_fully_cached(path): |
| 303 | """Returns true if all the bytes of the path are cached, false otherwise""" |
| 304 | rc, stdout, stderr = exec_process( |
| 305 | "hdfs cacheadmin -listDirectives -stats -path %s" % path) |
| 306 | assert rc == 0 |
| 307 | caching_stats = stdout.strip("\n").split("\n")[-1].split() |
| 308 | # Compare BYTES_NEEDED and BYTES_CACHED, the output format is as follows |
| 309 | # "ID POOL REPL EXPIRY PATH BYTES_NEEDED BYTES_CACHED FILES_NEEDED FILES_CACHED" |
| 310 | return len(caching_stats) > 0 and caching_stats[5] == caching_stats[6] |
| 311 | |
| 312 | |
| 313 | def get_cache_directive_for_path(path): |
no test coverage detected