Skip to content

Better error messaging when there is no data. #21

@RogerJanusiak

Description

@RogerJanusiak

I have been running into an issue with the Derivation analysis that is causing the root file ServiceX is sending back to have branches that are completely empty. The first time that this causes and error is in the to_awk() function. Here is the output:

Error loading sample: MySample
Traceback (most recent call last):
  File "/home/rjanusia/WorkingDirectory/IrisHep/ServiceX-Local/user_improvements/.venv/lib64/python3.12/site-packages/servicex_analysis_utils/materialization.py", line 85, in to_awk
    awk_arrays[sample] = ak.concatenate(
                         ^^^^^^^^^^^^^^^
  File "/home/rjanusia/WorkingDirectory/IrisHep/ServiceX-Local/user_improvements/.venv/lib64/python3.12/site-packages/awkward/_dispatch.py", line 41, in dispatch
    with OperationErrorContext(name, args, kwargs):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rjanusia/WorkingDirectory/IrisHep/ServiceX-Local/user_improvements/.venv/lib64/python3.12/site-packages/awkward/_errors.py", line 80, in __exit__
    raise self.decorate_exception(exception_type, exception_value)
  File "/home/rjanusia/WorkingDirectory/IrisHep/ServiceX-Local/user_improvements/.venv/lib64/python3.12/site-packages/awkward/_dispatch.py", line 67, in dispatch
    next(gen_or_result)
  File "/home/rjanusia/WorkingDirectory/IrisHep/ServiceX-Local/user_improvements/.venv/lib64/python3.12/site-packages/awkward/operations/ak_concatenate.py", line 72, in concatenate
    return _impl(arrays, axis, mergebool, highlevel, behavior, attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rjanusia/WorkingDirectory/IrisHep/ServiceX-Local/user_improvements/.venv/lib64/python3.12/site-packages/awkward/operations/ak_concatenate.py", line 132, in _impl
    merged_named_axis = reduce(_unify_named_axis, map(_get_named_axis, arrays))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: reduce() of empty iterable with no initial value

This error occurred while calling

ak.concatenate(
    []
)

I think it would be nice if we caught this exception and passed a nice error message to the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions