mirror of
https://github.com/clearml/clearml-agent
synced 2025-03-13 06:58:37 +00:00
Fix apply git diff from submodule only
This commit is contained in:
parent
8e6fce8d63
commit
47092c47db
@ -124,7 +124,24 @@ class LiteralScriptManager(object):
|
|||||||
if not script:
|
if not script:
|
||||||
return False
|
return False
|
||||||
diff = script.diff
|
diff = script.diff
|
||||||
return diff and not diff.strip().lower().startswith("diff ")
|
if not diff:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# test git diff prefix
|
||||||
|
if diff.lstrip().lower().startswith("diff "):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# test git submodule prefix
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
|
if diff.lstrip().lower().startswith("submodule ") and \
|
||||||
|
diff.splitlines()[1].lstrip().lower().startswith("diff "):
|
||||||
|
return False
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# none of the above
|
||||||
|
return True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def write(task, directory, entry_point=None):
|
def write(task, directory, entry_point=None):
|
||||||
@ -1509,8 +1526,7 @@ class Worker(ServiceCommandSection):
|
|||||||
self._update_commit_id(current_task.id, execution, repo_info)
|
self._update_commit_id(current_task.id, execution, repo_info)
|
||||||
|
|
||||||
# Add the script CWD to the python path
|
# Add the script CWD to the python path
|
||||||
python_path = get_python_path(script_dir, execution.entry_point, self.package_api) \
|
python_path = get_python_path(script_dir, execution.entry_point, self.package_api, is_conda_env=self.is_conda)
|
||||||
if not self.is_conda else None
|
|
||||||
if os.environ.get(ENV_TASK_EXTRA_PYTHON_PATH):
|
if os.environ.get(ENV_TASK_EXTRA_PYTHON_PATH):
|
||||||
python_path = add_python_path(python_path, os.environ.get(ENV_TASK_EXTRA_PYTHON_PATH))
|
python_path = add_python_path(python_path, os.environ.get(ENV_TASK_EXTRA_PYTHON_PATH))
|
||||||
if python_path:
|
if python_path:
|
||||||
|
Loading…
Reference in New Issue
Block a user