Skip to content

Commit

Permalink
add proper wait check
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD committed Sep 28, 2024
1 parent 9faf04a commit 4463a7a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/neuroconv/tools/aws/_deploy_neuroconv_batch_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,28 @@ def deploy_neuroconv_batch_job(

# Give the EFS and other aspects time to spin up before submitting next dependent job
# (Otherwise, good chance that duplicate EFS will be created)
time.sleep(30)
matching_efs_volumes = [
file_system
for file_system in available_efs_volumes["FileSystems"]
for tag in file_system["Tags"]
if tag["Key"] == "Name" and tag["Value"] == efs_volume_name
]
max_iterations = 10
iteration = 0
while len(matching_efs_volumes) == 0 and iteration < max_iterations:
iteration += 1
time.sleep(30)

matching_efs_volumes = [
file_system
for file_system in available_efs_volumes["FileSystems"]
for tag in file_system["Tags"]
if tag["Key"] == "Name" and tag["Value"] == efs_volume_name
]

if len(matching_efs_volumes) == 0:
message = f"Unable to create EFS volume '{efs_volume_name}' after {max_iterations} attempts!"
raise ValueError(message)

docker_image = "ghcr.io/catalystneuro/neuroconv_latest_yaml_variable:latest"

Expand Down

0 comments on commit 4463a7a

Please sign in to comment.