Пример #1
0
    try:
        agg_key = '+'.join([agg_handle, metric_handle])
        if agg_key in aggregator_dict:
            return agg_key
        else:
            return ''
    except TypeError:
        return ''


# Define Types of requests handled by the manager
# ###############################################

# Enumeration to store request types
request_types = enum(time_series='time_series',
    aggregator='aggregator',
    raw='raw')


def get_request_type(request_meta):
    """ Determines request type. """
    if request_meta.aggregator and request_meta.time_series \
       and request_meta.group and request_meta.slice and request_meta.start \
       and request_meta.end:
        return request_types.time_series
    elif request_meta.aggregator:
        return request_types.aggregator
    else:
        return request_types.raw

Пример #2
0
            return uid
        return False

    def map_user_id(self, users, project_in, project_out):
        """
            Map user IDs between projects.  Requires access to centralauth
            database.
        """
        raise NotImplementedError()


# Define User Metric Periods
# ==========================

# enumeration for user periods
USER_METRIC_PERIOD_TYPE = enum(REGISTRATION='REGISTRATION', INPUT='INPUT')
USER_METRIC_PERIOD_DATA = namedtuple('UMPData', 'user start end')


def get_registration_dates(users, project):
    """
    Method to handle pulling reg dates from project datastores.

        users : list
            List of user ids.

        project : str
            project from which to retrieve ids
    """

    # Get registration dates from logging table
Пример #3
0
            return uid
        return False

    def map_user_id(self, users, project_in, project_out):
        """
            Map user IDs between projects.  Requires access to centralauth
            database.
        """
        raise NotImplementedError()


# Define User Metric Periods
# ==========================

# enumeration for user periods
USER_METRIC_PERIOD_TYPE = enum('REGISTRATION', 'INPUT', 'REGINPUT')
USER_METRIC_PERIOD_DATA = namedtuple('UMPData', 'user start end')


def get_registration_dates(users, project):
    """
    Method to handle pulling reg dates from project datastores.

        users : list
            List of user ids.

        project : str
            project from which to retrieve ids
    """

    # Get registration dates from logging table