def convert()

in dagify/converter/engine.py [0:0]


def convert(object, tool, type, name):
    if object.uf is None:
        raise ValueError(
            "dagify: no data in universal format. nothing to convert!")

    # process the conversion of all universal format items
    for tIdx, task in enumerate(object.uf.get_tasks()):
        # process a single task
        task_type = task.get_attribute(type)
        task_name = task.get_attribute(name)
        if task_type is None:
            raise ValueError(
                f"dagify: no task/OType in source for task {task_name}")
        template_name = get_template_name(object, task_type)
        print(template_name)
        # get the template from the template name
        # [0][0] as the template dictionary is the first element of a tuple, in turn first element of a list
        template = get_template(object, template_name, tool)
        if template is None:
            raise ValueError(
                f"dagify: no template name provided that matches job type {task_type}")

        src_platform_name = template["source"]["platform"].get(
            "name", "UNKNOWN_SOURCE_PLATFORM")
        src_operator_name = template["source"]["operator"].get(
            "id", "UNKNOWN_SOURCE_PLATFORM")
        tgt_platform_name = template["target"]["platform"].get(
            "name", "UNKNOWN_TARGET_PLATFORM")
        tgt_operator_name = template["target"]["operator"].get(
            "name", "UNKNOWN_TARGET_PLATFORM")
        print(
            f" --> Converting Job number {str(tIdx)}: {task_name}, \n \