ttnn-visualizer 0.28.1__py3-none-any.whl → 0.30.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.
Files changed (25) hide show
  1. ttnn_visualizer/app.py +4 -4
  2. ttnn_visualizer/csv_queries.py +20 -5
  3. ttnn_visualizer/decorators.py +0 -7
  4. ttnn_visualizer/file_uploads.py +5 -7
  5. ttnn_visualizer/models.py +32 -32
  6. ttnn_visualizer/queries.py +6 -6
  7. ttnn_visualizer/sessions.py +78 -69
  8. ttnn_visualizer/settings.py +4 -1
  9. ttnn_visualizer/sftp_operations.py +24 -25
  10. ttnn_visualizer/static/assets/{allPaths-CVqIgTho.js → allPaths-BFtaymsj.js} +1 -1
  11. ttnn_visualizer/static/assets/{allPathsLoader-C-VIuErI.js → allPathsLoader-krdfUMe8.js} +2 -2
  12. ttnn_visualizer/static/assets/{index-DWVfq2z5.css → index-Bq0nVwFb.css} +2 -2
  13. ttnn_visualizer/static/assets/{index-DBCJOx5j.js → index-BsP_KNDi.js} +255 -255
  14. ttnn_visualizer/static/assets/{splitPathsBySizeLoader-FZqEFRrU.js → splitPathsBySizeLoader-Exj9Tfv3.js} +1 -1
  15. ttnn_visualizer/static/index.html +2 -2
  16. ttnn_visualizer/tests/test_queries.py +4 -4
  17. ttnn_visualizer/utils.py +30 -27
  18. ttnn_visualizer/views.py +280 -106
  19. {ttnn_visualizer-0.28.1.dist-info → ttnn_visualizer-0.30.0.dist-info}/METADATA +4 -4
  20. {ttnn_visualizer-0.28.1.dist-info → ttnn_visualizer-0.30.0.dist-info}/RECORD +25 -25
  21. {ttnn_visualizer-0.28.1.dist-info → ttnn_visualizer-0.30.0.dist-info}/LICENSE +0 -0
  22. {ttnn_visualizer-0.28.1.dist-info → ttnn_visualizer-0.30.0.dist-info}/LICENSE_understanding.txt +0 -0
  23. {ttnn_visualizer-0.28.1.dist-info → ttnn_visualizer-0.30.0.dist-info}/WHEEL +0 -0
  24. {ttnn_visualizer-0.28.1.dist-info → ttnn_visualizer-0.30.0.dist-info}/entry_points.txt +0 -0
  25. {ttnn_visualizer-0.28.1.dist-info → ttnn_visualizer-0.30.0.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{_ as o,a as _,b as i,p as c,I as u}from"./index-DBCJOx5j.js";var p=function(n,s){return o(void 0,void 0,void 0,function(){var a,r;return _(this,function(e){switch(e.label){case 0:return a=c(n),s!==u.STANDARD?[3,2]:[4,i(()=>import("./index-BVMreIQm.js").then(t=>t.I),[])];case 1:return r=e.sent(),[3,4];case 2:return[4,i(()=>import("./index-Do7YB6C4.js").then(t=>t.I),[])];case 3:r=e.sent(),e.label=4;case 4:return[2,r[a]]}})})};export{p as splitPathsBySizeLoader};
1
+ import{_ as o,a as _,b as i,p as c,I as u}from"./index-BsP_KNDi.js";var p=function(n,s){return o(void 0,void 0,void 0,function(){var a,r;return _(this,function(e){switch(e.label){case 0:return a=c(n),s!==u.STANDARD?[3,2]:[4,i(()=>import("./index-BVMreIQm.js").then(t=>t.I),[])];case 1:return r=e.sent(),[3,4];case 2:return[4,i(()=>import("./index-Do7YB6C4.js").then(t=>t.I),[])];case 3:r=e.sent(),e.label=4;case 4:return[2,r[a]]}})})};export{p as splitPathsBySizeLoader};
@@ -27,8 +27,8 @@
27
27
  name="theme-color"
28
28
  content="#33333d"
29
29
  />
30
- <script type="module" crossorigin src="/assets/index-DBCJOx5j.js"></script>
31
- <link rel="stylesheet" crossorigin href="/assets/index-DWVfq2z5.css">
30
+ <script type="module" crossorigin src="/assets/index-BsP_KNDi.js"></script>
31
+ <link rel="stylesheet" crossorigin href="/assets/index-Bq0nVwFb.css">
32
32
  </head>
33
33
  <body>
34
34
  <div id="root"></div>
@@ -227,7 +227,7 @@ class TestDatabaseQueries(unittest.TestCase):
227
227
  mock_session = Mock()
228
228
  mock_session.remote_connection = Mock(useRemoteQuerying=True)
229
229
  mock_session.remote_connection.sqliteBinaryPath = "/usr/bin/sqlite3"
230
- mock_session.remote_folder = Mock(remotePath="/remote/path")
230
+ mock_session.remote_profiler_folder = Mock(remotePath="/remote/path")
231
231
  db_queries = DatabaseQueries(session=mock_session)
232
232
  self.assertIsInstance(db_queries.query_runner, RemoteQueryRunner)
233
233
 
@@ -238,7 +238,7 @@ class TestDatabaseQueries(unittest.TestCase):
238
238
  connection.close()
239
239
 
240
240
  mock_session = Mock()
241
- mock_session.report_path = temp_db_file.name
241
+ mock_session.profiler_path = temp_db_file.name
242
242
  mock_session.remote_connection = None
243
243
 
244
244
  db_queries = DatabaseQueries(session=mock_session)
@@ -246,7 +246,7 @@ class TestDatabaseQueries(unittest.TestCase):
246
246
 
247
247
  def test_init_with_invalid_session(self):
248
248
  mock_session = Mock()
249
- mock_session.report_path = None
249
+ mock_session.profiler_path = None
250
250
  mock_session.remote_connection = None
251
251
  with self.assertRaises(ValueError) as context:
252
252
  DatabaseQueries(session=mock_session)
@@ -388,7 +388,7 @@ class TestRemoteQueryRunner(unittest.TestCase):
388
388
  self.mock_session.remote_connection.sqliteBinaryPath = "/usr/bin/sqlite3"
389
389
  self.mock_session.remote_connection.host = "mockhost"
390
390
  self.mock_session.remote_connection.user = "mockuser"
391
- self.mock_session.remote_folder.remotePath = "/remote/db"
391
+ self.mock_session.remote_profiler_folder.remotePath = "/remote/db"
392
392
 
393
393
  @patch("ttnn_visualizer.queries.get_client")
394
394
  def test_init_with_mock_get_client(self, mock_get_client):
ttnn_visualizer/utils.py CHANGED
@@ -13,6 +13,7 @@ import re
13
13
  from timeit import default_timer
14
14
  from typing import Callable, Optional, Dict, Any
15
15
 
16
+
16
17
  logger = logging.getLogger(__name__)
17
18
 
18
19
  LAST_SYNCED_FILE_NAME = ".last-synced"
@@ -44,75 +45,76 @@ def timer(f: Callable):
44
45
  return wrapper
45
46
 
46
47
 
47
- def get_profiler_path(profile_name, current_app, remote_connection=None):
48
+ def get_performance_path(performance_name, current_app, remote_connection=None):
48
49
  """
49
- Gets the profiler path for the given profile_name.
50
+ Gets the path for the given performance_name.
50
51
 
51
- :param profile_name: The name of the profiler directory.
52
+ :param performance_name: The name of the performance directory.
52
53
  :param current_app: Flask current application object.
53
- :param report_name: Optional name of the report directory under which the profiler resides.
54
+ :param remote_connection: Remote connection model instance
54
55
 
55
56
  :return: Profiler path as a string.
56
57
  """
57
58
  local_dir = Path(current_app.config["LOCAL_DATA_DIRECTORY"])
58
59
  remote_dir = Path(current_app.config["REMOTE_DATA_DIRECTORY"])
59
60
 
60
- # Check if there's an associated RemoteConnection
61
61
  if remote_connection:
62
- # Use the remote directory if a remote connection exists
63
62
  base_dir = Path(remote_dir).joinpath(remote_connection.host)
64
63
  else:
65
- # Default to local directory if no remote connection is present
66
64
  base_dir = local_dir
67
65
 
68
- if not remote_connection:
69
- profile_dir = base_dir / "profiles"
70
- else:
71
- profile_dir = base_dir / "profiler"
72
-
73
- # Construct the profiler path
74
- profiler_path = profile_dir / profile_name
66
+ profiler_dir = base_dir / current_app.config["PERFORMANCE_DIRECTORY_NAME"]
67
+ performance_path = profiler_dir / performance_name
75
68
 
76
- return str(profiler_path)
69
+ return str(performance_path)
77
70
 
78
71
 
79
- def get_report_path(active_report, current_app, remote_connection=None):
72
+ def get_profiler_path(profiler_name, current_app, remote_connection=None):
80
73
  """
81
74
  Gets the report path for the given active_report object.
82
- :param active_report: Dictionary representing the active report.
75
+ :param profiler_name: The name of the report directory.
83
76
  :param current_app: Flask current application
84
77
  :param remote_connection: Remote connection model instance
85
78
 
86
- :return: report_path as a string
79
+ :return: profiler_path as a string
87
80
  """
88
81
  database_file_name = current_app.config["SQLITE_DB_PATH"]
89
82
  local_dir = current_app.config["LOCAL_DATA_DIRECTORY"]
90
83
  remote_dir = current_app.config["REMOTE_DATA_DIRECTORY"]
91
84
 
92
- if active_report:
93
- # Check if there's an associated RemoteConnection
85
+ if profiler_name:
94
86
  if remote_connection:
95
- # Use the remote directory if a remote connection exists
96
87
  base_dir = Path(remote_dir).joinpath(remote_connection.host)
97
88
  else:
98
- # Default to local directory if no remote connection is present
99
89
  base_dir = local_dir
100
90
 
101
- # Construct the full report path
102
- report_path = Path(base_dir).joinpath(active_report.get("report_name"))
103
- target_path = str(Path(report_path).joinpath(database_file_name))
91
+ profiler_path = base_dir / current_app.config["PROFILER_DIRECTORY_NAME"] / profiler_name
92
+ target_path = profiler_path / database_file_name
104
93
 
105
- return target_path
94
+ return str(target_path)
106
95
  else:
107
96
  return ""
108
97
 
109
98
  def get_npe_path(npe_name, current_app):
110
99
  local_dir = Path(current_app.config["LOCAL_DATA_DIRECTORY"])
111
100
 
112
- npe_path = local_dir / "npe"
101
+ npe_path = local_dir / current_app.config["NPE_DIRECTORY_NAME"]
113
102
 
114
103
  return str(npe_path)
115
104
 
105
+
106
+ def get_cluster_descriptor_path(instance):
107
+ if not instance.profiler_path:
108
+ return None
109
+
110
+ cluster_descriptor_path = Path(instance.profiler_path).parent / Path("cluster_descriptor.yaml")
111
+
112
+ if not cluster_descriptor_path.exists():
113
+ return None
114
+
115
+ return str(cluster_descriptor_path)
116
+
117
+
116
118
  def read_last_synced_file(directory: str) -> Optional[int]:
117
119
  """Reads the '.last-synced' file in the specified directory and returns the timestamp as an integer, or None if not found."""
118
120
  last_synced_path = Path(directory) / LAST_SYNCED_FILE_NAME
@@ -189,3 +191,4 @@ def read_version_from_package_json() -> str:
189
191
  raise FileNotFoundError(f"The file {file_path} was not found.")
190
192
  except KeyError:
191
193
  raise KeyError("The 'version' key was not found in the package.json file.")
194
+