File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,13 @@ def main(
2828 config = yaml .safe_load (preprocessed_yaml )
2929
3030 def get_output_path () -> Path :
31- timestamp = time .strftime ("%y%m%d%H%M%S" )
31+ if is_running_in_aws_batch ():
32+ # Offset timestamp by random seconds to avoid collisions
33+ # Hopefully that means we can just remove the uuid part later on
34+ offset = random .randint (0 , 600 )
35+ timestamp = time .strftime ("%y%m%d%H%M%S" , time .localtime (time .time () + offset ))
36+ else :
37+ timestamp = time .strftime ("%y%m%d%H%M%S" )
3238 rounds = config ["tournament" ]["rounds" ]
3339 sims = config ["game" ]["sims_per_round" ]
3440
@@ -40,8 +46,7 @@ def get_output_path() -> Path:
4046 f"PvpTournament.{ config ['game' ]['name' ]} .r{ rounds } .s{ sims } .p{ p_num } .{ p_list } { suffix_part } .{ timestamp } "
4147 )
4248 if is_running_in_aws_batch ():
43- # Wait a random time to hopefully avoid collisions with the timestamp even without the uuid
44- time .sleep (random .random () * 20 )
49+ # Also add a UUID just to be safe
4550 _uuid = str (uuid .uuid4 ())
4651 folder_name += f".{ _uuid } -uuid"
4752 if output_dir is None :
You can’t perform that action at this time.
0 commit comments