Implement Git Integration for SqlObserver (#735)#741
Conversation
| repositories = set() | ||
| for r in ex_info["repositories"]: | ||
| repository = Repository.get_or_create(r["url"], r["commit"], r["dirty"], session) | ||
| session.add(repository) |
There was a problem hiding this comment.
Why do the repositories have to be added to the session, whereas the other objects are just obtained via .get_or_create ?
There was a problem hiding this comment.
ex_info["repositories"] can contain multiple identical items (I believe, it's one item per source and multiple sources can come from the same repository) so if .get_or_create is called for each duplicate item before the first one is added to the session, the "repository" table ends up with duplicate repositories.
My understanding is that ex_info["dependencies"] and ex_info["base_dir"] wouldn't have duplicate items in a single experiment so it's enough to check if the items were added during previous experiments.
|
Thanks for the contribution! I am not really an expert on sqlalchemy, but looks clean enough to me, except for the one question that I have. For the CI pipeline to succeed please run the pre-commit hooks as described in https://github.com/IDSIA/sacred/blob/master/CONTRIBUTING.rst |
|
There seems to be some flake8 issue, but it is nothing in your code so I am merging now. |
Implement #735: add tables "repository" and "experiments_repositories" for tracking Git info