Accept total_files in FileBased splitting.

Hi @ticoann,
I fear I am not able to answer your question precisely. 
First, I am not sure I understand what is technically a "workflow" in WMCore. To me a "workflow" in CRAB language is the same as a "task". In a task, the input dataset files are loaded only once (I think), before doing the splitting. Therefore, this in my mental picture of how things work in a CRAB task: 
1) the input dataset files are loaded (here is where the limit you are talking about would enter into play to restrict how many files are loaded);
2) we can filter the loaded input files with some 'good quality condition' (a lumi-mask);
3) we set how many of the surviving files from 2) we want to use (this is the totalFiles).
Considering this simple mental picture, the answer to your question "are you restricting the number of files for whole workflow?" is I think trivially "yes, of course; totalFiles restricts somehow how many files to run over by the jobs in the workflow". 
In CRAB we use the SplitterFactory class (see https://github.com/dmwm/CRABServer/blob/master/src/python/TaskWorker/Actions/Splitter.py) to create a JobFactory which then runs the splitting algorithm. And we use the default value of "limit = 0" when calling the SplitterFactory (https://github.com/dmwm/CRABServer/blob/master/src/python/TaskWorker/Actions/Splitter.py#L25), so we load all the files in the input dataset in one go (IIUC). If the input dataset has 100 files and the user sets totalFiles > 100, then totalFiles will have no effect. But there is no problem in setting totalFiles > the number of files in the input dataset.

I fear you have a more complicated picture in mind, where the files from the input dataset are loaded in packets of e.g. 500 files, and the splitting algorithm is called for each packet. In that case I can see the problem and how your question would make sense. "totalFiles" will be applied for each packet, not to the whole workflow. But I don't see how requiring a precondition "totalFiles < self.limit" can help. The splitting algorithm will still be called for each packet of files, and in each packet we will select the first totalFiles files. The number of files in the workflow will be totalFiles*number_of_packets. .... But I don't think I understood your point. I don't know how the Generators work. Maybe @ericvaandering can comment?