elastic-kernel 0.0.4__tar.gz → 0.0.6__tar.gz

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 (49) hide show
  1. {elastic_kernel-0.0.4/elastic_kernel.egg-info → elastic_kernel-0.0.6}/PKG-INFO +1 -1
  2. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_kernel/kernel.py +1 -7
  3. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6/elastic_kernel.egg-info}/PKG-INFO +1 -1
  4. elastic_kernel-0.0.6/elastic_notebook/__init__.py +1 -0
  5. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/common/profile_migration_speed.py +1 -8
  6. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/io/migrate.py +0 -7
  7. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/io/recover.py +3 -6
  8. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/mutation/fingerprint.py +1 -2
  9. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/notebook/checkpoint.py +1 -22
  10. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/notebook/restore_notebook.py +0 -4
  11. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/elastic_notebook.py +2 -21
  12. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/pyproject.toml +1 -1
  13. elastic_kernel-0.0.4/elastic_notebook/core/notebook/__init__.py +0 -0
  14. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/LICENSE +0 -0
  15. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/MANIFEST.in +0 -0
  16. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/README.md +0 -0
  17. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_kernel/__init__.py +0 -0
  18. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_kernel/command.py +0 -0
  19. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_kernel/kernel.json +0 -0
  20. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_kernel.egg-info/SOURCES.txt +0 -0
  21. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_kernel.egg-info/dependency_links.txt +0 -0
  22. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_kernel.egg-info/entry_points.txt +0 -0
  23. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_kernel.egg-info/requires.txt +0 -0
  24. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_kernel.egg-info/top_level.txt +0 -0
  25. {elastic_kernel-0.0.4/elastic_notebook → elastic_kernel-0.0.6/elastic_notebook/algorithm}/__init__.py +0 -0
  26. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/algorithm/baseline.py +0 -0
  27. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/algorithm/optimizer_exact.py +0 -0
  28. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/algorithm/selector.py +0 -0
  29. {elastic_kernel-0.0.4/elastic_notebook/algorithm → elastic_kernel-0.0.6/elastic_notebook/core}/__init__.py +0 -0
  30. {elastic_kernel-0.0.4/elastic_notebook/core → elastic_kernel-0.0.6/elastic_notebook/core/common}/__init__.py +0 -0
  31. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/common/checkpoint_file.py +0 -0
  32. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/common/profile_graph_size.py +0 -0
  33. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/common/profile_variable_size.py +0 -0
  34. {elastic_kernel-0.0.4/elastic_notebook/core/common → elastic_kernel-0.0.6/elastic_notebook/core/graph}/__init__.py +0 -0
  35. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/graph/cell_execution.py +0 -0
  36. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/graph/graph.py +0 -0
  37. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/graph/variable_snapshot.py +0 -0
  38. {elastic_kernel-0.0.4/elastic_notebook/core/graph → elastic_kernel-0.0.6/elastic_notebook/core/io}/__init__.py +0 -0
  39. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/io/adapter.py +0 -0
  40. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/io/filesystem_adapter.py +0 -0
  41. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/io/pickle.py +0 -0
  42. {elastic_kernel-0.0.4/elastic_notebook/core/io → elastic_kernel-0.0.6/elastic_notebook/core/mutation}/__init__.py +0 -0
  43. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/mutation/id_graph.py +0 -0
  44. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/mutation/object_hash.py +0 -0
  45. {elastic_kernel-0.0.4/elastic_notebook/core/mutation → elastic_kernel-0.0.6/elastic_notebook/core/notebook}/__init__.py +0 -0
  46. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/notebook/find_input_vars.py +0 -0
  47. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/notebook/find_output_vars.py +0 -0
  48. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/elastic_notebook/core/notebook/update_graph.py +0 -0
  49. {elastic_kernel-0.0.4 → elastic_kernel-0.0.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elastic-kernel
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Elastic kernel for Jupyter with automatic checkpoint and dependency tracking
5
5
  Author-email: ryutarom <m2002r1028@icloud.com>
6
6
  License: Apache License
@@ -6,7 +6,7 @@ from logging.handlers import RotatingFileHandler
6
6
 
7
7
  from ipykernel.ipkernel import IPythonKernel
8
8
 
9
- from elastic_notebook.elastic_notebook import ElasticNotebook
9
+ from elastic_notebook import ElasticNotebook
10
10
 
11
11
 
12
12
  class JSTFormatter(logging.Formatter):
@@ -146,12 +146,6 @@ class ElasticKernel(IPythonKernel):
146
146
  "%Y-%m-%d %H:%M:%S.%f",
147
147
  )
