<commit_before>from radical.entk import AppManager as Amgr
from hypothesis import given
import hypothesis.strategies as st
from radical.entk import Pipeline, Stage, Task, states
from radical.entk.exceptions import *
from radical.entk.utils.sync_initiator import sync_with_master
import radical.utils as ru
import pytest
import pika
from threading import Event, Thread
from multiprocessing import Process
import os

hostname = os.environ.get('RMQ_HOSTNAME', 'localhost')
port = int(os.environ.get('RMQ_PORT', 5672))
MLAB = 'mongodb://entk:<EMAIL>:43511/entk_0_7_4_release'

def test_amgr_initialization():

    amgr = Amgr(hostname=hostname, port=port,name='test.appmanager')

    assert amgr._name.split('.') == ['test','appmanager']
    assert amgr._sid.split('.') == ['test','appmanager']
    assert amgr._uid.split('.') == ['appmanager', '0000']
    assert type(amgr._logger) == type(ru.get_logger('radical.tests'))
    assert type(amgr._prof) == type(ru.Profiler('radical.tests'))
    assert type(amgr._report) == type(ru.Reporter('radical.tests'))
    assert isinstance(amgr.name, str)

    # RabbitMQ inits
    assert amgr._mq_hostname == hostname
    assert amgr._port == port

    # RabbitMQ Queues
    assert amgr._num_pending_qs == 1
    assert amgr._num_completed_qs == 1
    assert isinstance(amgr._pending_queue, list)
    assert isinstance(amgr._completed_queue, list)

    # Global parameters to have default values
    assert amgr._mqs_setup == False
    assert amgr._resource_desc == None
    assert amgr._task_manager == None
    assert amgr._workflow == None
    assert amgr._resubmit_failed == False
    assert amgr._reattempts == 3
    assert amgr._cur_attempt == 1<commit_msg>Test generates appmanager name and tests based on that<commit_after>from radical.entk import AppManager as Amgr
from hypothesis import given
import hypothesis.strategies as st
from radical.entk import Pipeline, Stage, Task, states
from radical.entk.exceptions import *
from radical.entk.utils.sync_initiator import sync_with_master
import radical.utils as ru
import pytest
import pika
from threading import Event, Thread
from multiprocessing import Process
import os

hostname = os.environ.get('RMQ_HOSTNAME', 'localhost')
port = int(os.environ.get('RMQ_PORT', 5672))
MLAB = 'mongodb://entk:<EMAIL>:43511/entk_0_7_4_release'

def test_amgr_initialization():
    amgr_name = ru.generate_id('test.appmanager.%(item_counter)04d', ru.ID_CUSTOM)
    amgr = Amgr(hostname=hostname, port=port,name=amgr_name)

    assert amgr._name.split('.') == amgr_name.split('.')
    assert amgr._sid.split('.') == amgr_name.split('.')
    assert amgr._uid.split('.') == ['appmanager', '0000']
    assert type(amgr._logger) == type(ru.get_logger('radical.tests'))
    assert type(amgr._prof) == type(ru.Profiler('radical.tests'))
    assert type(amgr._report) == type(ru.Reporter('radical.tests'))
    assert isinstance(amgr.name, str)

    # RabbitMQ inits
    assert amgr._mq_hostname == hostname
    assert amgr._port == port

    # RabbitMQ Queues
    assert amgr._num_pending_qs == 1
    assert amgr._num_completed_qs == 1
    assert isinstance(amgr._pending_queue, list)
    assert isinstance(amgr._completed_queue, list)

    # Global parameters to have default values
    assert amgr._mqs_setup == False
    assert amgr._resource_desc == None
    assert amgr._task_manager == None
    assert amgr._workflow == None
    assert amgr._resubmit_failed == False
    assert amgr._reattempts == 3
    assert amgr._cur_attempt == 1
{'fraction_non_alphanumeric': 0.11456255343402678, 'fraction_numerical': 0.011969222000569962, 'mean_word_length': 4.510204081632653, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2743642', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1127, 'n_words': 272}