darabos commited on
Commit
8ec5a6c
·
1 Parent(s): e35340d

Better error messages for wrong types in graph analytics workspaces.

Browse files
lynxkite-graph-analytics/src/lynxkite_graph_analytics/core.py CHANGED
@@ -224,12 +224,16 @@ async def _execute_node(
224
  missing.append(p.name)
225
  continue
226
  x = input_map[p.name]
227
- if p.type == nx.Graph and isinstance(x, Bundle):
228
- x = x.to_nx()
229
- elif p.type == Bundle and isinstance(x, nx.Graph):
230
- x = Bundle.from_nx(x)
231
- elif p.type == Bundle and isinstance(x, pd.DataFrame):
232
- x = Bundle.from_df(x)
 
 
 
 
233
  inputs.append(x)
234
  except Exception as e:
235
  if not os.environ.get("LYNXKITE_SUPPRESS_OP_ERRORS"):
 
224
  missing.append(p.name)
225
  continue
226
  x = input_map[p.name]
227
+ if p.type == nx.Graph:
228
+ if isinstance(x, Bundle):
229
+ x = x.to_nx()
230
+ assert isinstance(x, nx.Graph), "Input must be a graph."
231
+ elif p.type == Bundle:
232
+ if isinstance(x, nx.Graph):
233
+ x = Bundle.from_nx(x)
234
+ elif isinstance(x, pd.DataFrame):
235
+ x = Bundle.from_df(x)
236
+ assert isinstance(x, Bundle), "Input must be a graph or dataframe."
237
  inputs.append(x)
238
  except Exception as e:
239
  if not os.environ.get("LYNXKITE_SUPPRESS_OP_ERRORS"):