ttnn-visualizer 0.39.0__py3-none-any.whl → 0.40.0__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/app.py +0 -3
- ttnn_visualizer/decorators.py +3 -1
- ttnn_visualizer/file_uploads.py +19 -6
- ttnn_visualizer/instances.py +54 -28
- ttnn_visualizer/requirements.txt +0 -1
- ttnn_visualizer/settings.py +3 -0
- ttnn_visualizer/static/assets/{allPaths-BYcRoLEw.js → allPaths-D-_TIPPa.js} +1 -1
- ttnn_visualizer/static/assets/{allPathsLoader-CNKgAYcC.js → allPathsLoader-BW1XGonq.js} +2 -2
- ttnn_visualizer/static/assets/{index-B9wn2kZo.css → index-A885NUe_.css} +2 -2
- ttnn_visualizer/static/assets/{index-Ba6DlrXF.js → index-B26_8Zp5.js} +342 -342
- ttnn_visualizer/static/assets/{splitPathsBySizeLoader-2S0DVWGR.js → splitPathsBySizeLoader-JdDyp6sf.js} +1 -1
- ttnn_visualizer/static/index.html +2 -2
- ttnn_visualizer/views.py +77 -24
- {ttnn_visualizer-0.39.0.dist-info → ttnn_visualizer-0.40.0.dist-info}/LICENSE +0 -1
- {ttnn_visualizer-0.39.0.dist-info → ttnn_visualizer-0.40.0.dist-info}/METADATA +1 -1
- {ttnn_visualizer-0.39.0.dist-info → ttnn_visualizer-0.40.0.dist-info}/RECORD +20 -20
- {ttnn_visualizer-0.39.0.dist-info → ttnn_visualizer-0.40.0.dist-info}/LICENSE_understanding.txt +0 -0
- {ttnn_visualizer-0.39.0.dist-info → ttnn_visualizer-0.40.0.dist-info}/WHEEL +0 -0
- {ttnn_visualizer-0.39.0.dist-info → ttnn_visualizer-0.40.0.dist-info}/entry_points.txt +0 -0
- {ttnn_visualizer-0.39.0.dist-info → ttnn_visualizer-0.40.0.dist-info}/top_level.txt +0 -0
ttnn_visualizer/app.py
CHANGED
ttnn_visualizer/decorators.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC
|
4
4
|
|
5
|
+
import logging
|
5
6
|
import re
|
6
7
|
from ttnn_visualizer.enums import ConnectionTestStates
|
7
8
|
|
@@ -21,6 +22,8 @@ from ttnn_visualizer.exceptions import (
|
|
21
22
|
)
|
22
23
|
from ttnn_visualizer.instances import get_or_create_instance
|
23
24
|
|
25
|
+
logger = logging.getLogger(__name__)
|
26
|
+
|
24
27
|
|
25
28
|
def with_instance(func):
|
26
29
|
@wraps(func)
|
@@ -44,7 +47,6 @@ def with_instance(func):
|
|
44
47
|
if instance.instance_id not in session['instances']:
|
45
48
|
session['instances'] = session.get('instances', []) + [instance.instance_id]
|
46
49
|
|
47
|
-
|
48
50
|
return func(*args, **kwargs)
|
49
51
|
|
50
52
|
return wrapper
|
ttnn_visualizer/file_uploads.py
CHANGED
@@ -9,6 +9,7 @@ import shlex
|
|
9
9
|
import shutil
|
10
10
|
import subprocess
|
11
11
|
import tempfile
|
12
|
+
import time
|
12
13
|
from pathlib import Path
|
13
14
|
|
14
15
|
from flask import current_app
|
@@ -69,9 +70,11 @@ def save_uploaded_files(
|
|
69
70
|
Save uploaded files to the target directory.
|
70
71
|
|
71
72
|
:param files: List of files to be saved.
|
72
|
-
:param
|
73
|
-
:param
|
73
|
+
:param base_directory: The base directory for saving the files.
|
74
|
+
:param parent_folder_name: The name to use for the directory.
|
74
75
|
"""
|
76
|
+
saved_paths = []
|
77
|
+
|
75
78
|
if current_app.config["MALWARE_SCANNER"]:
|
76
79
|
scanned_files = scan_uploaded_files(files, base_directory, parent_folder_name)
|
77
80
|
|
@@ -82,6 +85,7 @@ def save_uploaded_files(
|
|
82
85
|
logger.info(f"Saving uploaded file (clean): {dest_path}")
|
83
86
|
|
84
87
|
shutil.move(temp_path, dest_path)
|
88
|
+
saved_paths.append(dest_path)
|
85
89
|
else:
|
86
90
|
for file in files:
|
87
91
|
dest_path = construct_dest_path(file, base_directory, parent_folder_name)
|
@@ -96,18 +100,23 @@ def save_uploaded_files(
|
|
96
100
|
|
97
101
|
logger.info(f"Saving uploaded file: {dest_path}")
|
98
102
|
file.save(dest_path)
|
103
|
+
saved_paths.append(dest_path)
|
99
104
|
|
100
|
-
|
101
|
-
|
105
|
+
for saved_path in saved_paths:
|
106
|
+
# Update the modified time of the parent directory (for sorting purposes)
|
107
|
+
os.utime(saved_path.parent, None)
|
102
108
|
|
103
109
|
# Update the modified time of the uploaded directory
|
104
110
|
if parent_folder_name:
|
105
111
|
uploaded_dir = Path(base_directory) / parent_folder_name
|
106
112
|
else:
|
107
113
|
uploaded_dir = Path(base_directory)
|
114
|
+
|
108
115
|
if uploaded_dir.exists():
|
109
116
|
os.utime(uploaded_dir, None)
|
110
117
|
|
118
|
+
return saved_paths
|
119
|
+
|
111
120
|
|
112
121
|
def scan_uploaded_files(
|
113
122
|
files,
|
@@ -146,9 +155,13 @@ def scan_uploaded_files(
|
|
146
155
|
|
147
156
|
|
148
157
|
def construct_dest_path(file, target_directory, folder_name):
|
158
|
+
prefix = f"{int(time.time())}_" if current_app.config["SERVER_MODE"] else ""
|
159
|
+
|
149
160
|
if folder_name:
|
150
|
-
|
161
|
+
prefixed_folder_name = f"{prefix}{folder_name}"
|
162
|
+
dest_path = Path(target_directory) / prefixed_folder_name / str(file.filename)
|
151
163
|
else:
|
152
|
-
|
164
|
+
prefixed_filename = f"{prefix}{file.filename}"
|
165
|
+
dest_path = Path(target_directory) / prefixed_filename
|
153
166
|
|
154
167
|
return dest_path
|
ttnn_visualizer/instances.py
CHANGED
@@ -23,6 +23,9 @@ from flask import jsonify, current_app
|
|
23
23
|
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
|
24
24
|
|
25
25
|
|
26
|
+
_sentinel = object()
|
27
|
+
|
28
|
+
|
26
29
|
def update_existing_instance(
|
27
30
|
instance_data,
|
28
31
|
profiler_name,
|
@@ -32,6 +35,9 @@ def update_existing_instance(
|
|
32
35
|
remote_profiler_folder,
|
33
36
|
remote_performance_folder,
|
34
37
|
clear_remote,
|
38
|
+
profiler_path=_sentinel,
|
39
|
+
performance_path=_sentinel,
|
40
|
+
npe_path=_sentinel,
|
35
41
|
):
|
36
42
|
active_report = instance_data.active_report or {}
|
37
43
|
|
@@ -63,9 +69,34 @@ def update_existing_instance(
|
|
63
69
|
if clear_remote:
|
64
70
|
clear_remote_data(instance_data)
|
65
71
|
|
66
|
-
|
67
|
-
instance_data
|
68
|
-
|
72
|
+
if profiler_path is not _sentinel:
|
73
|
+
instance_data.profiler_path = profiler_path
|
74
|
+
else:
|
75
|
+
if active_report.get("profiler_name"):
|
76
|
+
instance_data.profiler_path = get_profiler_path(
|
77
|
+
profiler_name=active_report["profiler_name"],
|
78
|
+
current_app=current_app,
|
79
|
+
remote_connection=remote_connection,
|
80
|
+
)
|
81
|
+
|
82
|
+
if performance_path is not _sentinel:
|
83
|
+
instance_data.performance_path = performance_path
|
84
|
+
else:
|
85
|
+
if active_report.get("performance_name"):
|
86
|
+
instance_data.performance_path = get_performance_path(
|
87
|
+
performance_name=active_report["performance_name"],
|
88
|
+
current_app=current_app,
|
89
|
+
remote_connection=remote_connection,
|
90
|
+
)
|
91
|
+
|
92
|
+
if npe_path is not _sentinel:
|
93
|
+
instance_data.npe_path = npe_path
|
94
|
+
else:
|
95
|
+
if active_report.get("npe_name"):
|
96
|
+
instance_data.npe_path = get_npe_path(
|
97
|
+
npe_name=active_report["npe_name"],
|
98
|
+
current_app=current_app
|
99
|
+
)
|
69
100
|
|
70
101
|
|
71
102
|
def clear_remote_data(instance_data):
|
@@ -88,30 +119,6 @@ def commit_and_log_session(instance_data, instance_id):
|
|
88
119
|
)
|
89
120
|
|
90
121
|
|
91
|
-
def update_paths(
|
92
|
-
instance_data, active_report, remote_connection
|
93
|
-
):
|
94
|
-
if active_report.get("performance_name"):
|
95
|
-
instance_data.performance_path = get_performance_path(
|
96
|
-
performance_name=active_report["performance_name"],
|
97
|
-
current_app=current_app,
|
98
|
-
remote_connection=remote_connection,
|
99
|
-
)
|
100
|
-
|
101
|
-
if active_report.get("profiler_name"):
|
102
|
-
instance_data.profiler_path = get_profiler_path(
|
103
|
-
profiler_name=active_report["profiler_name"],
|
104
|
-
current_app=current_app,
|
105
|
-
remote_connection=remote_connection,
|
106
|
-
)
|
107
|
-
|
108
|
-
if active_report.get("npe_name"):
|
109
|
-
instance_data.npe_path = get_npe_path(
|
110
|
-
npe_name=active_report["npe_name"],
|
111
|
-
current_app=current_app
|
112
|
-
)
|
113
|
-
|
114
|
-
|
115
122
|
def create_new_instance(
|
116
123
|
instance_id,
|
117
124
|
profiler_name,
|
@@ -121,6 +128,9 @@ def create_new_instance(
|
|
121
128
|
remote_profiler_folder,
|
122
129
|
remote_performance_folder,
|
123
130
|
clear_remote,
|
131
|
+
profiler_path=_sentinel,
|
132
|
+
performance_path=_sentinel,
|
133
|
+
npe_path=_sentinel,
|
124
134
|
):
|
125
135
|
active_report = {}
|
126
136
|
if profiler_name:
|
@@ -138,7 +148,7 @@ def create_new_instance(
|
|
138
148
|
instance_data = InstanceTable(
|
139
149
|
instance_id=instance_id,
|
140
150
|
active_report=active_report,
|
141
|
-
profiler_path=get_profiler_path(
|
151
|
+
profiler_path=profiler_path if profiler_path is not _sentinel else get_profiler_path(
|
142
152
|
active_report["profiler_name"],
|
143
153
|
current_app=current_app,
|
144
154
|
remote_connection=remote_connection,
|
@@ -151,6 +161,13 @@ def create_new_instance(
|
|
151
161
|
remote_performance_folder.model_dump() if remote_performance_folder else None
|
152
162
|
),
|
153
163
|
)
|
164
|
+
|
165
|
+
if performance_path is not _sentinel:
|
166
|
+
instance_data.performance_path = performance_path
|
167
|
+
|
168
|
+
if npe_path is not _sentinel:
|
169
|
+
instance_data.npe_path = npe_path
|
170
|
+
|
154
171
|
db.session.add(instance_data)
|
155
172
|
return instance_data
|
156
173
|
|
@@ -164,6 +181,9 @@ def update_instance(
|
|
164
181
|
remote_profiler_folder=None,
|
165
182
|
remote_performance_folder=None,
|
166
183
|
clear_remote=False,
|
184
|
+
profiler_path=_sentinel,
|
185
|
+
performance_path=_sentinel,
|
186
|
+
npe_path=_sentinel,
|
167
187
|
):
|
168
188
|
try:
|
169
189
|
instance_data = get_or_create_instance(instance_id)
|
@@ -178,6 +198,9 @@ def update_instance(
|
|
178
198
|
remote_profiler_folder,
|
179
199
|
remote_performance_folder,
|
180
200
|
clear_remote,
|
201
|
+
profiler_path,
|
202
|
+
performance_path,
|
203
|
+
npe_path,
|
181
204
|
)
|
182
205
|
else:
|
183
206
|
instance_data = create_new_instance(
|
@@ -189,6 +212,9 @@ def update_instance(
|
|
189
212
|
remote_profiler_folder,
|
190
213
|
remote_performance_folder,
|
191
214
|
clear_remote,
|
215
|
+
profiler_path,
|
216
|
+
performance_path,
|
217
|
+
npe_path,
|
192
218
|
)
|
193
219
|
|
194
220
|
commit_and_log_session(instance_data, instance_id)
|
ttnn_visualizer/requirements.txt
CHANGED
ttnn_visualizer/settings.py
CHANGED
@@ -23,6 +23,9 @@ class DefaultConfig(object):
|
|
23
23
|
if o
|
24
24
|
]
|
25
25
|
BASE_PATH = os.getenv("BASE_PATH", "/")
|
26
|
+
MAX_CONTENT_LENGTH = (
|
27
|
+
None if not (v := os.getenv("MAX_CONTENT_LENGTH")) else int(v)
|
28
|
+
)
|
26
29
|
|
27
30
|
# Path Settings
|
28
31
|
DB_VERSION = "0.29.0" # App version when DB schema last changed
|
@@ -1 +1 @@
|
|
1
|
-
import{I as n}from"./index-BKzgFDAn.js";import{I as e}from"./index-BvSuWPlB.js";import{p as r,I as s}from"./index-
|
1
|
+
import{I as n}from"./index-BKzgFDAn.js";import{I as e}from"./index-BvSuWPlB.js";import{p as r,I as s}from"./index-B26_8Zp5.js";function I(o,t){var a=r(o);return t===s.STANDARD?n[a]:e[a]}function p(o){return r(o)}export{n as IconSvgPaths16,e as IconSvgPaths20,I as getIconPaths,p as iconNameToPathsRecordKey};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-
|
2
|
-
import{_ as o,a as n,b as i}from"./index-
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-D-_TIPPa.js","assets/index-BKzgFDAn.js","assets/index-BvSuWPlB.js","assets/index-B26_8Zp5.js","assets/index-A885NUe_.css"])))=>i.map(i=>d[i]);
|
2
|
+
import{_ as o,a as n,b as i}from"./index-B26_8Zp5.js";var _=function(e,a){return o(void 0,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,i(()=>import("./allPaths-D-_TIPPa.js"),__vite__mapDeps([0,1,2,3,4]))];case 1:return t=r.sent().getIconPaths,[2,t(e,a)]}})})};export{_ as allPathsLoader};
|