ttnn-visualizer 0.42.0__py3-none-any.whl → 0.43.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ttnn_visualizer/__init__.py +0 -1
- ttnn_visualizer/app.py +15 -4
- ttnn_visualizer/csv_queries.py +82 -48
- ttnn_visualizer/decorators.py +38 -15
- ttnn_visualizer/exceptions.py +29 -1
- ttnn_visualizer/file_uploads.py +1 -0
- ttnn_visualizer/instances.py +42 -15
- ttnn_visualizer/models.py +12 -7
- ttnn_visualizer/remote_sqlite_setup.py +37 -30
- ttnn_visualizer/requirements.txt +1 -0
- ttnn_visualizer/serializers.py +1 -0
- ttnn_visualizer/settings.py +9 -5
- ttnn_visualizer/sftp_operations.py +144 -125
- ttnn_visualizer/sockets.py +9 -3
- ttnn_visualizer/static/assets/{allPaths-wwXsGKJ2.js → allPaths-CGmhlOs-.js} +1 -1
- ttnn_visualizer/static/assets/{allPathsLoader-BK9jqlVe.js → allPathsLoader-CH9za42_.js} +2 -2
- ttnn_visualizer/static/assets/index-B-fsa5Ru.js +1 -0
- ttnn_visualizer/static/assets/{index-C1rJBrMl.css → index-C-t6jBt9.css} +1 -1
- ttnn_visualizer/static/assets/{index-Ybr1HJxx.js → index-DEb3r1jy.js} +69 -69
- ttnn_visualizer/static/assets/index-DLOviMB1.js +1 -0
- ttnn_visualizer/static/assets/{splitPathsBySizeLoader-CauQGZHk.js → splitPathsBySizeLoader-CP-kodGu.js} +1 -1
- ttnn_visualizer/static/index.html +2 -2
- ttnn_visualizer/tests/__init__.py +0 -1
- ttnn_visualizer/tests/test_queries.py +0 -1
- ttnn_visualizer/tests/test_serializers.py +2 -2
- ttnn_visualizer/utils.py +7 -3
- ttnn_visualizer/views.py +250 -82
- {ttnn_visualizer-0.42.0.dist-info → ttnn_visualizer-0.43.1.dist-info}/METADATA +5 -1
- ttnn_visualizer-0.43.1.dist-info/RECORD +45 -0
- ttnn_visualizer/static/assets/index-BKzgFDAn.js +0 -1
- ttnn_visualizer/static/assets/index-BvSuWPlB.js +0 -1
- ttnn_visualizer-0.42.0.dist-info/RECORD +0 -45
- {ttnn_visualizer-0.42.0.dist-info → ttnn_visualizer-0.43.1.dist-info}/LICENSE +0 -0
- {ttnn_visualizer-0.42.0.dist-info → ttnn_visualizer-0.43.1.dist-info}/LICENSE_understanding.txt +0 -0
- {ttnn_visualizer-0.42.0.dist-info → ttnn_visualizer-0.43.1.dist-info}/WHEEL +0 -0
- {ttnn_visualizer-0.42.0.dist-info → ttnn_visualizer-0.43.1.dist-info}/entry_points.txt +0 -0
- {ttnn_visualizer-0.42.0.dist-info → ttnn_visualizer-0.43.1.dist-info}/top_level.txt +0 -0
@@ -7,11 +7,18 @@ import subprocess
|
|
7
7
|
|
8
8
|
from ttnn_visualizer.decorators import remote_exception_handler
|
9
9
|
from ttnn_visualizer.enums import ConnectionTestStates
|
10
|
-
from ttnn_visualizer.exceptions import
|
10
|
+
from ttnn_visualizer.exceptions import (
|
11
|
+
RemoteSqliteException,
|
12
|
+
SSHException,
|
13
|
+
AuthenticationException,
|
14
|
+
NoValidConnectionsError,
|
15
|
+
)
|
11
16
|
from ttnn_visualizer.models import RemoteConnection
|
12
17
|
|
13
18
|
|
14
|
-
def handle_ssh_subprocess_error(
|
19
|
+
def handle_ssh_subprocess_error(
|
20
|
+
e: subprocess.CalledProcessError, remote_connection: RemoteConnection
|
21
|
+
):
|
15
22
|
"""
|
16
23
|
Convert subprocess SSH errors to appropriate SSH exceptions.
|
17
24
|
|
@@ -22,23 +29,29 @@ def handle_ssh_subprocess_error(e: subprocess.CalledProcessError, remote_connect
|
|
22
29
|
stderr = e.stderr.lower() if e.stderr else ""
|
23
30
|
|
24
31
|
# Check for authentication failures
|
25
|
-
if any(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
+
if any(
|
33
|
+
auth_err in stderr
|
34
|
+
for auth_err in [
|
35
|
+
"permission denied",
|
36
|
+
"authentication failed",
|
37
|
+
"publickey",
|
38
|
+
"password",
|
39
|
+
"host key verification failed",
|
40
|
+
]
|
41
|
+
):
|
32
42
|
raise AuthenticationException(f"SSH authentication failed: {e.stderr}")
|
33
43
|
|
34
44
|
# Check for connection failures
|
35
|
-
elif any(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
45
|
+
elif any(
|
46
|
+
conn_err in stderr
|
47
|
+
for conn_err in [
|
48
|
+
"connection refused",
|
49
|
+
"network is unreachable",
|
50
|
+
"no route to host",
|
51
|
+
"name or service not known",
|
52
|
+
"connection timed out",
|
53
|
+
]
|
54
|
+
):
|
42
55
|
raise NoValidConnectionsError(f"SSH connection failed: {e.stderr}")
|
43
56
|
|
44
57
|
# Check for general SSH protocol errors
|
@@ -49,29 +62,23 @@ def handle_ssh_subprocess_error(e: subprocess.CalledProcessError, remote_connect
|
|
49
62
|
else:
|
50
63
|
raise SSHException(f"SSH command failed: {e.stderr}")
|
51
64
|
|
65
|
+
|
52
66
|
MINIMUM_SQLITE_VERSION = "3.38.0"
|
53
67
|
|
54
68
|
|
55
69
|
def _execute_ssh_command(remote_connection: RemoteConnection, command: str) -> str:
|
56
70
|
"""Execute an SSH command and return the output."""
|
57
|
-
ssh_cmd = ["ssh"]
|
58
|
-
|
71
|
+
ssh_cmd = ["ssh", "-o", "PasswordAuthentication=no"]
|
72
|
+
|
59
73
|
# Handle non-standard SSH port
|
60
74
|
if remote_connection.port != 22:
|
61
75
|
ssh_cmd.extend(["-p", str(remote_connection.port)])
|
62
|
-
|
63
|
-
ssh_cmd.extend([
|
64
|
-
|
65
|
-
command
|
66
|
-
])
|
67
|
-
|
76
|
+
|
77
|
+
ssh_cmd.extend([f"{remote_connection.username}@{remote_connection.host}", command])
|
78
|
+
|
68
79
|
try:
|
69
80
|
result = subprocess.run(
|
70
|
-
ssh_cmd,
|
71
|
-
capture_output=True,
|
72
|
-
text=True,
|
73
|
-
check=True,
|
74
|
-
timeout=30
|
81
|
+
ssh_cmd, capture_output=True, text=True, check=True, timeout=30
|
75
82
|
)
|
76
83
|
return result.stdout
|
77
84
|
except subprocess.CalledProcessError as e:
|
@@ -118,7 +125,7 @@ def is_sqlite_executable(remote_connection: RemoteConnection, binary_path):
|
|
118
125
|
try:
|
119
126
|
output = _execute_ssh_command(remote_connection, f"{binary_path} --version")
|
120
127
|
version_output = output.strip()
|
121
|
-
|
128
|
+
|
122
129
|
version = get_sqlite_version(version_output)
|
123
130
|
if not is_version_at_least(version, MINIMUM_SQLITE_VERSION):
|
124
131
|
raise Exception(
|
ttnn_visualizer/requirements.txt
CHANGED
ttnn_visualizer/serializers.py
CHANGED
ttnn_visualizer/settings.py
CHANGED
@@ -10,6 +10,7 @@ from ttnn_visualizer.utils import str_to_bool
|
|
10
10
|
|
11
11
|
load_dotenv()
|
12
12
|
|
13
|
+
|
13
14
|
class DefaultConfig(object):
|
14
15
|
# General Settings
|
15
16
|
SECRET_KEY = os.getenv("SECRET_KEY", "90909")
|
@@ -19,17 +20,20 @@ class DefaultConfig(object):
|
|
19
20
|
SERVER_MODE = str_to_bool(os.getenv("SERVER_MODE", "false"))
|
20
21
|
MALWARE_SCANNER = os.getenv("MALWARE_SCANNER")
|
21
22
|
ALLOWED_ORIGINS = [
|
22
|
-
o
|
23
|
+
o
|
24
|
+
for o in os.getenv(
|
25
|
+
"ALLOWED_ORIGINS", "http://localhost:5173,http://localhost:8000"
|
26
|
+
).split(",")
|
23
27
|
if o
|
24
28
|
]
|
25
29
|
BASE_PATH = os.getenv("BASE_PATH", "/")
|
26
|
-
MAX_CONTENT_LENGTH = (
|
27
|
-
None if not (v := os.getenv("MAX_CONTENT_LENGTH")) else int(v)
|
28
|
-
)
|
30
|
+
MAX_CONTENT_LENGTH = None if not (v := os.getenv("MAX_CONTENT_LENGTH")) else int(v)
|
29
31
|
|
30
32
|
# Path Settings
|
31
33
|
DB_VERSION = "0.29.0" # App version when DB schema last changed
|
32
|
-
REPORT_DATA_DIRECTORY = os.getenv(
|
34
|
+
REPORT_DATA_DIRECTORY = os.getenv(
|
35
|
+
"REPORT_DATA_DIRECTORY", Path(__file__).parent.absolute().joinpath("data")
|
36
|
+
)
|
33
37
|
LOCAL_DATA_DIRECTORY = Path(REPORT_DATA_DIRECTORY).joinpath("local")
|
34
38
|
REMOTE_DATA_DIRECTORY = Path(REPORT_DATA_DIRECTORY).joinpath("remote")
|
35
39
|
PROFILER_DIRECTORY_NAME = "profiler-reports"
|