Skip to content

Conversation

@ayushjariyal
Copy link
Contributor

issue #6817

Updating the code for additional information to be shown with verdi storage info --detailed by adding the creation time (ctime) and modification time (mtime) of the first and last nodes in the database.

@codecov
Copy link

codecov bot commented Apr 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.27%. Comparing base (ae65e2d) to head (8c08491).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6829      +/-   ##
==========================================
+ Coverage   79.26%   79.27%   +0.01%     
==========================================
  Files         566      566              
  Lines       43794    43798       +4     
==========================================
+ Hits        34711    34715       +4     
  Misses       9083     9083              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ayushjariyal
Copy link
Contributor Author

@GeigerJ2, Can you please review this PR?

@GeigerJ2
Copy link
Contributor

Hi @ayushjariyal, I'm sorry I overlooked this and am just getting back here. Thank you for your contribution! I just rebased the PR to bring it to the current state of the code base. The implementation is good1, could you also add tests for the new functionality? Otherwise, I'm also happy to finalize this (I know it's been long since you opened this). Cheers!

Footnotes

  1. I noticed that the output of verdi storage info might have some additional problems (see verdi archive info CLI output unreadable with large entities_starting_set #6978), but this can probably be solved in a different PR.

@ayushjariyal
Copy link
Contributor Author

Hi @GeigerJ2 , thanks for reviewing and rebasing the PR! I’ll be happy to add the tests for the new functionality. Could you please point me to the appropriate test file or directory where these should be added?

@GeigerJ2
Copy link
Contributor

Regarding the tests, there is a test of the get_info method (test_get_info) which is the only caller of the get_orm_entities method where you added your changes. Going through the callers / references of the relevant functions / methods at hand is a nice way to discover where they are being tested, bc they are actually being called in the tests :)

The test method is located in tests/storage/psql_dos/test_backend.py. Note that to actually run it locally, you need a working PostgreSQL setup on your machine, and use the --db-backend psql option of pytest1. Hence, a command could look something like:

pytest tests/storage/psql_dos/test_backend.py::test_get_info --db-backend psql

You can also add the -s option to allow entering the debugger, if you add a breakpoint in the test. The method uses a get_mock_info to mock the get_info of the DiskObjectStoreRepositoryBackend, but for the ORM backend, the method you modified is called. Then, you can assert that the output you added and expect is present.

Footnotes

  1. These also seem like tests that were historically implemented for PSQL, but don't have to be anymore, so could, in principle, also be run with SQLite, @danielhollas? I just copied this test over to sqlite_dos backend, and it worked the same.

@danielhollas
Copy link
Collaborator

These also seem like tests that were historically implemented for PSQL, but don't have to be anymore, so could, in principle, also be run with SQLite, @danielhollas?

Absolutely! When I was first introducing sqlite-based tests I took a shortcut and automatically marked all tests in tests/storage/psql_dos/ with requires_psql marker. Would you mind opening an issue for this? We should audit all tests in that directory and move any that are backend-agnostic. I'd definitely do that in another PR though.

@GeigerJ2
Copy link
Contributor

@ayushjariyal, do you have time to work on this? Otherwise, I can also add the tests and we share authorship on the PR? Would like to wrap it up soon :)

@ayushjariyal
Copy link
Contributor Author

@GeigerJ2 , I’m a bit caught up with college work right now, so please go ahead and add the tests. Happy to share authorship on the PR—thanks a lot for helping wrap this up!

@GeigerJ2 GeigerJ2 changed the title Adding additional information to be shown with verdi storage info --detailed Improve information shown with verdi storage info (--detailed) Sep 3, 2025
@GeigerJ2 GeigerJ2 requested a review from danielhollas October 6, 2025 07:29
@GeigerJ2 GeigerJ2 changed the title Improve information shown with verdi storage info (--detailed) Show first and last node ctime for verdi storage info --detailed Oct 6, 2025
@GeigerJ2
Copy link
Contributor

GeigerJ2 commented Oct 6, 2025

@danielhollas, maybe you can give this a quick review? Should be simple enough. While this is technically a new feature, and could go into 2.8.0, I think the changes are minor enough that we can put it into 2.7.2. An ASCII histogram of node creation time as written in #6817 (and brought up by Giovanni) seems a bit overkill for now, there are more pressing things to work on.

@GeigerJ2
Copy link
Contributor

GeigerJ2 commented Oct 6, 2025

OK, change of mind. Moved this to 2.8.0. New feature, minor release. Let's follow SemVer properly...

@danielhollas
Copy link
Collaborator

OK, change of mind. Moved this to 2.8.0. New feature, minor release. Let's follow SemVer properly...

Haha, I was gonna write something, now I don't have to (see comment on Discourse :-) ).
But I'll give this a look and we can merge!

.first(flat=True)
)

data['Nodes']['first_created'] = str(first_time) if first_time else None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing None if there are no Nodes results in the following output from verdi storage info --detailed

  Nodes:
    count: 0
    first_created: null
    last_created: null
    node_types: []
    process_types: []

an alternative would be to pass en empty string, which would then look like this:

  Nodes:
    count: 0
    first_created: ''
    last_created: ''
    node_types: []
    process_types: []

I think None makes sense here. cc @GeigerJ2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed, I think null is fine :3
As always, thanks for the review, @danielhollas 🫶

Copy link
Collaborator

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tweaked the test and tested locally, looks great, thanks @ayushjariyal! 🙏

@GeigerJ2 GeigerJ2 merged commit f9566a4 into aiidateam:main Oct 6, 2025
16 checks passed
@danielhollas danielhollas mentioned this pull request Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Additional information to be shown with verdi storage info --detailed

3 participants