Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions jupyter-extension/jupyterlab_pachyderm/handlers.py
Expand Up @@ -269,8 +269,8 @@ class DatumDownloadHandler(BaseHandler):
@tornado.web.authenticated
async def put(self):
try:
self.datum_manager.download()
self.finish()
path = self.datum_manager.download()
self.finish(json.dumps({"path": path}))
except ValueError as e:
get_logger().error(f"Invalid datum download: {e}")
raise tornado.web.HTTPError(
Expand Down
1 change: 1 addition & 0 deletions jupyter-extension/jupyterlab_pachyderm/pfs_manager.py
Expand Up @@ -650,6 +650,7 @@ def download(self):

shutil.rmtree(self._download_dir, ignore_errors=True)
self._download_dir = download_dir
return PFS_MOUNT_DIR
except Exception as e:
shutil.rmtree(download_dir, ignore_errors=True)
raise e
Expand Down
Expand Up @@ -8,6 +8,7 @@ import {requestAPI} from '../../../../../handler';
import {
CrossInputSpec,
CurrentDatumResponse,
DownloadPath,
ListMountsResponse,
MountDatumResponse,
PfsInput,
Expand Down Expand Up @@ -203,12 +204,13 @@ export const useDatum = (

try {
// TODO: receiving a 500 response shows success message
const res = await requestAPI<any>('datums/_download', 'PUT');
const res = await requestAPI<DownloadPath>('datums/_download', 'PUT');
console.log('setting message');
setErrorMessage('Datum downloaded to ' + res.path);
} catch (e) {
setErrorMessage('Error downloading datum: ' + e);
console.log(e);
}
setErrorMessage('Datum downloaded to /pfs');
setLoading(false);
};

Expand Down
4 changes: 4 additions & 0 deletions jupyter-extension/src/plugins/mount/types.ts
Expand Up @@ -54,6 +54,10 @@ export type CurrentDatumResponse = {
all_datums_received: boolean;
};

export type DownloadPath = {
path: string;
};

export type MountDatumResponse = {
id: string;
idx: number;
Expand Down

0 comments on commit 48db8ad

Please sign in to comment.