Tasks created by importing local storage are not sorted -- when using IO for external storage
See original GitHub issueDescribe the bug When files from the local storage (file system) are synchronized with label-studio, using IO external storage (i.e., added to the project and tasks), the tasks for these files are in random order. In other words, the IDs of the tasks have nothing to do with either filename of the original file, not the time when this file was created in the file system.
To Reproduce Steps to reproduce the behavior:
- Prepare files in the file system
- Synchronize/add files to the label-studio using IO Storage API (local files)
- Go to a project
- See that the IDs for tasks are random
Expected behavior The IDs of the tasks should be sorted by filenames of the files to be added to the label-studio.
Screenshots n/a – can provide if really needed
Environment (please complete the following information):
- OS: Ubuntu and macOS
- Label Studio Version Release 1.4.1
Additional context
In the label_studio/io_storages/localfiles/models.py
there is:
for file in path.rglob('*'):
Meanwhile, even in Python documentation rglob
comes with the sorted()
function, see this example.

Suggested solution
I can create a pull request for that, if you want.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (7 by maintainers)
Thank you very much for your kind words, they are really warm us!
Hi @dvwright , we chose sorting by filename for several reasons. First, it is the default behavior in most file managers, so we wanted to keep the user (also understood as a programmer) consistent with what he/she sees in the file manager browsing files in the filesystem and what is then presented in the label-studio. Second, in our case file name contains some date and time information in a standardized form (not going into details). So in our use case the filename itself contains some kind of “creation time” (I know that this is something different from the time when the file was created in particular filesystem, nevertheless, we discussed this issue and we finally chose sorting by filename).
@makseq , I’m glad that I could help. You are doing an amazing job guys with label-studio, good luck!