def _load_checkpoints(self, checkpointDirs):
memo_lookup_table = {}<EOL>for checkpoint_dir in checkpointDirs:<EOL><INDENT>logger.info("<STR_LIT>".format(checkpoint_dir))<EOL>checkpoint_file = os.path.join(checkpoint_dir, '<STR_LIT>')<EOL>try:<EOL><INDENT>with open(checkpoint_file, '<STR_LIT:rb>') as f:<EOL><INDENT>while True:<EOL><INDENT>try:<EOL><INDENT>data = pickle.load(f)<EOL>memo_fu = Future()<EOL>if data['<STR_LIT>']:<EOL><INDENT>memo_fu.set_exception(data['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>memo_fu.set_result(data['<STR_LIT:result>'])<EOL><DEDENT>memo_lookup_table[data['<STR_LIT>']] = memo_fu<EOL><DEDENT>except EOFError:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT><DEDENT>except FileNotFoundError:<EOL><INDENT>reason = "<STR_LIT>".format(<EOL>checkpoint_file)<EOL>logger.error(reason)<EOL>raise BadCheckpoint(reason)<EOL><DEDENT>except Exception:<EOL><INDENT>reason = "<STR_LIT>".format(<EOL>checkpoint_file)<EOL>logger.error(reason)<EOL>raise BadCheckpoint(reason)<EOL><DEDENT>logger.info("<STR_LIT>".format(checkpoint_file,<EOL>len(memo_lookup_table.keys())))<EOL><DEDENT>return memo_lookup_table<EOL>
Load a checkpoint file into a lookup table.

        The data being loaded from the pickle file mostly contains input
        attributes of the task: func, args, kwargs, env...
        To simplify the check of whether the exact task has been completed
        in the checkpoint, we hash these input params and use it as the key
        for the memoized lookup table.

        Args:
            - checkpointDirs (list) : List of filepaths to checkpoints
              Eg. ['runinfo/001', 'runinfo/002']

        Returns:
            - memoized_lookup_table (dict)