Exemplo n.º 1
0
def _getFilenameSuggestion(dirname='', seriesname=SERIES_PATTERN):
    from PYME.IO.FileUtils import nameUtils
    from PYME.IO import clusterIO
    import os

    if dirname == '':
        dirname = nameUtils.genClusterDataFilepath()
    else:
        dirname = dirname.split(nameUtils.getUsername())[-1]

        dir_parts = dirname.split(os.path.sep)
        if len(dirname) < 1 or len(dir_parts) > 3:
            #path is either too complex, or too easy - revert to default
            dirname = nameUtils.genClusterDataFilepath()
        else:
            dirname = nameUtils.getUsername() + '/'.join(dir_parts)

    #dirname = defDir % nameUtils.dateDict
    seriesStub = dirname + '/' + seriesname % nameUtils.dateDict

    seriesCounter = 0
    seriesName = seriesStub % {'counter': nameUtils.numToAlpha(seriesCounter)}

    #try to find the next available serie name
    while clusterIO.exists(seriesName + '/'):
        seriesCounter += 1

        if '%(counter)' in seriesName:
            seriesName = seriesStub % {
                'counter': nameUtils.numToAlpha(seriesCounter)
            }
        else:
            seriesName = seriesStub + '_' + nameUtils.numToAlpha(seriesCounter)

    return seriesName
Exemplo n.º 2
0
def get_mapdir(scope):
    import os
    seriesCounter = 0
    subdirectory = 'map_' + numToAlpha(seriesCounter)
    while os.path.exists(scope.spoolController.get_dirname(subdirectory)):
        seriesCounter += 1
        subdirectory = 'map_' + numToAlpha(seriesCounter)
    return subdirectory
Exemplo n.º 3
0
 def _GenSeriesName(self):
     if config.get('acquire-spool_subdirectories', False):
         # High-throughput performance optimization
         # If true, add a layer of directories to limit the number of series saved in a single directory
         return '%03d%s%s_%05d' % (int(self.seriesCounter/100), self._sep, self.seriesStub, self.seriesCounter)
     else:
         return self.seriesStub + '_' + numToAlpha(self.seriesCounter)
 def _GenSeriesName(self):
     return self.seriesStub + '_' + numToAlpha(self.seriesCounter)