def list_tracks(cfg): console.println("Available tracks:\n") console.println(tabulate.tabulate( tabular_data=[ [t.name, t.short_description, t.number_of_documents, convert.bytes_to_human_string(t.compressed_size_in_bytes), convert.bytes_to_human_string(t.uncompressed_size_in_bytes), t.default_challenge, ",".join(map(str, t.challenges))] for t in tracks(cfg) ], headers=["Name", "Description", "Documents", "Compressed Size", "Uncompressed Size", "Default Challenge", "All Challenges"]))
def list_tracks(cfg): console.println("Available tracks:\n") console.println(tabulate.tabulate( tabular_data=[ [t.name, t.description, t.number_of_documents, convert.bytes_to_human_string(t.compressed_size_in_bytes), convert.bytes_to_human_string(t.uncompressed_size_in_bytes), t.default_challenge, ",".join(map(str, t.challenges))] for t in tracks(cfg) ], headers=["Name", "Description", "Documents", "Compressed Size", "Uncompressed Size", "Default Challenge", "All Challenges"]))
def __call__(self, bytes_read, bytes_total): if bytes_total: completed = bytes_read / bytes_total total_as_mb = convert.bytes_to_human_string(bytes_total) self.p.print("%s (%s total size)" % (self.msg, total_as_mb), self.percent_format % (completed * 100)) else: self.p.print(self.msg, ".")
def __call__(self, bytes_read, bytes_total): from esrally.utils import convert completed = bytes_read / bytes_total total_as_mb = convert.bytes_to_human_string(bytes_total) self.p.print("%s (%s total size)" % (self.msg, total_as_mb), self.percent_format % (completed * 100))
def test_negative_gb(self): assert convert.bytes_to_human_string(-881348666323) == "-820.8 GB" assert convert.bytes_to_human_value( -881348666323) == -820.8199090538546 assert convert.bytes_to_human_unit(-881348666323) == "GB"
def test_positive_gb(self): assert convert.bytes_to_human_string(8808812123) == "8.2 GB" assert convert.bytes_to_human_value(8808812123) == 8.2038455856964 assert convert.bytes_to_human_unit(8808812123) == "GB"
def test_negative_mb(self): assert convert.bytes_to_human_string(-881348666) == "-840.5 MB" assert convert.bytes_to_human_value(-881348666) == -840.5195865631104 assert convert.bytes_to_human_unit(-881348666) == "MB"
def test_positive_mb(self): assert convert.bytes_to_human_string(8808812) == "8.4 MB" assert convert.bytes_to_human_value(8808812) == 8.400737762451172 assert convert.bytes_to_human_unit(8808812) == "MB"
def test_negative_kb(self): assert convert.bytes_to_human_string(-88134) == "-86.1 kB" assert convert.bytes_to_human_value(-88134) == -86.068359375 assert convert.bytes_to_human_unit(-88134) == "kB"
def test_positive_kb(self): assert convert.bytes_to_human_string(8808) == "8.6 kB" assert convert.bytes_to_human_value(8808) == 8.6015625 assert convert.bytes_to_human_unit(8808) == "kB"
def test_negative_bytes(self): assert convert.bytes_to_human_string(-100) == "-100 bytes" assert convert.bytes_to_human_value(-100) == -100 assert convert.bytes_to_human_unit(-100) == "bytes"
def test_positive_bytes(self): assert convert.bytes_to_human_string(100) == "100 bytes" assert convert.bytes_to_human_value(100) == 100 assert convert.bytes_to_human_unit(100) == "bytes"
def test_none(self): assert convert.bytes_to_human_string(None) == "N/A" assert convert.bytes_to_human_value(None) is None assert convert.bytes_to_human_unit(None) == "N/A"