Exemple #1
0
class TurbiniaCeleryClient(BaseTurbiniaClient):
    """Client class for Turbinia (Celery).

  Overriding some things specific to Celery operation.

  Attributes:
    redis (RedisStateManager): Redis datastore object
  """
    def __init__(self, *args, **kwargs):
        super(TurbiniaCeleryClient, self).__init__(*args, **kwargs)
        self.redis = RedisStateManager()

    def send_request(self, request):
        """Sends a TurbiniaRequest message.

    Args:
      request: A TurbiniaRequest object.
    """
        self.task_manager.kombu.send_request(request)

    # pylint: disable=arguments-differ
    def get_task_data(self,
                      instance,
                      _,
                      __,
                      days=0,
                      task_id=None,
                      request_id=None,
                      user=None,
                      function_name=None,
                      output_json=False):
        """Gets task data from Redis.

    We keep the same function signature, but ignore arguments passed for GCP.

    Args:
      instance (string): The Turbinia instance name (by default the same as the
          INSTANCE_ID in the config).
      days (int): The number of days we want history for.
      task_id (string): The Id of the task.
      request_id (string): The Id of the request we want tasks for.
      user (string): The user of the request we want tasks for.

    Returns:
      List of Task dict objects.
    """
        return self.redis.get_task_data(instance, days, task_id, request_id,
                                        user)
Exemple #2
0
class TurbiniaCeleryClient(BaseTurbiniaClient):
    """Client class for Turbinia (Celery).

  Overriding some things specific to Celery operation.

  Attributes:
    redis (RedisStateManager): Redis datastore object
  """
    def __init__(self, *args, **kwargs):
        super(TurbiniaCeleryClient, self).__init__(*args, **kwargs)
        self.redis = RedisStateManager()

    def close_tasks(self,
                    instance,
                    project,
                    region,
                    request_id=None,
                    task_id=None,
                    user=None,
                    requester=None):
        """Close Turbinia Tasks based on Request ID.

    Currently needs to be implemented for Redis/Celery:
    https://github.com/google/turbinia/issues/999
    """
        raise TurbiniaException(
            '--close_tasks is not yet implemented for Redis: '
            'https://github.com/google/turbinia/issues/999')

    def send_request(self, request):
        """Sends a TurbiniaRequest message.

    Args:
      request: A TurbiniaRequest object.
    """
        self.task_manager.kombu.send_request(request)

    # pylint: disable=arguments-differ
    def get_task_data(self,
                      instance,
                      _,
                      __,
                      days=0,
                      task_id=None,
                      request_id=None,
                      group_id=None,
                      user=None,
                      function_name=None,
                      output_json=False):
        """Gets task data from Redis.

    We keep the same function signature, but ignore arguments passed for GCP.

    Args:
      instance (string): The Turbinia instance name (by default the same as the
          INSTANCE_ID in the config).
      days (int): The number of days we want history for.
      task_id (string): The Id of the task.
      request_id (string): The Id of the request we want tasks for.
      group_id (string): Group Id of the requests.
      user (string): The user of the request we want tasks for.

    Returns:
      List of Task dict objects.
    """
        return self.redis.get_task_data(instance, days, task_id, request_id,
                                        group_id, user)