148
148
 
149
- # コンソールハンドラー
150
- console_handler = logging.StreamHandler()
151
- console_handler.setLevel(log_level)
152
- console_handler.setFormatter(formatter)
153
- self.logger.addHandler(console_handler)
154
-
155
149
  # ローテーティングファイルハンドラー
156
150
  rotating_file_handler = RotatingFileHandler(
157
151
  self.log_file_path,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elastic-kernel
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Elastic kernel for Jupyter with automatic checkpoint and dependency tracking
5
5
  Author-email: ryutarom <m2002r1028@icloud.com>
6
6
  License: Apache License
@@ -0,0 +1 @@
1
+ from .elastic_notebook import ElasticNotebook # noqa
@@ -58,12 +58,5 @@ def profile_migration_speed(dirname: str, alpha=1) -> float:
58
58
  os.system("rm -rf {}".format(testing_dir))
59
59
 
60
60
  migration_speed_bps = total_bytes / (total_read_time + total_write_time * alpha)
61
- print(
62
- "migration speed (bps) (total_bytes / (total_read_time + total_write_time * alpha)):",
63
- migration_speed_bps,
64
- )
65
- print("|- total bytes:", total_bytes)
66
- print("|- total read time:", total_read_time)
67
- print("|- total write time:", total_write_time)
68
- print("|- alpha:", alpha)
61
+
69
62
  return migration_speed_bps
@@ -78,7 +78,6 @@ def migrate(
78
78
  )
79
79
 
80
80
  if filename:
81
- print("Checkpoint saved to:", filename)
82
81
  write_path = filename
83
82
  else:
84
83
  write_path = FILENAME
@@ -90,9 +89,3 @@ def migrate(
90
89
  for vs in vs_list:
91
90
  obj_list.append(shell.user_ns[vs.name])
92
91
  dill.dump(obj_list, output_file)
93
- # Write the JSON file to the specified location. Uses the default location if a file path isn't specified.
94
- # if filename:
95
- # print("Checkpoint saved to:", filename)
96
- # adapter.write_all(Path(filename), metadata)
97
- # else:
98
- # adapter.write_all(Path(FILENAME), metadata)
@@ -39,13 +39,10 @@ def resume(filename):
39
39
 
40
40
  return graph, fingerprint_dict, udfs, recomputation_ces, overlapping_vss
41
41
 
42
- except _pickle.UnpicklingError as e:
43
- print(f"Warning: Checkpoint file is corrupted: {e}")
42
+ except _pickle.UnpicklingError:
44
43
  return DependencyGraph(), {}, set(), {}, []
45
- except EOFError as e:
46
- print(f"Warning: Checkpoint file is incomplete: {e}")
44
+ except EOFError:
47
45
  return DependencyGraph(), {}, set(), {}, []
48
46
 
49
- except Exception as e:
50
- print(f"Error loading checkpoint: {e}")
47
+ except Exception:
51
48
  return DependencyGraph(), {}, set(), {}, []
@@ -160,8 +160,7 @@ def compare_fingerprint(
160
160
  changed = True
161
161
  uncomparable = True
162
162
  fingerprint_list[2] = UncomparableObj()
163
- except Exception as e:
164
- print(e)
163
+ except Exception:
165
164
  # Variable is uncomparable
166
165
  if id_set.intersection(input_variables_id_graph_union):
167
166
  changed = True
@@ -42,20 +42,15 @@ def checkpoint(
42
42
 
43
43
  # Retrieve active VSs from the graph. Active VSs are correspond to the latest instances/versions of each variable.
44
44
  active_vss = set()
45
- print("---------------------------")
46
- print("all variables:")
47
- # print(graph.variable_snapshots)
48
45
  for vs_list in graph.variable_snapshots.values():
49
46
  if not vs_list[-1].deleted:
50
- print(f"name: {vs_list[-1].name}")
51
47
  active_vss.add(vs_list[-1])
52
48
 
53
49
  # Profile the size of each variable defined in the current session.
54
50
  for active_vs in active_vss:
55
51
  # 変数がfingerprint_dictに存在するかチェック
56
52
  if active_vs.name not in fingerprint_dict:
57
- print(f"Warning: Variable '{active_vs.name}' not found in fingerprint_dict")
58
- continue
53
+ pass
59
54
 
60
55
  attr_str = getattr(shell.user_ns[active_vs.name], "__module__", None)
61
56
  # Object is unserializable
@@ -132,27 +127,11 @@ def checkpoint(
132
127
  write_log_location, notebook_name, optimizer_name
133
128
  )
134
129
  opt_end = time.time()
135
- print("---------------------------")
136
- print("variables to migrate:")
137
- for vs in vss_to_migrate:
138
- print(f"name: {vs.name}, size: {vs.size}")
139
130
 
140
131
  difference_start = time.time()
141
132
  vss_to_recompute = active_vss - vss_to_migrate
142
133
  difference_end = time.time()
143
134
 
144
- print("---------------------------")
145
- print("variables to recompute:")
146
- for vs in vss_to_recompute:
147
- print(f"name: {vs.name}, size: {vs.size}")
148
- print([vs.name for vs in vss_to_recompute])
149
-
150
- print("---------------------------")
151
- print("cells to recompute:")
152
- for ce in ces_to_recompute:
153
- print(f"cell num: {ce.cell_num}, cell runtime: {ce.cell_runtime}")
154
- print(sorted([ce.cell_num + 1 for ce in ces_to_recompute]))
155
-
156
135
  optimize_end = time.time()
157
136
  if write_log_location:
158
137
  with open(
@@ -34,9 +34,6 @@ def restore_notebook(
34
34
  recompute_start = time.time()
35
35
  for ce in graph.cell_executions:
36
36
  if ce in ces_to_recompute:
37
- # Rerun cell code; suppress stdout when rerunning.
38
- print("Rerunning cell", ce.cell_num + 1)
39
-
40
37
  # 出力を完全に抑制するための設定
41
38
  ipython = get_ipython()
42
39
 
@@ -68,7 +65,6 @@ def restore_notebook(
68
65
 
69
66
  # Define output variables in the CE.
70
67
  for pair in variables[ce.cell_num]:
71
- print("Declaring variable", pair[0].name)
72
68
  shell.user_ns[pair[0].name] = pair[1]
73
69
 
74
70
  recompute_end = time.time()
@@ -69,9 +69,6 @@ class ElasticNotebook:
69
69
  # Dict for recording overhead of profiling operations.
70
70
  self.profile_dict = {"idgraph": 0, "representation": 0}
71
71
 
72
- # デバッグフラグ
73
- self.debug = False
74
-
75
72
  # マイグレーションと再計算の変数リスト
76
73
  self._vss_to_migrate = []
77
74
  self._vss_to_recompute = []
@@ -95,13 +92,7 @@ class ElasticNotebook:
95
92
  """文字列表現を定義"""
96
93
  return f"マイグレーション対象: {self.vss_to_migrate}\n再計算対象: {self.vss_to_recompute}"
97
94
 
98
- def set_debug(self, debug):
99
- self.debug = debug
100
-
101
95
  def record_event(self, cell):
102
- if self.debug:
103
- print("Recording event...")
104
-
105
96
  pre_execution = set(self.shell.user_ns.keys())
106
97
 
107
98
  # Create id trees for output variables
@@ -215,11 +206,9 @@ class ElasticNotebook:
215
206
  if float(migration_speed) > 0:
216
207
  self.migration_speed_bps = float(migration_speed)
217
208
  self.manual_migration_speed = True
218
- else:
219
- pass
220
- # print("Migration speed is not positive.")
221
209
  except ValueError:
222
- print("Migration speed is not a number.")
210
+ pass
211
+
223
212
  self.selector.migration_speed_bps = self.migration_speed_bps
224
213
 
225
214
  def set_optimizer(self, optimizer):
@@ -247,9 +236,6 @@ class ElasticNotebook:
247
236
 
248
237
  def checkpoint(self, filename):
249
238
  """チェックポイントを作成"""
250
- if self.debug:
251
- print("Checkpointing...")
252
-
253
239
  # Write overhead metrics to file (for experiments).
254
240
  if self.write_log_location:
255
241
  with open(
@@ -312,10 +298,6 @@ class ElasticNotebook:
312
298
  )
313
299
 
314
300
  def load_checkpoint(self, filename):
315
- if self.debug:
316
- print("Loading checkpoint...")
317
-
318
- # start_time = time.time()
319
301
  (
320
302
  self.dependency_graph,
321
303
  variables,
@@ -333,4 +315,3 @@ class ElasticNotebook:
333
315
  self.notebook_name,
334
316
  self.optimizer_name,
335
317
  )
336
- # print("Checkpoint load time:", time.time() - start_time)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "elastic-kernel"
7
- version = "0.0.4"
7
+ version = "0.0.6"
8
8
  description = "Elastic kernel for Jupyter with automatic checkpoint and dependency tracking"
9
9
  authors = [
10
10
  { name = "ryutarom", email = "m2002r1028@icloud.com" }
File without changes
File without changes
File without changes