mirror of
https://github.com/clearml/clearml
synced 2025-01-31 09:07:00 +00:00
Fix limit git diff to 500kb
This commit is contained in:
parent
6129e09b50
commit
87f7b5d50f
@ -405,6 +405,7 @@ class _JupyterObserver(object):
|
|||||||
|
|
||||||
|
|
||||||
class ScriptInfo(object):
|
class ScriptInfo(object):
|
||||||
|
max_diff_size_bytes = 500000
|
||||||
|
|
||||||
plugins = [GitEnvDetector(), HgEnvDetector(), HgDetector(), GitDetector()]
|
plugins = [GitEnvDetector(), HgEnvDetector(), HgDetector(), GitDetector()]
|
||||||
""" Script info detection plugins, in order of priority """
|
""" Script info detection plugins, in order of priority """
|
||||||
@ -590,6 +591,8 @@ class ScriptInfo(object):
|
|||||||
repo_info = DetectionResult()
|
repo_info = DetectionResult()
|
||||||
script_dir = scripts_dir[0]
|
script_dir = scripts_dir[0]
|
||||||
script_path = scripts_path[0]
|
script_path = scripts_path[0]
|
||||||
|
messages = []
|
||||||
|
|
||||||
if not plugin:
|
if not plugin:
|
||||||
log.info("No repository found, storing script code instead")
|
log.info("No repository found, storing script code instead")
|
||||||
else:
|
else:
|
||||||
@ -617,6 +620,13 @@ class ScriptInfo(object):
|
|||||||
if check_uncommitted:
|
if check_uncommitted:
|
||||||
diff = cls._get_script_code(script_path.as_posix()) \
|
diff = cls._get_script_code(script_path.as_posix()) \
|
||||||
if not plugin or not repo_info.commit else repo_info.diff
|
if not plugin or not repo_info.commit else repo_info.diff
|
||||||
|
# make sure diff is not too big:
|
||||||
|
if len(diff) > cls.max_diff_size_bytes:
|
||||||
|
messages.append(
|
||||||
|
"======> WARNING! Git diff to large to store "
|
||||||
|
"({}kb), skipping uncommitted changes <======".format(len(diff)//1024))
|
||||||
|
diff = ''
|
||||||
|
|
||||||
else:
|
else:
|
||||||
diff = ''
|
diff = ''
|
||||||
# if this is not jupyter, get the requirements.txt
|
# if this is not jupyter, get the requirements.txt
|
||||||
@ -645,7 +655,6 @@ class ScriptInfo(object):
|
|||||||
jupyter_filepath=jupyter_filepath,
|
jupyter_filepath=jupyter_filepath,
|
||||||
)
|
)
|
||||||
|
|
||||||
messages = []
|
|
||||||
if repo_info.modified:
|
if repo_info.modified:
|
||||||
messages.append(
|
messages.append(
|
||||||
"======> WARNING! UNCOMMITTED CHANGES IN REPOSITORY {} <======".format(
|
"======> WARNING! UNCOMMITTED CHANGES IN REPOSITORY {} <======".format(
|
||||||
|
Loading…
Reference in New Issue
Block a user