Esempio n. 1
0
    def ingest_files(self):
        """Upload self.files to the user's ingest directory on the CRDS server."""
        stats = self._start_stats()
        total_size = utils.total_size(self.files)

        ingest_info = self.get_ingested_files()

        self.scan_for_nonsubmitted_ingests(ingest_info)

        remaining_files = self.keep_existing_files(ingest_info, self.files) \
            if self.args.keep_existing_files else self.files

        for i, filename in enumerate(remaining_files):
            file_size = utils.file_size(filename)
            log.info("Upload started", repr(filename), "[", i + 1, "/",
                     len(self.files), " files ]", "[",
                     utils.human_format_number(file_size), "/",
                     utils.human_format_number(total_size), " bytes ]")
            self.connection.upload_file("/upload/new/", filename)
            stats.increment("bytes", file_size)
            stats.increment("files", 1)
            stats.log_status("files", "Upload complete", len(self.files))
            stats.log_status("bytes", "Upload complete", total_size)

        log.divider(func=log.verbose)
        stats.report()
        log.divider(char="=")
Esempio n. 2
0
    def ingest_files(self):
        """Copy self.files into the user's ingest directory on the CRDS server."""
        stats = self._start_stats()
        destination = self.submission_info.ingest_dir
        host, path = destination.split(":")
        self.ensure_ingest_exists(host, path)
        total_size = utils.total_size(self.files)

        ingest_info = self.get_ingested_files()

        self.scan_for_nonsubmitted_ingests(ingest_info)

        remaining_files = self.keep_existing_files(ingest_info, self.files) \
            if self.args.keep_existing_files else self.files

        for i, filename in enumerate(remaining_files):
            file_size = utils.file_size(filename)
            log.info("Copy started", repr(filename), "[", i + 1, "/",
                     len(self.files), " files ]", "[",
                     utils.human_format_number(file_size), "/",
                     utils.human_format_number(total_size), " bytes ]")
            self.copy_file(filename, path, destination)
            stats.increment("bytes", file_size)
            stats.increment("files", 1)
            stats.log_status("files", "Copy complete", len(self.files))
            stats.log_status("bytes", "Copy complete", total_size)

        log.divider(func=log.verbose)
        stats.report()
        log.divider(char="=")
Esempio n. 3
0
    def ingest_files(self):
        """Copy self.files into the user's ingest directory on the CRDS server."""
        stats = self._start_stats()
        destination = self.submission_info.ingest_dir
        host, path = destination.split(":")
        self.ensure_ingest_exists(host, path)
        total_size = utils.total_size(self.files)

        ingest_info = self.get_ingested_files()

        self.scan_for_nonsubmitted_ingests(ingest_info)

        remaining_files = self.keep_existing_files(ingest_info, self.files) \
            if self.args.keep_existing_files else self.files

        for i, filename in enumerate(remaining_files):
            file_size = utils.file_size(filename)
            log.info("Copy started", repr(filename), "[", i+1, "/", len(self.files), " files ]",
                     "[", utils.human_format_number(file_size), 
                     "/", utils.human_format_number(total_size), " bytes ]")
            self.copy_file(filename, path, destination)
            stats.increment("bytes", file_size)
            stats.increment("files", 1)
            stats.log_status("files", "Copy complete", len(self.files))
            stats.log_status("bytes", "Copy complete", total_size)

        log.divider(func=log.verbose)
        stats.report()
        log.divider(char="=")
Esempio n. 4
0
 def _start_stats(self):
     """Helper method to initialize stats keeping for ingest."""
     total_bytes = utils.total_size(self.files)
     stats = utils.TimingStats(output=log.verbose)
     stats.start()
     log.divider(name="ingest files", char="=")
     log.info("Uploading", len(self.files), "file(s) totalling", utils.human_format_number(total_bytes), "bytes")
     log.divider(func=log.verbose)
     return stats
Esempio n. 5
0
 def _start_stats(self):
     """Helper method to initialize stats keeping for ingest."""
     total_bytes = utils.total_size(self.files)
     stats = utils.TimingStats(output=log.verbose)
     stats.start()
     log.divider(name="ingest files", char="=")
     log.info("Copying", len(self.files), "file(s) totalling", utils.human_format_number(total_bytes), "bytes")
     log.divider(func=log.verbose)
     return stats