def get_job_info()

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


def get_job_info(file_path):
    """Function to get and return a dictionary of job_name and its task_type"""
    if not file_path.endswith('.xml'):
        raise ValueError(f"Invalid file format: {file_path}. Only XML files are supported.")
    job_info_list = []
    tree = ET.parse(file_path)
    root = tree.getroot()
    # Find all JOB elements
    for job in root.findall('.//JOB'):  # Find all JOB elements
        job_name = job.attrib['JOBNAME']
        task_type = job.attrib['TASKTYPE'].lower()
        job_info_list.append({'job_name': job_name, 'task_type': task_type})
    return job_info_list