<commit_before># Copyright ClusterHQ Inc.  See LICENSE file for details.

"""
Utility functions for test cluster lifecycle management.
"""

from uuid import uuid4, UUID

supported_test_types = ['functional', 'acceptance']
supported_platforms = ['centos-7', 'ubuntu-14.04', 'ubuntu-15.04']
supported_providers = ['aws', 'openstack']


def make_cluster_id(test_type, platform, provider):
    """
    """
    test_index = supported_test_types.index(test_type)
    if test_index == -1:
        raise Exception()
    platform_index = supported_platforms.index(platform)
    if platform_index == -1:
        raise Exception()
    provider_index = supported_providers.index(provider)
    if provider_index == -1:
        raise Exception()

    marker_string = str(test_index) + str(platform_index) + str(provider_index)
    marker = int(marker_string)
    c = uuid4()
    tagged_cluster_id = UUID(fields=(
        c.time_low, c.time_mid, c.time_hi_version,
        c.clock_seq_hi_variant, c.clock_seq_low,
        # Instead of node, a hard-coded magic constant.
        marker,
    ))
    return tagged_cluster_id<commit_msg>Add documentation.<commit_after># Copyright ClusterHQ Inc.  See LICENSE file for details.

"""
Utility functions for cluster lifecycle management in test env.
"""

from uuid import uuid4, UUID

# Parameters influencing cluster id generated by tests.
# Since cluster id is generated by indexing into the arrays,
# please append to the end of the array if supported types
# need to be extended.
supported_test_types = ['functional', 'acceptance']
supported_platforms = ['centos-7', 'ubuntu-14.04', 'ubuntu-15.04']
supported_providers = ['aws', 'openstack']


def make_cluster_id(test_type, platform, provider):
    """
    Compose cluster ``UUID`` using test type, platform, and provider.
    """
    test_index = supported_test_types.index(test_type)

    # XXX: Please throw appropriate Exception.
    if test_index == -1:
        raise Exception()
    platform_index = supported_platforms.index(platform)
    # XXX: Please throw appropriate Exception.
    if platform_index == -1:
        raise Exception()
    provider_index = supported_providers.index(provider)
    # XXX: Please throw appropriate Exception.
    if provider_index == -1:
        raise Exception()

    marker_string = str(test_index) + str(platform_index) + str(provider_index)
    marker = int(marker_string)
    c = uuid4()
    tagged_cluster_id = UUID(fields=(
        c.time_low, c.time_mid, c.time_hi_version,
        c.clock_seq_hi_variant, c.clock_seq_low,
        # Instead of node, a hard-coded magic constant.
        marker,
    ))
    return tagged_cluster_id
{'fraction_non_alphanumeric': 0.10154193305754043, 'fraction_numerical': 0.010530274539300489, 'mean_word_length': 3.642233856893543, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5696444', 'n_tokens_mistral': 815, 'n_tokens_neox': 788, 'n_words': 220}