Пример #1
0
    def _make_output_path(self, finishid, host, user, id_, crabid):
        """Determine the full path to use to store output
        (excluding file extensions).

        This uses a directory heirarchy:

            * host
            * user
            * crabid (name) or ID (number)
            * finish ID

        Where the finish ID is broken into blocks of a few characters,
        the first of which is zero-padded to ensure all blocks are the
        same length.  This prevents an excessive number of entries
        being placed in a single directory, while the path is easily
        determined without needing to read the directory structure.
        So breaking on the default number of digits (3) finish ID 1 would
        yield 001 whereas 2005 would yield 002/005."""

        if crabid is None or crabid == '':
            job = str(id_)
        else:
            job = alphanum(crabid)

        finish = str(finishid)
        finishpath = []

        lead = len(finish) % self.breakdigits
        if lead:
            finishpath.append('0' * (self.breakdigits - lead) + finish[:lead])
            finish = finish[lead:]

        finishpath.extend([
            finish[x:x + self.breakdigits]
            for x in range(0, len(finish), self.breakdigits)
        ])

        return os.path.join(self.outputdir, alphanum(host), alphanum(user),
                            job, *finishpath)
Пример #2
0
    def _make_output_path(self, finishid, host, user, id_, crabid):
        """Determine the full path to use to store output
        (excluding file extensions).

        This uses a directory heirarchy:

            * host
            * user
            * crabid (name) or ID (number)
            * finish ID

        Where the finish ID is broken into blocks of a few characters,
        the first of which is zero-padded to ensure all blocks are the
        same length.  This prevents an excessive number of entries
        being placed in a single directory, while the path is easily
        determined without needing to read the directory structure.
        So breaking on the default number of digits (3) finish ID 1 would
        yield 001 whereas 2005 would yield 002/005."""

        if crabid is None or crabid == '':
            job = str(id_)
        else:
            job = alphanum(crabid)

        finish = str(finishid)
        finishpath = []

        lead = len(finish) % self.breakdigits
        if lead:
            finishpath.append('0' * (self.breakdigits - lead) + finish[:lead])
            finish = finish[lead:]

        finishpath.extend([finish[x:x + self.breakdigits]
                           for x in range(0, len(finish), self.breakdigits)])

        return os.path.join(self.outputdir, alphanum(host), alphanum(user),
                            job, *finishpath)
Пример #3
0
    def _make_crontab_path(self, host, user):
        """Determine the full path to be used to store a crontab."""

        return (os.path.join(self.tabdir, alphanum(host), alphanum(user)) +
                '.' + self.tabext)
Пример #4
0
    def _make_crontab_path(self, host, user):
        """Determine the full path to be used to store a crontab."""

        return (os.path.join(self.tabdir, alphanum(host), alphanum(user)) +
                '.' + self.tabext)