def _apply_connections_params( cls, connections: List[str], init: List[V1Init], artifact_store: str = None, param_spec: Dict[str, ParamSpec] = None, ): if connections: connections = Parser.parse_section(connections, param_spec=param_spec, parse_params=True) _init = [] if init: for i in init: if i.artifacts and not i.connection: i.connection = artifact_store resolved_i = V1Init.from_dict( Parser.parse_section(i.to_dict(), param_spec=param_spec, parse_params=True)) _init.append(resolved_i) # Prepend any param that has to_init after validation init_params = [ v.to_init() for v in param_spec.values() if v.validate_to_init() ] init_params = [v for v in init_params if v] _init = init_params + _init return _init, connections
def apply_run_connections_params( cls, config: V1CompiledOperation, artifact_store: str = None, contexts: Dict = None, ) -> V1CompiledOperation: params = config.validate_params(is_template=False, check_runs=True) params = {param.name: param for param in params} params = cls._update_params_with_contexts(params, contexts) if config.run.kind in {V1RunKind.JOB, V1RunKind.SERVICE}: if config.run.connections: config.run.connections = Parser.parse_section( config.run.connections, params=params, parse_params=True) if config.run.init: init = [] for i in config.run.init: if i.artifacts and not i.connection: i.connection = artifact_store resolved_i = V1Init.from_dict( Parser.parse_section(i.to_dict(), params=params, parse_params=True)) init.append(resolved_i) config.run.init = init return config
def apply_section_contexts( cls, config: V1CompiledOperation, section, contexts: Dict = None, param_spec: Dict[str, ParamSpec] = None, ): if not param_spec: param_spec = cls.calculate_context_spec(config=config, contexts=contexts) return Parser.parse_section(section, param_spec)
def _apply_connections_params( cls, connections: List[str], init: List[V1Init], artifact_store: str = None, param_spec: Dict[str, ParamSpec] = None, ): if connections: connections = Parser.parse_section(connections, param_spec=param_spec, parse_params=True) _init = [] if init: for i in init: if i.artifacts and not i.connection: i.connection = artifact_store resolved_i = V1Init.from_dict( Parser.parse_section(i.to_dict(), param_spec=param_spec, parse_params=True)) _init.append(resolved_i) return _init, connections