"lib/bindings/python/vscode:/vscode.git/clone" did not exist on "aaf283bbb898bb7fae2909fe11a2762b6350d1cc"
Unverified Commit 87b79cc1 authored by Keiven C's avatar Keiven C Committed by GitHub
Browse files

fix: relax python/workspace checks in --runtime mode (#5081)


Signed-off-by: default avatarKeiven Chang <keivenchang@users.noreply.github.com>
Co-authored-by: default avatarKeiven Chang <keivenchang@users.noreply.github.com>
parent 9a3212b8
...@@ -444,7 +444,7 @@ class SystemInfo(NodeInfo): ...@@ -444,7 +444,7 @@ class SystemInfo(NodeInfo):
self.add_child(MaturinInfo()) self.add_child(MaturinInfo())
# Add Python info # Add Python info
self.add_child(PythonInfo()) self.add_child(PythonInfo(runtime_check=self.runtime_check))
else: else:
# In terse mode, only add components that have errors # In terse mode, only add components that have errors
self._add_error_only_components() self._add_error_only_components()
...@@ -630,7 +630,7 @@ class SystemInfo(NodeInfo): ...@@ -630,7 +630,7 @@ class SystemInfo(NodeInfo):
thorough_check=self.thorough_check, runtime_check=self.runtime_check thorough_check=self.thorough_check, runtime_check=self.runtime_check
), ),
), ),
("Python", PythonInfo()), ("Python", PythonInfo(runtime_check=self.runtime_check)),
] ]
# Skip compile-time dependencies in runtime-check mode # Skip compile-time dependencies in runtime-check mode
...@@ -1325,8 +1325,8 @@ class FilePermissionsInfo(NodeInfo): ...@@ -1325,8 +1325,8 @@ class FilePermissionsInfo(NodeInfo):
self.add_child( self.add_child(
NodeInfo( NodeInfo(
label="Dynamo workspace", label="Dynamo workspace",
desc="not needed for runtime container", desc="workspace not found (runtime check does not require a checkout)",
status=NodeStatus.INFO, status=NodeStatus.WARNING,
) )
) )
else: else:
...@@ -1340,6 +1340,15 @@ class FilePermissionsInfo(NodeInfo): ...@@ -1340,6 +1340,15 @@ class FilePermissionsInfo(NodeInfo):
return return
if not DynamoInfo.is_dynamo_workspace(dynamo_root): if not DynamoInfo.is_dynamo_workspace(dynamo_root):
if self.runtime_check:
self.add_child(
NodeInfo(
label="Dynamo workspace",
desc="not a valid dynamo workspace (runtime check does not require a checkout)",
status=NodeStatus.WARNING,
)
)
return
self.add_child( self.add_child(
NodeInfo( NodeInfo(
label="Dynamo workspace", label="Dynamo workspace",
...@@ -1358,6 +1367,8 @@ class FilePermissionsInfo(NodeInfo): ...@@ -1358,6 +1367,8 @@ class FilePermissionsInfo(NodeInfo):
exclude_files=[".git"], exclude_files=[".git"],
) )
for result in results: for result in results:
if self.runtime_check and result.status == NodeStatus.ERROR:
result.status = NodeStatus.WARNING
self.add_child(result) self.add_child(result)
# Check .git directory separately # Check .git directory separately
...@@ -1367,6 +1378,8 @@ class FilePermissionsInfo(NodeInfo): ...@@ -1367,6 +1378,8 @@ class FilePermissionsInfo(NodeInfo):
[git_dir], "Dynamo .git directory", recursive=recursive [git_dir], "Dynamo .git directory", recursive=recursive
) )
for result in git_results: for result in git_results:
if self.runtime_check and result.status == NodeStatus.ERROR:
result.status = NodeStatus.WARNING
self.add_child(result) self.add_child(result)
else: else:
self.add_child( self.add_child(
...@@ -1419,16 +1432,19 @@ class FilePermissionsInfo(NodeInfo): ...@@ -1419,16 +1432,19 @@ class FilePermissionsInfo(NodeInfo):
for result in results: for result in results:
# If we have at least one writable site-packages, # If we have at least one writable site-packages,
# downgrade ERROR to WARNING for non-writable ones # downgrade ERROR to WARNING for non-writable ones
if has_writable_site_packages and result.status == NodeStatus.ERROR: if (
has_writable_site_packages or self.runtime_check
) and result.status == NodeStatus.ERROR:
result.status = NodeStatus.WARNING result.status = NodeStatus.WARNING
self.add_child(result) self.add_child(result)
except Exception as e: except Exception as e:
status = NodeStatus.WARNING if self.runtime_check else NodeStatus.ERROR
self.add_child( self.add_child(
NodeInfo( NodeInfo(
label="Python site-packages", label="Python site-packages",
desc=f"Permission check failed: {str(e)}", desc=f"Permission check failed: {str(e)}",
status=NodeStatus.ERROR, status=status,
) )
) )
...@@ -1999,17 +2015,27 @@ class MaturinInfo(NodeInfo): ...@@ -1999,17 +2015,27 @@ class MaturinInfo(NodeInfo):
class PythonInfo(NodeInfo): class PythonInfo(NodeInfo):
"""Python installation information""" """Python installation information.
def __init__(self): In `--runtime-check` mode, Python is still useful to report, but failures should not
block the container sanity check, so missing/broken Python is downgraded to WARNING.
"""
def __init__(self, runtime_check: bool = False):
self.runtime_check = runtime_check
py_version = platform.python_version() py_version = platform.python_version()
py_exec = sys.executable or "python" py_exec = sys.executable or "python"
display_py_exec = self._replace_home_with_var(py_exec) display_py_exec = self._replace_home_with_var(py_exec)
if os.path.exists(py_exec):
status = NodeStatus.OK
else:
status = NodeStatus.WARNING if self.runtime_check else NodeStatus.ERROR
super().__init__( super().__init__(
label="Python", label="Python",
desc=f"{py_version}, {display_py_exec}", desc=f"{py_version}, {display_py_exec}",
status=NodeStatus.OK if os.path.exists(py_exec) else NodeStatus.ERROR, status=status,
) )
# Check for PyTorch (optional) # Check for PyTorch (optional)
...@@ -2682,8 +2708,8 @@ class DynamoInfo(NodeInfo): ...@@ -2682,8 +2708,8 @@ class DynamoInfo(NodeInfo):
if self.runtime_check and not workspace_dir: if self.runtime_check and not workspace_dir:
super().__init__( super().__init__(
label="Dynamo", label="Dynamo",
desc="Runtime container - checking installed packages", desc="workspace not found (runtime container) - checking installed packages",
status=NodeStatus.INFO, status=NodeStatus.WARNING,
) )
# Check runtime components even without workspace # Check runtime components even without workspace
runtime_info = DynamoRuntimeInfo( runtime_info = DynamoRuntimeInfo(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment