Make project pull order insensitive #6131
Merged
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.
spacy project pull
was simply going through the commands in the order they're defined in the file, which means if you put an earlier-running command lower down, your pulls wouldn't work. In short examples it feels natural that of course, the earlier thing is earlier in the file. But when you add stuff over time, or have a template, you can easily just not have them in order. This already bit me when training the models, so I figured I'd better fix it.The "fancy" approach to this sort of thing is to define the input/output dependencies as a graph, and then do a topological sort. I'm using a while loop because it gets the same result and the code is much clearer (imo). What I'm doing would even work if we wanted to download the things in parallel...In that case we would just use a thread or an async library to do the work, the outer loop would be the same. Maybe worth remembering if we want to support parallelism in
spacy project run
.