Run labels as runs DataFrame columns?

Hi there,

is it currently possible to show all run labels as columns in the ipy guild interface?
My current workflow is somewhat hacky:

import guild.ipy as guild

# All runs
runs = guild.runs()
runs = runs.loc[(runs.status == "completed")]

import pandas as pd

labels = pd.DataFrame.from_records(runs.label.apply(lambda x: x.split(" ")).apply(lambda x: {kv[0]: kv[1] for label in x
                                                                                        if (kv := label.split("="))}))

If not, I’d be happy to submit a patch if pointed towards the correct location.


Hi @Alessandro.

From your code example, it looks like you’re getting the flag values for each run by way of the run label. Are you wanting runs for the data frame? As you’re showing there, the label is in the data frame as the ‘label’ column.

If you’re looking for flags, there are a few ways that occur to me…

  1. Use runs.guild_flags(), which returns a data frame of flags along with the run ID for each run.

  2. Use for a data frame with flags and also scalars (this mirrors the guild compare command).

  3. Use a comprehension over the rows in runs, using .run.value (which returns object) to explicitly read the flag values as a dict for each run. This uses a lower level interface that’s stable, so you can rely on this:

    flags = [(,"flags"))
             for _index, row in runs.iterrows()]

This returns a list of tuples of run ID and run flags. Note"flags") — this calls get() on the low level Guild run object, which reads the flags run attribute.

If I’m misunderstanding your request, please let me know!


runs.guild_flags() is exactly what I needed. Thank you a thousand times!

1 Like