コード例 #1
0
ファイル: extractors.py プロジェクト: adsabs/adsdata
 def get_last_extracted(self):
     try:
         return utils.mod_time(self.meta_path)
     except OSError, e:
         if e.errno == errno.ENOENT:
             return None
         raise
コード例 #2
0
 def get_last_extracted(self):
     try:
         return utils.mod_time(self.meta_path)
     except OSError, e:
         if e.errno == errno.ENOENT:
             return None
         raise
コード例 #3
0
ファイル: extractors.py プロジェクト: adsabs/adsdata
    def content_is_stale(self):
        """
        compares the mod time of the record's meta file vs. the mod time
        of the source
        """
        if not os.path.exists(self.ft_source):
            raise FulltextSourceNotFound("no source file found for %s at %s" % (self.bibcode, self.ft_source))
        
        offset = datetime.utcnow() - datetime.now()
        source_mtime = utils.mod_time(self.ft_source) + offset
        log.debug("mtime of %s source file %s: %s", self.bibcode, self.ft_source, source_mtime)

        if not self.last_extracted or source_mtime > self.last_extracted:
            return True
        return False
コード例 #4
0
    def content_is_stale(self):
        """
        compares the mod time of the record's meta file vs. the mod time
        of the source
        """
        if not os.path.exists(self.ft_source):
            raise FulltextSourceNotFound("no source file found for %s at %s" %
                                         (self.bibcode, self.ft_source))

        offset = datetime.utcnow() - datetime.now()
        source_mtime = utils.mod_time(self.ft_source) + offset
        log.debug("mtime of %s source file %s: %s", self.bibcode,
                  self.ft_source, source_mtime)

        if not self.last_extracted or source_mtime > self.last_extracted:
            return True
        return False
コード例 #5
0
ファイル: extractors.py プロジェクト: adsabs/adsdata
 def content_is_stale(self):
     """
     compares the mod time of the record's meta file vs. the mod time
     of the each listed source file
     """
     if not self.last_extracted:
         return True
     
     source_files = re.split('\s*,\s*', self.ft_source)
     offset = datetime.utcnow() - datetime.now()
     
     for sf in source_files:
         if not os.path.exists(sf):
             raise FulltextSourceNotFound("no source file found for %s at %s" % (self.bibcode, sf))
         source_mtime = utils.mod_time(sf) + offset
         log.debug("%s source mtime: %s" % (sf, source_mtime))
         if source_mtime > self.last_extracted:
             return True
     return False
コード例 #6
0
    def content_is_stale(self):
        """
        compares the mod time of the record's meta file vs. the mod time
        of the each listed source file
        """
        if not self.last_extracted:
            return True

        source_files = re.split('\s*,\s*', self.ft_source)
        offset = datetime.utcnow() - datetime.now()

        for sf in source_files:
            if not os.path.exists(sf):
                raise FulltextSourceNotFound(
                    "no source file found for %s at %s" % (self.bibcode, sf))
            source_mtime = utils.mod_time(sf) + offset
            log.debug("%s source mtime: %s" % (sf, source_mtime))
            if source_mtime > self.last_extracted:
                return True
        return False