Module enrgdaq.daq.template.config

DAQ Job configuration template generator.

Uses msgspec's built-in JSON schema generation for DAQ job configurations.

Functions

def get_daq_job_config_templates() ‑> dict[str, dict]
Expand source code
def get_daq_job_config_templates() -> dict[str, dict]:
    """
    Generate DAQ job configuration templates using msgspec's JSON schema generation.

    Returns a dictionary of JSON schemas for each DAQ job type.
    """
    templates: dict[str, dict] = {}

    for daq_job_class in get_all_daq_job_types():
        # Skip base DAQJob class
        if daq_job_class is DAQJob:
            continue

        # Get the config type for this job
        config_type = getattr(daq_job_class, "config_type", None)
        if config_type is None:
            continue

        job_name = daq_job_class.__name__

        # Generate JSON schema using msgspec
        # Some config types may have unsupported types, skip those
        try:
            schema = msgspec.json.schema(config_type)
        except TypeError:
            # Skip configs with unsupported types
            continue

        # Add our custom metadata
        schema["type_key"] = job_name
        schema["label"] = _get_job_label(job_name)
        # Use job class docstring for description (more relevant than config docstring)
        schema["description"] = _parse_class_docstring(daq_job_class)

        templates[job_name] = schema

    return templates

Generate DAQ job configuration templates using msgspec's JSON schema generation.

Returns a dictionary of JSON schemas for each DAQ job type.