-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a fix to ensure remote folder is created before running batch o… #2007
Conversation
tidy3d/web/api/mode.py
Outdated
# Create the folder before running the parallel computation and wait one second before running the batch simulation job | ||
folder = Folder.create(folder_name=folder_name) | ||
import time | ||
time.sleep(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put from time import sleep
at the top level of this file and use sleep(1)
here.
But separately, @magiWei , is there a better way to wait to make sure that the folder is created? This seems too hacky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current way to create a folder is https synchronous interaction, the interface will respond to success or failure. Therefore, getting the interface returned will let you know the interface created by the folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean there should be no need for a time.sleep()
even in the current code? @prashkh do you know why you had to add it?
@momchil-flex if you don't explicitly add this, multiple folders with the same name is created on our web GUI and the batch simulations are randomly distributed across those folders with the same name (puzzling) when solving a batch of mode solver simulations. |
So I can see why that would happen without the explicit folder create call, but I'm wondering why you still need to wait 1s. Generally it sounds like |
I don't remember testing with no delay. I can do that today. My assumption was that the run_batch already calls run and each run function creates a folder (
|
So I think what you say makes sense but the point is that you used to run the processes async and only then each process would try to make a folder. Then, multiple calls to the api will happen and it can be arbitrary when some folders will get made and some processes will start seeing them. But now you call the folder creation before you start the async run, and since the folder creation itself is sync, I would think you don't need an explicit |
@momchil-flex you were right! Just adding the |
Great! Could you update the PR? |
I guess I'll do it myself and merge. |
…f mode solver simulations.
e219707
to
e0072d8
Compare
Thank you! |
…f mode solver simulations.
One user reported that running batch solver for mode solver created multiple folders with the same name on our web platform. We figured out a way to fix this by creating the folder explicitly first before running the async call for batch solver. Last time I had asked the user to just implement in their frontend code and it works so we just need to include this before the next release. Thank you!