def track(self, progress=None, timeout_in_milliseconds=None):
        """ Runs until the bulk service has finished processing the download or upload request.

        :param progress: (optional) Tracking the percent complete progress information for the bulk operation.
        :type progress: BulkOperationProgressInfo -> None
        :return: The final BulkOperationStatus.
        :rtype: BulkOperationStatus
        """

        if self.final_status is not None:
            return self.final_status
        blocker = _PollingBlocker(self.poll_interval_in_milliseconds, timeout_in_milliseconds)
        blocker.wait()
        while True:
            status = self.get_status()
            percentage = int(status.percent_complete)
            if progress is not None:
                progress(BulkOperationProgressInfo(percentage))
            if status.status == 'InProgress' or status.status == 'FileUploaded' or status.status == 'PendingFileUpload':
                blocker.wait()
                continue
            if status.status != 'Completed' and status.status != 'CompletedWithErrors':
                raise BulkException("Exceptions while bulk upload.", status.errors)
            self._final_status = status
            return self._final_status
    def track(self, progress=None, timeout_in_milliseconds=None):
        """ Runs until the bulk service has finished processing the download or upload request.

        :param progress: (optional) Tracking the percent complete progress information for the bulk operation.
        :type progress: BulkOperationProgressInfo -> None
        :return: The final BulkOperationStatus.
        :rtype: BulkOperationStatus
        """

        if self.final_status is not None:
            return self.final_status
        blocker = _PollingBlocker(self.poll_interval_in_milliseconds, timeout_in_milliseconds)
        blocker.wait()
        while True:
            status = self.get_status()
            percentage = int(status.percent_complete)
            if progress is not None:
                progress(BulkOperationProgressInfo(percentage))
            if status.status == 'InProgress' or status.status == 'FileUploaded' or status.status == 'PendingFileUpload':
                blocker.wait()
                continue
            if status.status != 'Completed' and status.status != 'CompletedWithErrors':
                raise BulkException("Exceptions while bulk upload.", status.errors)
            self._final_status = status
            return self._final_status
Beispiel #3
0
    def track(self, timeout_in_milliseconds=None):
        """ Runs until the reporting service has finished processing the download or upload request.

        :param timeout_in_milliseconds: (optional) timeout for tracking reporting download operation
        :type timeout_in_milliseconds: int
        :return: The final ReportingOperationStatus.
        :rtype: ReportingOperationStatus
        """

        if self.final_status is not None:
            return self.final_status
        blocker = _PollingBlocker(self.poll_interval_in_milliseconds, timeout_in_milliseconds)
        blocker.wait()
        while True:
            status = self.get_status()
            if status.status == 'Pending':
                blocker.wait()
                continue
            if status.status != 'Success':
                raise ReportingException('Exceptions while reporting download.', status.status)
            self._final_status = status
            return self._final_status
    def track(self, timeout_in_milliseconds=None):
        """ Runs until the reporting service has finished processing the download or upload request.

        :param timeout_in_milliseconds: (optional) timeout for tracking reporting download operation
        :type timeout_in_milliseconds: int
        :return: The final ReportingOperationStatus.
        :rtype: ReportingOperationStatus
        """

        if self.final_status is not None:
            return self.final_status
        blocker = _PollingBlocker(self.poll_interval_in_milliseconds, timeout_in_milliseconds)
        blocker.wait()
        while True:
            status = self.get_status()
            if status.status == 'Pending':
                blocker.wait()
                continue
            if status.status != 'Success':
                raise ReportingException('Exceptions while reporting download.', status.status)
            self._final_status = status
            return self._final_status