mirror of
https://github.com/clearml/clearml
synced 2025-05-29 17:48:33 +00:00
Support running jupyter notebook inside a git repo - repository referenced without uncommitted changes and jupyter notebook as code (uncommitted changes)
Add jupyter notebook fail warning
This commit is contained in:
parent
76939339c4
commit
a64b918c79
@ -703,6 +703,12 @@ class ScriptInfo(object):
|
|||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
cls._get_logger().warning('Failed accessing jupyter notebook {}: {}'.format(notebook_path, ex))
|
cls._get_logger().warning('Failed accessing jupyter notebook {}: {}'.format(notebook_path, ex))
|
||||||
|
|
||||||
|
# if we failed to get something we can access, print an error
|
||||||
|
if not entry_point.exists():
|
||||||
|
cls._get_logger().warning(
|
||||||
|
'Jupyter Notebook auto-logging failed, could not access: {}'.format(entry_point))
|
||||||
|
return 'error_notebook_not_found.py'
|
||||||
|
|
||||||
# get local ipynb for observer
|
# get local ipynb for observer
|
||||||
local_ipynb_file = entry_point.as_posix()
|
local_ipynb_file = entry_point.as_posix()
|
||||||
|
|
||||||
@ -828,10 +834,16 @@ class ScriptInfo(object):
|
|||||||
messages = []
|
messages = []
|
||||||
auxiliary_git_diff = None
|
auxiliary_git_diff = None
|
||||||
|
|
||||||
if not plugin:
|
# print logs
|
||||||
|
if jupyter_filepath:
|
||||||
|
if log:
|
||||||
|
log.info("Storing jupyter notebook directly as code")
|
||||||
|
elif not plugin:
|
||||||
if log:
|
if log:
|
||||||
log.info("No repository found, storing script code instead")
|
log.info("No repository found, storing script code instead")
|
||||||
else:
|
|
||||||
|
# if we found a vcs plugin use it
|
||||||
|
if plugin:
|
||||||
try:
|
try:
|
||||||
repo_info = plugin.get_info(
|
repo_info = plugin.get_info(
|
||||||
str(script_dir), include_diff=check_uncommitted, diff_from_remote=uncommitted_from_remote)
|
str(script_dir), include_diff=check_uncommitted, diff_from_remote=uncommitted_from_remote)
|
||||||
@ -855,8 +867,13 @@ class ScriptInfo(object):
|
|||||||
entry_point = cls._get_entry_point(repo_root, script_path)
|
entry_point = cls._get_entry_point(repo_root, script_path)
|
||||||
|
|
||||||
if check_uncommitted:
|
if check_uncommitted:
|
||||||
diff = cls._get_script_code(script_path.as_posix()) \
|
# if we have a jupyter notebook, always store the entire notebook (instead of the git diff)
|
||||||
if not plugin or not repo_info.commit else repo_info.diff
|
if jupyter_filepath:
|
||||||
|
diff = cls._get_script_code(script_path.as_posix())
|
||||||
|
else:
|
||||||
|
diff = cls._get_script_code(script_path.as_posix()) \
|
||||||
|
if not plugin or not repo_info.commit else repo_info.diff
|
||||||
|
|
||||||
# make sure diff is not too big:
|
# make sure diff is not too big:
|
||||||
if len(diff) > cls.max_diff_size_bytes:
|
if len(diff) > cls.max_diff_size_bytes:
|
||||||
messages.append(
|
messages.append(
|
||||||
@ -869,6 +886,7 @@ class ScriptInfo(object):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
diff = ''
|
diff = ''
|
||||||
|
|
||||||
# if this is not jupyter, get the requirements.txt
|
# if this is not jupyter, get the requirements.txt
|
||||||
requirements = ''
|
requirements = ''
|
||||||
conda_requirements = ''
|
conda_requirements = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user