Beispiel #1
0
def check_initialized_entity(context, entity_type, entity_name):
    config = merged_config_load()
    metadata_path = get_metadata_path(config, entity_type)
    metadata = Metadata(entity_name, metadata_path, config, entity_type)
    if not metadata.check_exists():
        log.error(output_messages['ERROR_NOT_INITIALIZED'] % entity_type)
        context.exit()
Beispiel #2
0
def get_last_entity_version(entity_type, entity_name):
    config = merged_config_load()
    metadata_path = get_metadata_path(config, entity_type)
    metadata = Metadata(entity_name, metadata_path, config, entity_type)
    if not metadata.check_exists():
        log.error(output_messages['ERROR_NOT_INITIALIZED'] % entity_type)
        return
    last_version = metadata.get_last_tag_version(entity_name)
    return last_version + 1
Beispiel #3
0
def show(**kwargs):
    if kwargs['global']:
        config_file = global_config_load()
    elif kwargs['local']:
        config_file = mlgit_config_load()
    else:
        config_file = merged_config_load()

    print('config:')
    pprint(config_file)
Beispiel #4
0
    def test_merged_config_load(self):
        global_conf = {DATASETS: {'git': 'global-url'}, MODELS: {'git': 'url'}, PUSH_THREADS_COUNT: 10}
        local_conf = {DATASETS: {'git': 'url'}}
        init_mlgit()

        with mock.patch('ml_git.config.mlgit_config_load', return_value=local_conf):
            with mock.patch('ml_git.config.global_config_load', return_value=global_conf):
                config_file = merged_config_load()
                self.assertEqual(config_file[DATASETS]['git'], 'url')
                self.assertEqual(config_file[MODELS]['git'], 'url')
                self.assertEqual(config_file[PUSH_THREADS_COUNT], 10)
Beispiel #5
0
def is_wizard_enabled():
    config_file = merged_config_load(hide_logs=True)
    wizard_enabled = WIZARD_KEY in config_file and config_file[WIZARD_KEY] == WizardMode.ENABLED.value
    return wizard_enabled