How to load sequential data from separate datasets?

I want to create a dataset/dataloader setup that simply yields one batch from one of multiple datasets at a time, sequentially.

I’m new to ML, but this seems like a fairly common task for multiple time series prediction. I have multiple time series’ of the exact same structure and I want to train one model for all of them. For that it is important that the model always receives a sequence of data from one time series at a time, without overlapping them. All approaches I found would ultimately just concatenate them, which is not what I want.

If I have, for example, three datasets of length 10, 20 and 30, and a batch size of 15, then I’d expect my batches to be of length 10, 15, 5, 15, 15.