Exemple #1
0
    def storage(self, timeout=10) -> Result:
        """
        Get the list of storage plugin names and configurations.

        :param timeout: int
        :return: pydrill.client.Result
        """
        result = Result(*self.perform_request(
            **{
                'method': 'GET',
                'url': '/storage.json',
                'params': {
                    'request_timeout': timeout
                }
            }))
        return result
Exemple #2
0
    def options(self, timeout=10) -> Result:
        """
        List the name, default, and data type of the system and session options.

        :param timeout: int
        :return: pydrill.client.Result
        """
        result = Result(*self.perform_request(
            **{
                'method': 'GET',
                'url': '/options.json',
                'params': {
                    'request_timeout': timeout
                }
            }))
        return result
Exemple #3
0
    def threads(self, timeout=10) -> Result:
        """
        Get the status of threads.

        :param timeout: int
        :return: pydrill.client.Result
        """
        result = Result(*self.perform_request(
            **{
                'method': 'GET',
                'url': '/status/threads',
                'params': {
                    'request_timeout': timeout
                }
            }))
        return result
Exemple #4
0
    def metrics(self, timeout=10) -> Result:
        """
        Get the current memory metrics.

        :param timeout: int
        :return: pydrill.client.Result
        """
        result = Result(*self.perform_request(
            **{
                'method': 'GET',
                'url': '/status/metrics',
                'params': {
                    'request_timeout': timeout
                }
            }))
        return result
Exemple #5
0
    def is_active(self, timeout=2) -> bool:
        """
        :param timeout: int
        :return: boolean
        """
        try:
            result = Result(*self.perform_request(
                'HEAD', '/', params={'request_timeout': timeout}))
        except ConnectionError:
            return False
        except TransportError:
            return False

        if result.response.status_code == 200:
            return True

        return False
Exemple #6
0
    def profile_cancel(self, query_id, timeout=10) -> Result:
        """
        Cancel the query that has the given queryid.

        :param query_id: The UUID of the query in standard UUID format that Drill assigns to each query.
        :param timeout: int
        :return: pydrill.client.Result
        """
        result = Result(*self.perform_request(
            **{
                'method': 'GET',
                'url': '/profiles/cancel/{0}'.format(query_id),
                'params': {
                    'request_timeout': timeout
                }
            }))
        return result
Exemple #7
0
    def storage_delete(self, name, timeout=10) -> Result:
        """
        Delete a storage plugin configuration.

        :param name: The name of the storage plugin configuration to delete.
        :param timeout: int
        :return: pydrill.client.Result
        """
        result = Result(*self.perform_request(
            **{
                'method': 'DELETE',
                'url': '/storage/{0}.json'.format(name),
                'params': {
                    'request_timeout': timeout
                }
            }))
        return result
Exemple #8
0
    def storage_detail(self, name, timeout=10) -> Result:
        """
        Get the definition of the named storage plugin.

        :param name: The assigned name in the storage plugin definition.
        :param timeout: int
        :return: pydrill.client.Result
        """
        result = Result(*self.perform_request(
            **{
                'method': 'GET',
                'url': '/storage/{0}.json'.format(name),
                'params': {
                    'request_timeout': timeout
                }
            }))
        return result
Exemple #9
0
    def storage_enable(self, name, value=True, timeout=10) -> Result:
        """
        Enable or disable the named storage plugin.

        :param name: The assigned name in the storage plugin definition.
        :param value: Either True (to enable) or False (to disable).
        :param timeout: int
        :return: pydrill.client.Result
        """
        value = 'true' if value else 'false'
        result = Result(*self.perform_request(
            **{
                'method': 'GET',
                'url': '/storage/{0}/enable/{1}'.format(name, value),
                'params': {
                    'request_timeout': timeout
                }
            }))
        return result
Exemple #10
0
    def storage_update(self, name, config, timeout=10) -> Result:
        """
        Create or update a storage plugin configuration.

        :param name: The name of the storage plugin configuration to create or update.
        :param config: Overwrites the existing configuration if there is any, and therefore, must include all
        required attributes and definitions.
        :param timeout: int
        :return: pydrill.client.Result
        """
        result = Result(*self.perform_request(
            **{
                'method': 'POST',
                'url': '/storage/{0}.json'.format(name),
                'body': config,
                'params': {
                    'request_timeout': timeout
                }
            }))
        return result