(dep_grp, ld, tasks_conf, dep_name)
Test that a dependency group correctly defined.

    `dep_grp` (obj) - Configuration data for a dependency group.  It is an
        instance that inherits from cb.TasksConfigBaseMapping.
        Visualized as a dict or json, a dep_grp might look like:
            dep_grp = {"app_name": ["app2", "app3"]}
    `ld` (dict) - helpful info for error logs.  It also contains
        the app_name this dep_grp belongs to.
    `tasks_conf` (obj) - The configuration for all tasks. It is an instance
        that inherits from cb.TasksConfigBaseMapping
    `dep_name` (str) - The name for this dependency group.
Test that a dependency group correctly defined.
Test that a dependency group correctly defined .
def _validate_dep_grp_metadata(dep_grp, ld, tasks_conf, dep_name):
    """
    Test that a dependency group correctly defined.

    `dep_grp` (obj) - Configuration data for a dependency group.  It is an
        instance that inherits from cb.TasksConfigBaseMapping.
        Visualized as a dict or json, a dep_grp might look like:
            dep_grp = {"app_name": ["app2", "app3"]}
    `ld` (dict) - helpful info for error logs.  It also contains
        the app_name this dep_grp belongs to.
    `tasks_conf` (obj) - The configuration for all tasks. It is an instance
        that inherits from cb.TasksConfigBaseMapping
    `dep_name` (str) - The name for this dependency group.

    """
    ld1 = ld
    _template, child_template = node.get_job_id_template(ld['app_name'])
    for parent_app_name in dep_grp['app_name']:
        ld = dict(
            parent_app_name=parent_app_name,
            dependency_group="depends_on.%s" % dep_name, **ld1)

        _log_raise_if(
            parent_app_name not in tasks_conf,
            "Unrecognized parent_app_name in a `depends_on` dependency group",
            extra=ld,
            exception_kls=DAGMisconfigured)
        _, parent_template = node.get_job_id_template(parent_app_name)
        if len(dep_grp) == 1:
            _log_raise_if(
                not set(child_template).issuperset(parent_template),
                ("If you choose specify a dependency group with no job_id"
                 " identifiers, then the"
                 " child task's job_id identifiers must be a superset of those"
                 " in the parent's job_id. Otherwise, there"
                 " are cases where you cannot identify"
                 " a parent job_id given a child job_id."),
                extra=dict(
                    parent_job_id_template=parent_template,
                    child_job_id_template=child_template,
                    **ld),
                exception_kls=DAGMisconfigured)

        # for every parent, does the dependency group define enough information
        # to support a bubble-up or bubble-down operation?
        required_keys = set(
            child_template).difference(parent_template).difference(
                tasks_conf[ld['app_name']].get('autofill_values', {}))
        missing_keys = required_keys.difference(dep_grp)
        _log_raise_if(
            missing_keys,
            ("This app's dependency group is missing some required"
             " job_id identifiers"), extra=dict(
                 missing_job_id_identifiers=missing_keys,
                 job_id_template=_template, **ld),
            exception_kls=DAGMisconfigured)

    # look at the key:value pairs in <app_name>.depends_on
    for k, v in dep_grp.items():
        # dups in values?
        if isinstance(v, cb.TasksConfigBaseSequence):
            _log_raise_if(
                len(set(v)) != len(v),
                "You have duplicate metadata in dependency group metadata",
                extra=dict(key=k, value=v, **ld),
                exception_kls=DAGMisconfigured)
        else:
            _log_raise_if(
                v != 'all',
                ("The value of a depends_on.<key> must be a list of values"
                 " or the exact string 'all'"),
                extra=dict(key=k, value=v, **ld),
                exception_kls=DAGMisconfigured)
def _validate_dep_grp_metadata ( dep_grp , ld , tasks_conf , dep_name ) : ld1 = ld _template , child_template = node . get_job_id_template ( ld [ 'app_name' ] ) for parent_app_name in dep_grp [ 'app_name' ] : ld = dict ( parent_app_name = parent_app_name , dependency_group = "depends_on.%s" % dep_name , * * ld1 ) _log_raise_if ( parent_app_name not in tasks_conf , "Unrecognized parent_app_name in a `depends_on` dependency group" , extra = ld , exception_kls = DAGMisconfigured ) _ , parent_template = node . get_job_id_template ( parent_app_name ) if len ( dep_grp ) == 1 : _log_raise_if ( not set ( child_template ) . issuperset ( parent_template ) , ( "If you choose specify a dependency group with no job_id" " identifiers, then the" " child task's job_id identifiers must be a superset of those" " in the parent's job_id. Otherwise, there" " are cases where you cannot identify" " a parent job_id given a child job_id." ) , extra = dict ( parent_job_id_template = parent_template , child_job_id_template = child_template , * * ld ) , exception_kls = DAGMisconfigured ) # for every parent, does the dependency group define enough information # to support a bubble-up or bubble-down operation? required_keys = set ( child_template ) . difference ( parent_template ) . difference ( tasks_conf [ ld [ 'app_name' ] ] . get ( 'autofill_values' , { } ) ) missing_keys = required_keys . difference ( dep_grp ) _log_raise_if ( missing_keys , ( "This app's dependency group is missing some required" " job_id identifiers" ) , extra = dict ( missing_job_id_identifiers = missing_keys , job_id_template = _template , * * ld ) , exception_kls = DAGMisconfigured ) # look at the key:value pairs in <app_name>.depends_on for k , v in dep_grp . items ( ) : # dups in values? if isinstance ( v , cb . TasksConfigBaseSequence ) : _log_raise_if ( len ( set ( v ) ) != len ( v ) , "You have duplicate metadata in dependency group metadata" , extra = dict ( key = k , value = v , * * ld ) , exception_kls = DAGMisconfigured ) else : _log_raise_if ( v != 'all' , ( "The value of a depends_on.<key> must be a list of values" " or the exact string 'all'" ) , extra = dict ( key = k , value = v , * * ld ) , exception_kls = DAGMisconfigured )