def parse_project_and_task_from_dag_id(dag_id):
    """Parse project and task from dag id.

    Args:
        dag_id (str): The id of DAG.

    Returns:
        (tuple of str): The first item is project. The second item is task.
            If dag_id is invalid, will return empty string.
    """
    if not dag_id:
        return '', ''

    ids = dag_id.split('__')
    if len(ids) >= 3:
        return ids[1], ids[2]
    elif len(ids) == 2:
        return ids[1], ''
    else:
        return '', ''