• Dylan Wilder

    Dylan Wilder

    3 months ago
    is there a flyte literal parser utility to produce the json that gets surfaced in the flyte UI?
  • Yee

    Yee

    3 months ago
    there’s an informal one that I use. but it’s more of an internal utilty for us.
  • wait, what do you mean by literal parser?
  • sorry - i was referring to parsing protobufs
  • Dylan Wilder

    Dylan Wilder

    3 months ago
    yea i just want something that produces a user friendly json, minus the literal wrappers
  • if you can just point us to code that's cool too
  • and we can reproduce
  • as long as it's not go 😄
  • Yee

    Yee

    3 months ago
    for which object?
  • a task?
  • or like a flyte literal integer 3
  • Dylan Wilder

    Dylan Wilder

    3 months ago
    the latter
  • LiteralMap -> json, or dict etc
  • Yee

    Yee

    3 months ago
    i mean… the command I use is this
  • flyte-cli parse-proto -f map_input.pb -p flyteidl.core.literals_pb2.LiteralMap
  • and you can take a peek at the code, it’s not much
  • this is all it does
  • it’s dumb because you have to know what type of protobuf you have.
  • Dylan Wilder

    Dylan Wilder

    3 months ago
    Ah but this containers the literal types like primitive stringvalue etc
  • Yee

    Yee

    3 months ago
    oh you want a normal representation?
  • there’s nothing for that, short of converting them into pure python native values, but that’s complicated.
  • Dylan Wilder

    Dylan Wilder

    3 months ago
    Yea literally what appears in flyte console
  • Yee

    Yee

    3 months ago
    unf that’s probably done in js/ts only
  • can ask nastya if you’d like?
  • Dylan Wilder

    Dylan Wilder

    3 months ago
    That's fine. Just need the example
  • Yee

    Yee

    3 months ago
    the code that does this?
  • Dylan Wilder

    Dylan Wilder

    3 months ago
    Yes
  • Yee

    Yee

    3 months ago
    @Nastya Rusina or @Carina Ursu - can you point us to the JS/TS code that prettifies the flyte literal values? so that you don’t get “Literal(Scalar(Primitive(….”
  • Nastya Rusina

    Nastya Rusina

    3 months ago
    Carina could be a better person to check with as she is literally makes it better right now 😃
  • Carina Ursu

    Carina Ursu

    3 months ago
    @Dylan Wilder our existing code is processing the json directly into ui, you can look here as an entry point https://github.com/flyteorg/flyteconsole/blob/master/src/components/Literals/LiteralMapViewer.tsx The current change in progress would simplify the structure and then display it in the UI as raw json https://github.com/flyteorg/flyteconsole/pull/445 (entrypoint through src/components/Literals/helpers.ts : transformLiteralMap)
  • Ketan (kumare3)

    Ketan (kumare3)

    3 months ago
    @Dylan Wilder there is some stuff in golang
  • this is what powers Flytectl
  • Dylan Wilder

    Dylan Wilder

    3 months ago
    thanks ketan, this is what i was looking for! i had written this a while back but lost the code 🙂