Created
January 5, 2026 13:01
-
-
Save alonho/7f21d23cac14d3cf0ec6ee821ca8e6a1 to your computer and use it in GitHub Desktop.
Example invocation: python3 dir_atime.py --user=$VMS_USER --password=$VMS_PASSWORD --address=$VMS_ADDRESS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| import logging | |
| import vastpy | |
| logger = logging.getLogger(__name__) | |
| def main(): | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-d', '--directory', default='/', type=str) | |
| parser.add_argument('-u', '--user', required=True, type=str) | |
| parser.add_argument('-p', '--password', required=True, type=str) | |
| parser.add_argument('-a', '--address', required=True, type=str) | |
| args = parser.parse_args() | |
| logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s') | |
| client = vastpy.VASTClient(user=args.user, password=args.password, address=args.address) | |
| print_dir_capacity(client, args.directory) | |
| def print_dir_capacity(client, dir): | |
| for path, details in sorted(client.capacity.get(path=dir)['details']): | |
| print(f"path: {path} used_physical_space: {details['data'][0]} average_atime: {details['average_atime']}") | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment