darabos commited on
Commit
0a1ce7e
·
1 Parent(s): 9c715bc

Avoid execution for unchanged workspaces.

Browse files
lynxkite-app/src/lynxkite_app/crdt.py CHANGED
@@ -54,6 +54,10 @@ class WebsocketServer(pycrdt_websocket.WebsocketServer):
54
  # We have two possible sources of truth for the workspaces, the YStore and the JSON files.
55
  # In case we didn't find the workspace in the YStore, we try to load it from the JSON files.
56
  try_to_load_workspace(ws, name)
 
 
 
 
57
  room = pycrdt_websocket.YRoom(
58
  ystore=ystore, ydoc=ydoc, exception_handler=ws_exception_handler
59
  )
 
54
  # We have two possible sources of truth for the workspaces, the YStore and the JSON files.
55
  # In case we didn't find the workspace in the YStore, we try to load it from the JSON files.
56
  try_to_load_workspace(ws, name)
57
+ ws_simple = workspace.Workspace.model_validate(ws.to_py())
58
+ clean_input(ws_simple)
59
+ # Set the last known version to the current state, so we don't trigger a change event.
60
+ last_known_versions[name] = ws_simple
61
  room = pycrdt_websocket.YRoom(
62
  ystore=ystore, ydoc=ydoc, exception_handler=ws_exception_handler
63
  )
lynxkite-core/src/lynxkite/core/ops.py CHANGED
@@ -126,7 +126,6 @@ def basic_outputs(*names):
126
 
127
  def _param_to_type(name, value, type):
128
  value = value or ""
129
- print(f'Converting "{name}" {value} to {type}')
130
  if type is int:
131
  assert value != "", f"{name} is unset."
132
  return int(value)
@@ -158,7 +157,6 @@ class Op(BaseConfig):
158
  for p in params:
159
  if p in self.params:
160
  params[p] = _param_to_type(p, params[p], self.params[p].type)
161
- print(self.name, p, params[p])
162
  res = self.func(*inputs, **params)
163
  if not isinstance(res, Result):
164
  # Automatically wrap the result in a Result object, if it isn't already.
 
126
 
127
  def _param_to_type(name, value, type):
128
  value = value or ""
 
129
  if type is int:
130
  assert value != "", f"{name} is unset."
131
  return int(value)
 
157
  for p in params:
158
  if p in self.params:
159
  params[p] = _param_to_type(p, params[p], self.params[p].type)
 
160
  res = self.func(*inputs, **params)
161
  if not isinstance(res, Result):
162
  # Automatically wrap the result in a Result object, if it isn't already.