Question about nested types: I have a task that re...
# flytekit
t
Question about nested types: I have a task that receives
List[Dict[str, pd.DataFrame]]
and get the following error:
Copy code
File ".../flytekit/core/type_engine.py", line 810, in to_python_value
    return [TypeEngine.to_python_value(ctx, x, st) for x in lv.collection.literals]
AttributeError: 'NoneType' object has no attribute 'literals'
Flytekit version 0.31.0 - more context in comments
1
Dropping a debugger I had a look at the contents of
lv
It's of type
<class 'flytekit.models.literals.Literal'>
and its repr looks like this. Seems good.
Copy code
map {
  literals {
    key: "test"
    value {
      scalar {
        schema {
          uri: "/tmp/flyte/20220315_160809/raw/c1a4e74d72cf284e9ca6d9a11e3fabed"
          type {
          }
        }
      }
    }
  }
  literals {
    key: "train"
    value {
      scalar {
        schema {
          uri: "/tmp/flyte/20220315_160809/raw/d529c0a999b5bdc655ac891f37e56d07"
          type {
          }
        }
      }
    }
  }
  literals {
    key: "val"
    value {
      scalar {
        schema {
          uri: "/tmp/flyte/20220315_160809/raw/9479a5b5a6c48acdc882d17abb676161"
          type {
          }
        }
      }
    }
  }
}
But yeah its
.collection
attribute is None
k
This seems to be the inner map instead of a collection
This is not a list
Where did you get the Lv from?
t
Debugger in this function in
type_engine.py
line 808-810
Copy code
def to_python_value(self, ctx: FlyteContext, lv: Literal, expected_python_type: Type[T]) -> typing.List[T]:
        st = self.get_sub_type(expected_python_type)
        return [TypeEngine.to_python_value(ctx, x, st) for x in lv.collection.literals]
k
I meant can you share code, it seems oncoming is just a map
t
Got it, my fault, mismatch of List[Dict] and simple Dict, was refactoring a maptask to dynamic 🤦
k
But failure in compilation or registration
Am I think you should file a bug low priority
t
It was totally my fault, but I wouldn't have noticed for a long time without your comment. I'll keep observing this and see if I can come up with a suggestion for giving clearer error messages here.
179 Views