chovanecm / sacredboard

Dashboard for sacred. Monitor and access your past machine learning experiments.
MIT License
184 stars 39 forks source link

[Feature Request] Ability to download/view artifacts #81

Closed tkallage closed 6 years ago

tkallage commented 6 years ago

It is possible to add artifacts to a sacred experiment. These are basically just files that are stored in GridFS inside the MongoDB. It would be nice, if these files are listed in the experiments overview page and you can download them. Even nicer would be a preview for image files, so that you can create your own plots and view them in sacredboard. I can provide a small script that downloads the artifacts and stores them on your computer, maybe this helps a bit. download_artifacts.py.tar.gz

chovanecm commented 6 years ago

I'm putting the feature request to the backlog

evolu8 commented 6 years ago

This feature is the breaking point for me I think.

If it were implemented I'd be advising my colleagues to use Sacred. Until then it's just not quite there.

I hope it's doable.

Great effort though!

verybadsoldier commented 6 years ago

In case you guys are still interested in this feature: I implemented a variant that allows viewing and downloading attached source files and also artifact files. If you don't mind then feel free to give it a try (feedback appreciated): https://github.com/verybadsoldier/sacredboard/tree/feature-download_files

Also covers #91

image

chovanecm commented 6 years ago

@verybadsoldier Wow, thank you! It looks really good (both the user interface and the code, where I am especially pleased that someone was able to understand my "architecture" :-) )

Just one note: I tried the Download all button for sources and got the following error

2018-08-23 08:41:44,599] ERROR in app: Exception on /api/sources/15 [GET]
Traceback (most recent call last):
  File "/home/martin/download-artifacts/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/martin/download-artifacts/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/martin/download-artifacts/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/martin/download-artifacts/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/home/martin/download-artifacts/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/martin/download-artifacts/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/martin/download-artifacts/lib/python3.6/site-packages/sacredboard/app/webapi/files.py", line 113, in api_sources
    return get_files_zip(run_id, _FileType.SOURCE)
  File "/home/martin/download-artifacts/lib/python3.6/site-packages/sacredboard/app/webapi/files.py", line 92, in get_files_zip
    fn_suffix = _filetype_suffices(filetype)
TypeError: 'dict' object is not callable
127.0.0.1 - - [2018-08-23 08:41:44] "GET /api/sources/15 HTTP/1.1" 500 412 0.011444

Are you sure you didn't want to use square brackets here?

verybadsoldier commented 6 years ago

Yes thats probably the error I would have expected to happen :/ Yes, they should be square brackets actually. I will later, sorry!

verybadsoldier commented 6 years ago

Fixed that, silly mistake :( I would be happy to submit a PR if you like this feature.

chovanecm commented 6 years ago

Sure, I would be more than happy to accept such PR, as I think the feature is both useful and usable.

My only concern would be whether the file names should really be stored using absolute paths. I had some troubles opening them under Windows (see the double backslash in the path). image

As a nice to have, the file could have its modification timestamp set correctly, but I think it's fine (unless someone needs it).

So after you create the PR, I will just go once more through the changes, add comments if something is unclear and we can release it soon. Thanks once again.

chovanecm commented 6 years ago

Available in the latest development version thanks to @verybadsoldier