ttnn-visualizer 0.40.3__py3-none-any.whl → 0.41.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 CHANGED
@@ -16,7 +16,7 @@ from typing import cast
16
16
 
17
17
  import flask
18
18
  from dotenv import load_dotenv
19
- from flask import Flask, jsonify
19
+ from flask import Flask, abort, jsonify
20
20
  from flask_cors import CORS
21
21
  from werkzeug.debug import DebuggedApplication
22
22
  from werkzeug.middleware.proxy_fix import ProxyFix
@@ -46,7 +46,11 @@ def create_app(settings_override=None):
46
46
 
47
47
  config = cast(DefaultConfig, Config())
48
48
 
49
- app = Flask(__name__, static_folder=config.STATIC_ASSETS_DIR, static_url_path="/")
49
+ app = Flask(
50
+ __name__,
51
+ static_folder=config.STATIC_ASSETS_DIR,
52
+ static_url_path=f"{config.BASE_PATH}static",
53
+ )
50
54
  logging.basicConfig(level=app.config.get("LOG_LEVEL", "INFO"))
51
55
 
52
56
  app.config.from_object(config)
@@ -56,14 +60,17 @@ def create_app(settings_override=None):
56
60
 
57
61
  middleware(app)
58
62
 
59
- app.register_blueprint(api, url_prefix=f"{app.config['BASE_PATH']}/api")
63
+ app.register_blueprint(api, url_prefix=f"{app.config['BASE_PATH']}api")
60
64
 
61
65
  extensions(app)
62
66
 
63
67
  if flask_env == "production":
64
- @app.route(f"{app.config['BASE_PATH']}/", defaults={"path": ""})
65
- @app.route("/<path:path>")
68
+ @app.route(f"{app.config['BASE_PATH']}", defaults={"path": ""})
69
+ @app.route(f"{app.config['BASE_PATH']}<path:path>")
66
70
  def catch_all(path):
71
+ if path.startswith("static/"):
72
+ abort(404) # Pass control to Flask's static view
73
+
67
74
  js_config = {
68
75
  "SERVER_MODE": app.config["SERVER_MODE"],
69
76
  "BASE_PATH": app.config["BASE_PATH"],
@@ -78,7 +85,15 @@ def create_app(settings_override=None):
78
85
  js,
79
86
  )
80
87
 
81
- return flask.Response(html_with_config, mimetype="text/html")
88
+ return flask.Response(
89
+ html_with_config,
90
+ mimetype="text/html",
91
+ headers={
92
+ "Cache-Control": "no-store, no-cache, must-revalidate, max-age=0",
93
+ "Pragma": "no-cache",
94
+ "Expires": "0",
95
+ },
96
+ )
82
97
 
83
98
  return app
84
99
 
@@ -2,6 +2,7 @@
2
2
  #
3
3
  # SPDX-FileCopyrightText: © 2025 Tenstorrent Inc.
4
4
  import csv
5
+ import json
5
6
  import os
6
7
  import tempfile
7
8
  from io import StringIO
@@ -14,7 +15,7 @@ from tt_perf_report import perf_report
14
15
  from ttnn_visualizer.exceptions import DataFormatError
15
16
  from ttnn_visualizer.models import Instance
16
17
  from ttnn_visualizer.ssh_client import get_client
17
-
18
+ from ttnn_visualizer.sftp_operations import read_remote_file
18
19
 
19
20
  class LocalCSVQueryRunner:
20
21
  def __init__(self, file_path: str, offset: int = 0):
@@ -211,7 +212,7 @@ class RemoteCSVQueryRunner:
211
212
  if error:
212
213
  raise RuntimeError(f"Error fetching raw rows: {error}")
213
214
 
214
- return output.splitlines()[self.offset :]
215
+ return output.splitlines()[self.offset:]
215
216
 
216
217
  def get_csv_header(self) -> Dict[str, int]:
217
218
  """
@@ -259,6 +260,32 @@ class RemoteCSVQueryRunner:
259
260
  self.ssh_client.close()
260
261
 
261
262
 
263
+ class NPEQueries:
264
+ NPE_FOLDER = "npe_viz"
265
+ MANIFEST_FILE = "manifest.json"
266
+
267
+ @staticmethod
268
+ def get_npe_manifest(instance: Instance):
269
+
270
+
271
+ if (
272
+ not instance.remote_connection
273
+ or instance.remote_connection
274
+ and not instance.remote_connection.useRemoteQuerying
275
+ ):
276
+ file_path = Path(
277
+ instance.performance_path, NPEQueries.NPE_FOLDER, NPEQueries.MANIFEST_FILE
278
+ )
279
+ with open(file_path, "r") as f:
280
+ return json.load(f)
281
+ else:
282
+ profiler_folder = instance.remote_profile_folder
283
+ return read_remote_file(
284
+ instance.remote_connection,
285
+ f"{profiler_folder.remotePath}/{NPEQueries.NPE_FOLDER}/{NPEQueries.MANIFEST_FILE}",
286
+ )
287
+
288
+
262
289
  class DeviceLogProfilerQueries:
263
290
  DEVICE_LOG_FILE = "profile_log_device.csv"
264
291
  DEVICE_LOG_COLUMNS = [
@@ -640,7 +667,7 @@ class OpsPerformanceReportQueries:
640
667
 
641
668
  for key, value in cls.PASSTHROUGH_COLUMNS.items():
642
669
  op_id = int(row[0])
643
- idx = op_id - 2 # IDs in result column one correspond to row numbers in ops perf results csv
670
+ idx = op_id - 2 # IDs in result column one correspond to row numbers in ops perf results csv
644
671
  processed_row[key] = ops_perf_results[idx][value]
645
672
 
646
673
  report.append(processed_row)
@@ -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-CWerbNbe.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
+ 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-DFVwehlj.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-DSFl5HNA.js","assets/index-BKzgFDAn.js","assets/index-BvSuWPlB.js","assets/index-CWerbNbe.js","assets/index-C1rJBrMl.css"])))=>i.map(i=>d[i]);
2
- import{_ as o,a as n,b as i}from"./index-CWerbNbe.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-DSFl5HNA.js"),__vite__mapDeps([0,1,2,3,4]))];case 1:return t=r.sent().getIconPaths,[2,t(e,a)]}})})};export{_ as allPathsLoader};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-4_pFqSAW.js","assets/index-BKzgFDAn.js","assets/index-BvSuWPlB.js","assets/index-DFVwehlj.js","assets/index-C1rJBrMl.css"])))=>i.map(i=>d[i]);
2
+ import{_ as o,a as n,b as i}from"./index-DFVwehlj.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-4_pFqSAW.js"),__vite__mapDeps([0,1,2,3,4]))];case 1:return t=r.sent().getIconPaths,[2,t(e,a)]}})})};export{_ as allPathsLoader};