add priority to Bach, Job, and run_async #2758
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greptile Summary
This PR adds priority parameter support to the Tidy3D web API's batch processing system, specifically targeting vGPU queue management. The changes enable users to specify task priority levels from 1 (lowest) to 10 (highest) when submitting simulations to the vGPU queue.
The implementation adds the
priority
parameter to three key components:container.py
): BothJob.run()
andJob.start()
methods now accept an optional priority parametercontainer.py
): BothBatch.run()
andBatch.start()
methods now support priority, with proper threading implementation to ensure all jobs in a batch inherit the same priorityasynchronous.py
): The high-level async interface now accepts priority and passes it through to the underlying batch processingThe parameter propagation follows a clear chain:
run_async()
→Batch.run()
→Batch.start()
→ individualJob.start()
→webapi.start()
. All methods maintain backward compatibility by making priority optional with a default value ofNone
. The change integrates well with the existing codebase architecture and follows established patterns for parameter passing through the web API layers.This enhancement gives users fine-grained control over task execution order in the vGPU queue, which is valuable for managing multiple simulations with different urgency levels.
Important Files Changed
Click to expand file changes
Confidence score: 4/5
Sequence Diagram