mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-11-02 03:33:04 +08:00
Tools whose only discoverable outputs are dynamic collections (no primary assign_primary_output dataset) were raising MaxDiscoveredFilesExceededError from inside collect_dynamic_outputs, where a blanket `except Exception` swallowed it via `log.exception`, shipping a traceback to Sentry and leaving the outer handlers in set_metadata_portable / MinimalJobWrapper without the error to record in job_messages. Catch MaxDiscoveredFilesExceededError in collect_dynamic_outputs, mark the collection as population-failed, register it with the job context so the FAILED state is serialized through the extended-metadata export store, and re-raise so the outer handlers can record a max_discovered_files entry in job_messages. Log at warning level instead of error in the outer handlers. In set_metadata_portable the pre-_finalize export_job was redundant (immediately overwritten by _finalize) so drop it; add a single post-_finalize export_job in the error path because _finalize cannot find the job through included_datasets / included_collections when discovery failed before anything was added to them. Fixes #22394