def _map_output_files_to_input_artifacts( action_graph_container, artifact_id_to_path, action_index_to_output_files): """Constructs a map from output files to input artifacts. Args: action_graph_container: the full action graph container object artifact_id_to_path: a map {artifact_id: artifact path} action_index_to_output_files: a map from action index (in action graph container) to a string of concatenated output artifacts paths. Returns: A map from output files (string of concatenated output artifacts paths) to a list of input artifacts. """ actions = action_graph_container.actions dep_set_of_files = action_graph_container.dep_set_of_files id_to_dep_set = {dep_set.id: dep_set for dep_set in dep_set_of_files} dep_set_resolver = DepSetResolver(dep_set_of_files, artifact_id_to_path) output_files_to_input_artifacts = {} for i, action in enumerate(actions): input_artifacts = [] for dep_set_id in action.input_dep_set_ids: input_artifacts.extend( dep_set_resolver.resolve(id_to_dep_set[dep_set_id])) output_files_to_input_artifacts[action_index_to_output_files[i]] = list( sorted(input_artifacts)) return output_files_to_input_artifacts