diff --git a/src/engine/src/helpers/TemplateMapper.py b/src/engine/src/helpers/TemplateMapper.py index c6be9292..d3d850a6 100644 --- a/src/engine/src/helpers/TemplateMapper.py +++ b/src/engine/src/helpers/TemplateMapper.py @@ -13,6 +13,8 @@ TapisActorTask ) +from pprint import pprint + class TemplateMapper: def __init__(self, cache_dir: str): self.task_map_by_type = { @@ -35,15 +37,16 @@ def map(self, obj: Union[Pipeline, Task], uses: Uses) -> Union[Pipeline, Task]: # Clone git repository specified on the pipeline.uses if exists template = self.template_repo.get_by_uses(uses) - + print("TEMPLATE TO BE MAPPED") + pprint() # Resolve which class the final object should have obj_class = Pipeline if not issubclass(obj.__class__, Pipeline): - obj_class = self.task_map_by_type.get(obj.type, None) + obj_class = self.task_map_by_type.get(template.get("type", None), None) # Raise exception if no class could be resolved from the template if obj_class == None: - raise Exception(f"Invalid Template: Unable to resolve object type from Template. Task template object 'type' property must be one of [{self.task_map_by_type.keys()}]") + raise Exception(f"Invalid Template: Unable to resolve object type from Template. Task template object 'type' property must be one of {list(self.task_map_by_type.keys())} | Recieved: {template.get('type', 'None')}") dict_obj = obj.dict()