def test_create_checkpoint_store_git(): from plumber.io import create_checkpoint_store config = {TYPE: LOCALGIT, CONFIG: {}} store = create_checkpoint_store(config) from plumber.io import YamlGitFileStore assert type(store) == YamlGitFileStore assert store.path == DEFAULT_CHECKPOINT_FILENAME
def test_create_checkpoint_store_file_default_1(): from plumber.io import create_checkpoint_store config = {TYPE: LOCALFILE} store = create_checkpoint_store(config) from plumber.io import YamlFileStore assert type(store) == YamlFileStore assert store.path == DEFAULT_CHECKPOINT_FILENAME
def __init__(self, config): super(PlumberPlanner, self).__init__() self.config = config self.checkpoint_store = None self.pipes = None self.results = None self.checkpoint_unit = SINGLE self.posthooks_execute = False global_config = get_or_default(config, GLOBAL, None, dict) if global_config is not None: super(PlumberPlanner, self).configure(global_config) checkpointing_config = get_or_default(global_config, CHECKPOINTING, None, dict) if checkpointing_config is not None: checkpoint_unit = get_or_default(checkpointing_config, UNIT, 'single', str) if checkpoint_unit is not None: self.checkpoint_unit = checkpoint_unit.lower() self.checkpoint_store = create_checkpoint_store( checkpointing_config) else: self.checkpoint_store = create_checkpoint_store() else: self.checkpoint_store = create_checkpoint_store() self.current_checkpoint = self.checkpoint_store.get_data() if PIPES in config: self.pipes = [] declared_pipe_ids = set() for pipe_config in config[PIPES]: if ID not in pipe_config: raise ConfigError( 'Id not specified for pipe in configuration file') if pipe_config[ID] in declared_pipe_ids: raise ConfigError( 'Multiple pipes configured with id: {}'.format( pipe_config[ID])) declared_pipe_ids.add(pipe_config[ID]) pipe = PlumberPipe() pipe.configure( pipe_config, get_or_default(self.current_checkpoint, pipe_config[ID], {})) self.pipes.append(pipe)
def test_create_checkpoint_store_kube(config_mock_incluster, config_mock): config_mock.return_value = None config_mock_incluster.return_value = None from plumber.io import create_checkpoint_store config = {TYPE: KUBECONFIG, CONFIG: {}} store = create_checkpoint_store(config) from plumber.io import KubeConfigStore assert type(store) == KubeConfigStore assert store.configmap_name == 'plumber-checkpoint' assert store.namespace == 'default'
def test_create_checkpoint_store_file_default_3(): from plumber.io import create_checkpoint_store store = create_checkpoint_store(None) from plumber.io import YamlFileStore assert type(store) == YamlFileStore assert store.path == DEFAULT_CHECKPOINT_FILENAME