kailash 0.2.0__py3-none-any.whl → 0.2.2__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.
@@ -332,12 +332,35 @@ class DataTransformer(Node):
332
332
  }, # Support for up to 5 additional arguments
333
333
  }
334
334
 
335
+ def validate_inputs(self, **kwargs) -> Dict[str, Any]:
336
+ """Override validate_inputs to accept arbitrary parameters for transformations.
337
+
338
+ DataTransformer needs to accept any input parameters that might be mapped
339
+ from other nodes, not just the predefined parameters in get_parameters().
340
+ This enables flexible data flow in workflows.
341
+ """
342
+ # First, do the standard validation for defined parameters
343
+ validated = super().validate_inputs(**kwargs)
344
+
345
+ # Then, add any extra parameters that aren't in the schema
346
+ # These will be passed to the transformation context
347
+ defined_params = set(self.get_parameters().keys())
348
+ for key, value in kwargs.items():
349
+ if key not in defined_params:
350
+ validated[key] = value # Accept arbitrary additional parameters
351
+
352
+ return validated
353
+
335
354
  def run(self, **kwargs) -> Dict[str, Any]:
336
355
  # Extract the transformation functions
337
356
  transformations = kwargs.get("transformations", [])
338
357
  if not transformations:
339
358
  return {"result": kwargs.get("data", [])}
340
359
 
360
+ # Debug: Check what kwargs we received
361
+ print(f"DATATRANSFORMER RUN DEBUG: kwargs keys = {list(kwargs.keys())}")
362
+ print(f"DATATRANSFORMER RUN DEBUG: kwargs = {kwargs}")
363
+
341
364
  # Get all input data
342
365
  input_data = {}
343
366
  for key, value in kwargs.items():
@@ -371,6 +394,14 @@ class DataTransformer(Node):
371
394
  local_vars = input_data.copy()
372
395
  local_vars["result"] = result
373
396
 
397
+ # Debug: Print available variables
398
+ print(
399
+ f"DataTransformer DEBUG - Available variables: {list(local_vars.keys())}"
400
+ )
401
+ print(
402
+ f"DataTransformer DEBUG - Input data keys: {list(input_data.keys())}"
403
+ )
404
+
374
405
  # Execute the code block
375
406
  exec(transform_str, safe_globals, local_vars) # noqa: S102
376
407
 
kailash/runtime/local.py CHANGED
@@ -399,8 +399,13 @@ class LocalRuntime:
399
399
  source_node_id = edge[0]
400
400
  mapping = edge[2].get("mapping", {})
401
401
 
402
+ print(f"LOCAL RUNTIME DEBUG: Processing edge {source_node_id} -> {node_id}")
403
+ print(f" Edge data: {edge[2]}")
404
+ print(f" Mapping: {mapping}")
405
+
402
406
  if source_node_id in node_outputs:
403
407
  source_outputs = node_outputs[source_node_id]
408
+ print(f" Source outputs: {list(source_outputs.keys())}")
404
409
 
405
410
  # Check if the source node failed
406
411
  if isinstance(source_outputs, dict) and source_outputs.get("failed"):
@@ -411,11 +416,19 @@ class LocalRuntime:
411
416
  for source_key, target_key in mapping.items():
412
417
  if source_key in source_outputs:
413
418
  inputs[target_key] = source_outputs[source_key]
419
+ print(
420
+ f" MAPPED: {source_key} -> {target_key} (type: {type(source_outputs[source_key])})"
421
+ )
414
422
  else:
423
+ print(
424
+ f" MISSING: {source_key} not in {list(source_outputs.keys())}"
425
+ )
415
426
  self.logger.warning(
416
427
  f"Source output '{source_key}' not found in node '{source_node_id}'. "
417
428
  f"Available outputs: {list(source_outputs.keys())}"
418
429
  )
430
+ else:
431
+ print(f" No outputs found for source node {source_node_id}")
419
432
 
420
433
  # Apply parameter overrides
421
434
  inputs.update(parameters)
@@ -229,7 +229,7 @@ class AdaptiveCondition(ConvergenceCondition):
229
229
 
230
230
 
231
231
  def create_convergence_condition(
232
- spec: Union[str, int, Callable, Dict]
232
+ spec: Union[str, int, Callable, Dict],
233
233
  ) -> ConvergenceCondition:
234
234
  """Factory function to create convergence conditions from various specs.
235
235