def __init__(self, config={}):

        # Define the worker's type, which will be used for self identification.

        worker_type = "pull_request_analysis_worker"

        # Define what this worker can be given and know how to interpret

        given = [['github_url']]

        # The name the housekeeper/broker use to distinguish the data model this worker can fill

        models = ['pull_request_analysis']

        # Define the tables needed to insert, update, or delete on

        data_tables = ['message', 'repo', 'pull_request_analysis']

        operations_tables = ['worker_history', 'worker_job']

        # Run the general worker initialization
        super().__init__(worker_type, config, given, models, data_tables,
                         operations_tables)

        # Do any additional configuration after the general initialization has been run
        self.config.update(config)

        # Define data collection info
        self.tool_source = 'Pull Request Analysis Worker'
        self.tool_version = '0.0.0'
        self.data_source = 'Non-existent API'

        self.insight_days = 200  # self.config['insight_days']

        augur_config = AugurConfig(ROOT_AUGUR_DIRECTORY)
        self.senti_models_dir = os.path.join(
            ROOT_AUGUR_DIRECTORY, "workers", "message_insights_worker",
            augur_config.get_section("Workers")["message_insights_worker"]
            ["models_dir"])

        self.logger.info(
            f'Sentiment model dir located - {self.senti_models_dir}')
Ejemplo n.º 2
0
def test_config_get_section_exception():
    test_config = default_config
    test_config['Database']['user'] = "******"
    config_object = AugurConfig(temp_dir, test_config)
    assert config_object.get_section("absent_section") == None
Ejemplo n.º 3
0
def test_config_get_section_no_exception():
    test_config = default_config
    test_config['Database']['user'] = "******"
    config_object = AugurConfig(temp_dir, test_config)
    assert type(config_object.get_section("Database")) == dict