Fix train_size handling
Factoring out task management methods