Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you get the git commit hash from a run when queried from a repository? #3198

Closed
sbuschjaeger opened this issue Jul 29, 2024 · 2 comments
Labels
type / question Issue type: question

Comments

@sbuschjaeger
Copy link

Basically as the title says: How do you get the git commit hash from a run when queried from a repository?

I know that I can store the git commit via

run = Run(
      repo = path_to_repo,
      experiment = "experiment_name",
      log_system_params = True
)

and I can see the Git Info Card in the web interface.

However, when I try to query the git commit via the SDK:

repo = Repo(path_to_repo)
tag = "success"
# Run a basic query
query = f'"{tag}" in run.tags"
runs = [item.run for item in repo.query_runs(query, report_mode=0).iter_runs()]
for run in tqdm.tqdm(runs, desc=f"Extracting runs"):
    commit = run.__system_params.git_info.commit
    # more code

then I get the error AttributeError: 'Run' object has no attribute '__system_params'. Again, the same query from the webui works just fine. I debugged through the Run object a little bit, but could not find any meaningful fields / members.

For reference, I am using aim 3.23.0:

aim                3.23.0
aim-ui             3.23.0
aimrecords         0.0.7
aimrocks           0.5.2
@sbuschjaeger sbuschjaeger added the type / question Issue type: question label Jul 29, 2024
@alberttorosyan
Copy link
Member

Hey @sbuschjaeger! Thanks for the question.
This behavior is expected, as the dot-based syntax is only available in the context of queries, as part of the query expression.
Instead, the following syntax should be used:

commit = run['__system_params', 'git_info', 'commit']

@sbuschjaeger
Copy link
Author

Ah okay. Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type / question Issue type: question
Projects
None yet
Development

No branches or pull requests

2 participants