[Notes] [Git][BuildGrid/buildgrid][santi/155-repeated-digest-status-msgs-fix] upload_{file, directory}(): fix status messages



Title: GitLab

Santiago Gil pushed to branch santi/155-repeated-digest-status-msgs-fix at BuildGrid / buildgrid

Commits:

1 changed file:

Changes:

  • buildgrid/_app/commands/cmd_cas.py
    ... ... @@ -82,7 +82,7 @@ def upload_dummy(context):
    82 82
                   help="Check uploaded files integrity.")
    
    83 83
     @pass_context
    
    84 84
     def upload_file(context, file_path, verify):
    
    85
    -    sent_digests, files_map = [], {}
    
    85
    +    sent_digests = []
    
    86 86
         with upload(context.channel, instance=context.instance_name) as uploader:
    
    87 87
             for path in file_path:
    
    88 88
                 if not os.path.isabs(path):
    
    ... ... @@ -91,11 +91,9 @@ def upload_file(context, file_path, verify):
    91 91
     
    
    92 92
                 file_digest = uploader.upload_file(path, queue=True)
    
    93 93
     
    
    94
    -            files_map[file_digest.hash] = path
    
    95
    -            sent_digests.append(file_digest)
    
    94
    +            sent_digests.append((file_digest, path))
    
    96 95
     
    
    97
    -    for file_digest in sent_digests:
    
    98
    -        file_path = os.path.relpath(files_map[file_digest.hash])
    
    96
    +    for (file_digest, file_path) in sent_digests:
    
    99 97
             if verify and file_digest.size_bytes != os.stat(file_path).st_size:
    
    100 98
                 click.echo("Error: Failed to verify '{}'".format(file_path), err=True)
    
    101 99
             elif file_digest.ByteSize():
    
    ... ... @@ -111,7 +109,7 @@ def upload_file(context, file_path, verify):
    111 109
                   help="Check uploaded directory's integrity.")
    
    112 110
     @pass_context
    
    113 111
     def upload_directory(context, directory_path, verify):
    
    114
    -    sent_digests, nodes_map = [], {}
    
    112
    +    sent_digests = []
    
    115 113
         with upload(context.channel, instance=context.instance_name) as uploader:
    
    116 114
             for node, blob, path in merkle_tree_maker(directory_path):
    
    117 115
                 if not os.path.isabs(path):
    
    ... ... @@ -119,12 +117,9 @@ def upload_directory(context, directory_path, verify):
    119 117
                 click.echo("Queueing path=[{}]".format(path))
    
    120 118
     
    
    121 119
                 node_digest = uploader.put_blob(blob, digest=node.digest, queue=True)
    
    120
    +            sent_digests.append((node_digest, path))
    
    122 121
     
    
    123
    -            nodes_map[node.digest.hash] = path
    
    124
    -            sent_digests.append(node_digest)
    
    125
    -
    
    126
    -    for node_digest in sent_digests:
    
    127
    -        node_path = nodes_map[node_digest.hash]
    
    122
    +    for node_digest, node_path in sent_digests:
    
    128 123
             if not os.path.isabs(directory_path):
    
    129 124
                 node_path = os.path.relpath(node_path)
    
    130 125
             if verify and (os.path.isfile(node_path) and
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]