@@ -76,7 +76,7 @@ def get_timewindow(self, flowtime, profileid):
7676 belong to that tw
7777 if it is == the end of a tw, it will belong to the next one
7878 for example,
79- a flow with ts = 2 belongs to tw1
79+ a flow with ts = 2 belongs to tw2
8080 a flow with ts = 4 belongs to tw3
8181
8282 tw1 tw2 tw3 tw4
@@ -1178,6 +1178,7 @@ def get_modified_profiles_since(
11781178 time_of_last_modified_tw : float = modified_tws [- 1 ][- 1 ]
11791179
11801180 # this list will store modified profiles without tws
1181+ # this is a list of ips. not profileids
11811182 profiles = []
11821183 profiles .extend (
11831184 modified_tw [0 ].split ("_" )[1 ] for modified_tw in modified_tws
@@ -1472,32 +1473,35 @@ def add_profile(self, profileid, starttime):
14721473 self .print (type (inst ), 0 , 1 )
14731474 self .print (inst , 0 , 1 )
14741475
1475- def set_profile_module_label (self , profileid , module , label ):
1476+ def set_module_label_for_profile (self , profileid , module , label ):
14761477 """
14771478 Set a module label for a profile.
14781479 A module label is a label set by a module, and not
14791480 a groundtruth label
14801481 """
1481- data = self .get_profile_modules_labels (profileid )
1482+ data = self .get_modules_labels_of_a_profile (profileid )
14821483 data [module ] = label
14831484 data = json .dumps (data )
14841485 self .r .hset (profileid , "modules_labels" , data )
14851486
14861487 def check_tw_to_close (self , close_all = False ):
14871488 """
1488- Check if we should close some TW
1489- Search in the modifed tw list and compare when they
1489+ Check if we should close a TW
1490+ Search in the modified tw list and compare when they
14901491 were modified with the slips internal time
14911492 """
14921493
14931494 sit = self .get_slips_internal_time ()
14941495
1495- # for each modified profile
1496+ # sit is the ts of the last tw modification detected by slips
1497+ # so this line means if 1h(width) passed since the last
1498+ # modification detected, then it's time to close the tw
14961499 modification_time = float (sit ) - self .width
14971500 if close_all :
14981501 # close all tws no matter when they were last modified
14991502 modification_time = float ("inf" )
15001503
1504+ # these are the tws that havent been modified in the last 1h
15011505 profiles_tws_to_close = self .r .zrangebyscore (
15021506 self .constants .MODIFIED_TIMEWINDOWS ,
15031507 0 ,
@@ -1675,15 +1679,7 @@ def add_tuple(
16751679 )
16761680 self .print (traceback .format_exc (), 0 , 1 )
16771681
1678- def get_tws_to_search (self , go_back ):
1679- tws_to_search = float ("inf" )
1680-
1681- if go_back :
1682- hrs_to_search = float (go_back )
1683- tws_to_search = self .get_equivalent_tws (hrs_to_search )
1684- return tws_to_search
1685-
1686- def get_profile_modules_labels (self , profileid ):
1682+ def get_modules_labels_of_a_profile (self , profileid ):
16871683 """
16881684 Get labels set by modules in the profile.
16891685 """
@@ -1710,7 +1706,7 @@ def get_timeline_last_lines(
17101706 key = str (
17111707 profileid + self .separator + twid + self .separator + "timeline"
17121708 )
1713- # The the amount of lines in this list
1709+ # The amount of lines in this list
17141710 last_index = self .r .zcard (key )
17151711 # Get the data in the list from the index asked (first_index) until the last
17161712 data = self .r .zrange (key , first_index , last_index - 1 )
0 commit comments