Exemplo n.º 1
0
    def publish(self):
        """Publish the uploaded data to the selected super cube.

        A super cube can be published just once.
        Returns:
            response: Response from the Intelligence Server acknowledging the
                publication process.
        """

        response = datasets.publish(connection=self._connection,
                                    id=self._id,
                                    session_id=self._session_id)

        if not response.ok:
            # on error, cancel the previously uploaded data
            datasets.publish_cancel(connection=self._connection,
                                    id=self._id,
                                    session_id=self._session_id)

        status = 6  # default initial status
        while status != 1:
            status = self.publish_status()['status']
            time.sleep(1)
            if status == 1:
                print("Super cube '%s' published successfully." % self.name)
Exemplo n.º 2
0
    def publish(self):
        """Publish the uploaded data to the selected dataset.

        A dataset can be published just once.
        Returns:
            response: Response from the Intelligence Server acknowledging the
                publication process.
        """

        response = datasets.publish(connection=self._connection,
                                    dataset_id=self._dataset_id,
                                    session_id=self._session_id)

        if not response.ok:
            # on error, cancel the previously uploaded data
            datasets.publish_cancel(connection=self._connection,
                                    dataset_id=self._dataset_id,
                                    session_id=self._session_id)

        status = 6  # default initial status
        while status != 1:
            pub = datasets.publish_status(connection=self._connection, dataset_id=self._dataset_id,
                                          session_id=self._session_id)
            pub = pub.json()
            status = pub['status']
            if status == 1:
                print("Dataset '%s' published successfully." % self._name)
Exemplo n.º 3
0
    def publish(self) -> bool:
        """Publish the uploaded data to the selected super cube.

        Note:
            A super cube can be published just once.

        Returns:
            True if the data was published successfully, else False.
        """

        response = datasets.publish(connection=self._connection,
                                    id=self._id,
                                    session_id=self._session_id)

        if not response.ok:
            # on error, cancel the previously uploaded data
            datasets.publish_cancel(connection=self._connection,
                                    id=self._id,
                                    session_id=self._session_id)
            return False

        status = 6  # default initial status
        while status != 1:
            status = self.publish_status()['status']
            time.sleep(1)
            if status == 1:
                # clear instance_id to force new instance creation
                self.instance_id = None
                if config.verbose:
                    logger.info(
                        f"Super cube '{self.name}' published successfully.")
                return True
Exemplo n.º 4
0
    def publish(self):
        """Publish the uploaded data to the selected dataset.
        Returns:
            response: Response from the Intelligence Server acknowledging the publication process.
        """

        response = datasets.publish(connection=self._connection,
                                    dataset_id=self._dataset_id,
                                    session_id=self._session_id)

        if not response.ok:
            # on error, cancel the previously uploaded data
            self.__response_handler(
                response=response,
                msg="Error publishing uploaded data. Cancelling publication.")
            datasets.publish_cancel(connection=self._connection,
                                    dataset_id=self._dataset_id,
                                    session_id=self._session_id)

        return response