def get_file_checkpoint(self, checkpoint_id, path):
"""Get the content of a checkpoint for a non-notebook file.
Returns a dict of the form:
{
"type": "file",
"content": <str>,
"format": {"text","base64"},
}
"""
self.log.info("restoring %s from checkpoint %s", path, checkpoint_id)
cp = self._get_checkpoint_path(checkpoint_id, path)
exists, blob = self.parent._fetch(cp)
if not exists:
raise web.HTTPError(404, u"No such checkpoint: %s for %s" % (
checkpoint_id, path))
content, fmt = self.parent._read_file(blob, None)
return {
"type": "file",
"content": content,
"format": fmt
}
评论列表
文章目录