mirror of
https://github.com/clearml/clearml
synced 2025-02-07 13:23:40 +00:00
Add jupyter notebook preview update time stamp
This commit is contained in:
parent
8c309afef4
commit
8417e4f7a0
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
from datetime import datetime
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from tempfile import mkstemp, gettempdir
|
from tempfile import mkstemp, gettempdir
|
||||||
|
|
||||||
@ -377,13 +378,17 @@ class _JupyterObserver(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# get notebook python script
|
# get notebook python script
|
||||||
if script_code is None:
|
if script_code is None and local_jupyter_filename:
|
||||||
script_code, _ = _script_exporter.from_filename(local_jupyter_filename)
|
script_code, _ = _script_exporter.from_filename(local_jupyter_filename)
|
||||||
if cls._store_notebook_artifact:
|
if cls._store_notebook_artifact:
|
||||||
# also upload the jupyter notebook as artifact
|
# also upload the jupyter notebook as artifact
|
||||||
task.upload_artifact(
|
task.upload_artifact(
|
||||||
name='notebook', artifact_object=Path(local_jupyter_filename),
|
name='notebook',
|
||||||
preview='No preview available')
|
artifact_object=Path(local_jupyter_filename),
|
||||||
|
preview='See `notebook preview` artifact',
|
||||||
|
metadata={'UPDATE': datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')},
|
||||||
|
wait_on_upload=True,
|
||||||
|
)
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
from nbconvert.exporters import HTMLExporter # noqa
|
from nbconvert.exporters import HTMLExporter # noqa
|
||||||
@ -393,7 +398,11 @@ class _JupyterObserver(object):
|
|||||||
f.write(html)
|
f.write(html)
|
||||||
task.upload_artifact(
|
task.upload_artifact(
|
||||||
name='notebook preview', artifact_object=local_html,
|
name='notebook preview', artifact_object=local_html,
|
||||||
preview=' ', delete_after_upload=True)
|
preview='Click `FILE PATH` link',
|
||||||
|
metadata={'UPDATE': datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')},
|
||||||
|
delete_after_upload=True,
|
||||||
|
wait_on_upload=True,
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user