mirror of
https://github.com/clearml/clearml
synced 2025-04-27 09:49:14 +00:00
Fix Jupyter Notebook inside VSCode
This commit is contained in:
parent
65b838f409
commit
91ff64b1f6
@ -590,7 +590,7 @@ class ScriptInfo(object):
|
|||||||
script_entry_point += '.py'
|
script_entry_point += '.py'
|
||||||
local_ipynb_file = None
|
local_ipynb_file = None
|
||||||
else:
|
else:
|
||||||
# always slash, because this is from uri (so never backslash not even oon windows)
|
# always slash, because this is from uri (so never backslash not even on windows)
|
||||||
entry_point_filename = notebook_path.split('/')[-1]
|
entry_point_filename = notebook_path.split('/')[-1]
|
||||||
|
|
||||||
# now we should try to find the actual file
|
# now we should try to find the actual file
|
||||||
@ -598,6 +598,22 @@ class ScriptInfo(object):
|
|||||||
if not entry_point.is_file():
|
if not entry_point.is_file():
|
||||||
entry_point = (Path.cwd() / notebook_path).absolute()
|
entry_point = (Path.cwd() / notebook_path).absolute()
|
||||||
|
|
||||||
|
# fix for VSCode pushing uuid at the end of the notebook name.
|
||||||
|
if not entry_point.exists():
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
|
alternative_entry_point = '-'.join(entry_point_filename.split('-')[:-5])+'.ipynb'
|
||||||
|
# now we should try to find the actual file
|
||||||
|
entry_point_alternative = (Path.cwd() / alternative_entry_point).absolute()
|
||||||
|
if not entry_point_alternative.is_file():
|
||||||
|
entry_point_alternative = (Path.cwd() / alternative_entry_point).absolute()
|
||||||
|
|
||||||
|
# If we found it replace it
|
||||||
|
if entry_point_alternative.exists():
|
||||||
|
entry_point = entry_point_alternative
|
||||||
|
except Exception as ex:
|
||||||
|
_logger.warning('Failed accessing jupyter notebook {}: {}'.format(notebook_path, ex))
|
||||||
|
|
||||||
# get local ipynb for observer
|
# get local ipynb for observer
|
||||||
local_ipynb_file = entry_point.as_posix()
|
local_ipynb_file = entry_point.as_posix()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user