File size: 3,031 Bytes
8629351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0651a98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8629351
55057e3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# This is a standalone reconciliation utility script that helps verify if the 
# local fallback system actually worked and successfully pushed those temporary 
# entries to the cloud backup. It checks the live sync status of the repository
from huggingface_hub import HfApi
from datetime import datetime

def check_dataset_sync(hf_token=None):
    api = HfApi(token=hf_token)
    repo_id = "toecm/PureChain_Dataset"
    
    print(f"🔍 Checking sync status for cloud repository: {repo_id}\n")
    
    try:
        # 1. Check if the files actually exist in the cloud
        files = api.list_repo_files(repo_id=repo_id, repo_type="dataset")
        print("📁 Files currently synced in the cloud:")
        for f in files:
            if f.endswith('.csv') or f.endswith('.json'):
                print(f"  └─ {f}")
                
        # 2. Check the most recent automated pushes (commits)
        print("\n🕒 Recent Sync History:")
        commits = api.list_repo_commits(repo_id=repo_id, repo_type="dataset")
        
        # Display the last 3 pushes
        for commit in commits[:3]:
            # Formatting the timestamp for readability
            time_str = commit.created_at.strftime("%Y-%m-%d %H:%M:%S")
            print(f"  [{time_str}] {commit.title}")
            
    except Exception as e:
        print(f"❌ Sync Check Failed: {e}")
        print("Make sure the repository is created and your token has Read access.")

import os# This is a standalone reconciliation utility script that helps verify if the 
# local fallback system actually worked and successfully pushed those temporary 
# entries to the cloud backup. It checks the live sync status of the repository
from huggingface_hub import HfApi
from datetime import datetime

def check_dataset_sync(hf_token=None):
    api = HfApi(token=hf_token)
    repo_id = "toecm/PureChain_Dataset"
    
    print(f"🔍 Checking sync status for cloud repository: {repo_id}\n")
    
    try:
        # 1. Check if the files actually exist in the cloud
        files = api.list_repo_files(repo_id=repo_id, repo_type="dataset")
        print("📁 Files currently synced in the cloud:")
        for f in files:
            if f.endswith('.csv') or f.endswith('.json'):
                print(f"  └─ {f}")
                
        # 2. Check the most recent automated pushes (commits)
        print("\n🕒 Recent Sync History:")
        commits = api.list_repo_commits(repo_id=repo_id, repo_type="dataset")
        
        # Display the last 3 pushes
        for commit in commits[:3]:
            # Formatting the timestamp for readability
            time_str = commit.created_at.strftime("%Y-%m-%d %H:%M:%S")
            print(f"  [{time_str}] {commit.title}")
            
    except Exception as e:
        print(f"❌ Sync Check Failed: {e}")
        print("Make sure the repository is created and your token has Read access.")

# Run the checker
check_dataset_sync("HF_TOKEN") 
# Run the checker
check_dataset_sync(os.environ.get("HF_TOKEN"))