Add custom attrs

Looking into one of my guild runs

$ ls -lahGg ~/mypath/.guild/runs/5c615b8060734a81b270547a4b77910c/.guild/attrs/

-rw-r--r-- 1 1.1K Jun  7 06:16 cmd
-rw-r--r-- 1  101 Jun  7 06:27 comments
-rw-r--r-- 1  245 Jun  7 06:16 deps
-rw-r--r-- 1 6.4K Jun  7 06:16 env
-rw-r--r-- 1    2 Jun  7 06:16 exit_status
-rw-r--r-- 1  728 Jun  7 06:16 flags
-rw-r--r-- 1   21 Jun  7 06:16 host
-rw-r--r-- 1    6 Jun  7 06:16 id
-rw-r--r-- 1   17 Jun  7 06:16 initialized
-rw-r--r-- 1    9 Jun  7 06:29 label
-rw-r--r-- 1  894 Jun  7 06:16 op
-rw-r--r-- 1 7.0K Jun  7 06:16 pip_freeze
-rw-r--r-- 1  239 Jun  7 06:16 platform
-rw-r--r-- 1   11 Jun  7 06:16 random_seed
-rw-r--r-- 1  890 Jun  7 06:16 run_params
-rw-r--r-- 1   33 Jun  7 06:16 sourcecode_digest
-rw-r--r-- 1   17 Jun  7 06:16 started
-rw-r--r-- 1   17 Jun  7 06:16 stopped
-rw-r--r-- 1    6 Jun  7 06:16 user
-rw-r--r-- 1    3 Jun  7 06:16 user_flags
-rw-r--r-- 1   46 Jun  7 06:16 vcs_commi

I see that guild is saving a lot of useful information. I was wondering if there is any way to expand on this ourselves? Say for an example I want to save

apt list > apt_freeze

For all my guild runs and add it to the attrs directory.

Is there a way to do this now?

My apologies for the very late reply!

You can write any YAML or JSON formatted file into .guild/attrs to add new attributes. These will show up automatically when you run guild runs info for a run. You can also read the attribute back using custom code as you like.

E.g.

apt_info = read_apt_info()
json.dump(apt_info, open(".guild/attrs/apt_freeze", "w"))
json.dump(123, open(".guild/attrs/test", "w"))

If you write numerical or simple strings as an attribute, you can include the attribute in compare lists.

guild compare -cc test

Another approach is to simply write the contents to the run directory. You’ll have it there are a record and be able to diff/compare.

1 Like