Skip to content

Commit

Permalink
Clean up of cracking-time approximation PR
Browse files Browse the repository at this point in the history
  • Loading branch information
alpatron committed Aug 16, 2024
1 parent e157988 commit 0582c62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions webadmin/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ David Bolvansky
Radek Hranicky
Viktor Rucky
Jiri Mladek
Lucie Jadrna
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Author: Lucie Jadrná
'''
* Author : Lucie Jadrná and authors listed in AUTHORS
* Licence: MIT, see LICENSE
'''


import math
import datetime
Expand Down Expand Up @@ -46,6 +50,7 @@ def compute_hostkeyspace_from_tp(tp, powers, total_keyspace):
host_keyspaces.append([min(tp * power, total_keyspace), power, 1])
return host_keyspaces


def which_node_will_compute(host_keyspaces, total_keyspace):
"""
Determine which nodes will compute based on their keyspaces and the total keyspace.
Expand All @@ -60,7 +65,6 @@ def which_node_will_compute(host_keyspaces, total_keyspace):
keyspaces_of_computing_nodes = []

sum_host_keyspaces = sum(keyspace[0] for keyspace in host_keyspaces)
print("sum keyspaces: ",sum_host_keyspaces)

if sum_host_keyspaces > total_keyspace:

Expand Down Expand Up @@ -101,7 +105,7 @@ def which_node_will_compute(host_keyspaces, total_keyspace):

if cut_total_keyspace - sum_keyspaces < 0:
while host_keyspaces and (cut_total_keyspace - max(keyspace[0] for keyspace in host_keyspaces) >= 0):
x = max(keyspace[0] for keyspace in host_keyspaces) # největší keyspace
x = max(keyspace[0] for keyspace in host_keyspaces) # largest keyspace

for i,sublist in enumerate(host_keyspaces):
if sublist[0] == x:
Expand All @@ -123,7 +127,6 @@ def which_node_will_compute(host_keyspaces, total_keyspace):
return keyspaces_of_computing_nodes



def compute_estimate_forall(list_key_power_wu, wu_overhead):
"""
Calculates the estimated time for all computing hosts and returns the maximum.
Expand All @@ -140,6 +143,3 @@ def compute_estimate_forall(list_key_power_wu, wu_overhead):
list_times.append((list[0] / list[1]) + (list[2] + 1) * wu_overhead + 34)

return max(list_times)



0 comments on commit 0582c62

Please sign in to comment.