[PR #306] [MERGED] fix: ResourceConfig was loading config file eagerly #310

Closed
opened 2026-02-16 02:17:12 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/run-llama/workflows-py/pull/306
Author: @adrianlyjak
Created: 1/25/2026
Status: Merged
Merged: 1/25/2026
Merged by: @adrianlyjak

Base: mainHead: adrian/defer-resource-config


📝 Commits (3)

  • c705183 fix: ResourceConfig was loading config file eagerly
  • 4dd56b9 Create nine-wombats-admire.md
  • eca8444 clean up

📊 Changes

4 files changed (+155 additions, -27 deletions)

View changed files

.changeset/nine-wombats-admire.md (+5 -0)
📝 packages/llama-index-workflows/src/workflows/resource.py (+18 -7)
📝 packages/llama-index-workflows/src/workflows/workflow.py (+50 -11)
📝 packages/llama-index-workflows/tests/test_resources.py (+82 -9)

📄 Description

ResourceConfig was loading its file on instantiation, which slows startup time, and leads to difficult to identify errors. Now, resource configs are loading at validation time, and produce aggregate readable errors like the following:

============================================================
 1. Config file doesn't exist
============================================================
  [ERROR] Resource config validation failed:
  - In step 'start_step', parameter 'config': No such file: /var/folders/_6/k8nvc4_x4610dv3qh8gmrj680000gn/T/tmphjnnc9mw/nonexistent.json

============================================================
 2. Wrong file extension (not .json)
============================================================
  [ERROR at declaration time] Only JSON files can be used to load Pydantic-based resources.

============================================================
 3. path_selector doesn't exist in JSON
============================================================
  [ERROR] Resource config validation failed:
  - In step 'start_step', parameter 'config': Expected dictionary for configuration from /private/var/folders/_6/k8nvc4_x4610dv3qh8gmrj680000gn/T/tmphjnnc9mw/config3.json at path wrong, got: <class 'NoneType'>

============================================================
 4. Config data doesn't match Pydantic model (missing required field)
============================================================
  [ERROR] Resource config validation failed:
  - In step 'start_step', parameter 'db_config': 1 validation error for DatabaseConfig
username
  Field required [type=missing, input_value={'host': 'localhost', 'port': 5432}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/missing

============================================================
 5. Config data has wrong type (port should be int)
============================================================
  [ERROR] Resource config validation failed:
  - In step 'start_step', parameter 'db_config': 1 validation error for DatabaseConfig
port
  Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='not-a-number', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/int_parsing

============================================================
 6. Resource chain: step -> resource -> config
============================================================
  [ERROR] Resource config validation failed:
  - In step 'start_step', parameter 'connection' (create_db_connection -> /var/folders/_6/k8nvc4_x4610dv3qh8gmrj680000gn/T/tmphjnnc9mw/config6.json): 2 validation errors for DatabaseConfig
port
  Field required [type=missing, input_value={'host': 'localhost'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/missing
username
  Field required [type=missing, input_value={'host': 'localhost'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/missing

============================================================
 7. Deep resource chain: step -> res -> res -> res -> config
============================================================
  [ERROR] Resource config validation failed:
  - In step 'start_step', parameter 'service' (create_service -> create_pool -> get_config -> /var/folders/_6/k8nvc4_x4610dv3qh8gmrj680000gn/T/tmphjnnc9mw/config7.json): 1 validation error for DatabaseConfig
username
  Field required [type=missing, input_value={'host': 'localhost', 'port': 5432}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/missing

============================================================
 8. Multiple config errors in same workflow
============================================================
  [ERROR] Resource config validation failed:
  - In step 'step_two', parameter 'config_b': 2 validation errors for DatabaseConfig
port
  Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='bad', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/int_parsing
username
  Field required [type=missing, input_value={'host': 'localhost', 'port': 'bad'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/missing
  - In step 'step_one', parameter 'config_a': 2 validation errors for DatabaseConfig
port
  Field required [type=missing, input_value={'host': 'localhost'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/missing
username
  Field required [type=missing, input_value={'host': 'localhost'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/missing

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/run-llama/workflows-py/pull/306 **Author:** [@adrianlyjak](https://github.com/adrianlyjak) **Created:** 1/25/2026 **Status:** ✅ Merged **Merged:** 1/25/2026 **Merged by:** [@adrianlyjak](https://github.com/adrianlyjak) **Base:** `main` ← **Head:** `adrian/defer-resource-config` --- ### 📝 Commits (3) - [`c705183`](https://github.com/run-llama/workflows-py/commit/c705183783d4aedd2a6dc9d3b6238809720714a2) fix: ResourceConfig was loading config file eagerly - [`4dd56b9`](https://github.com/run-llama/workflows-py/commit/4dd56b958c5792ed211a6859fa513bddd3bc00ae) Create nine-wombats-admire.md - [`eca8444`](https://github.com/run-llama/workflows-py/commit/eca844424f4702e25b7554d96e55d1165e6288f8) clean up ### 📊 Changes **4 files changed** (+155 additions, -27 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/nine-wombats-admire.md` (+5 -0) 📝 `packages/llama-index-workflows/src/workflows/resource.py` (+18 -7) 📝 `packages/llama-index-workflows/src/workflows/workflow.py` (+50 -11) 📝 `packages/llama-index-workflows/tests/test_resources.py` (+82 -9) </details> ### 📄 Description `ResourceConfig` was loading its file on instantiation, which slows startup time, and leads to difficult to identify errors. Now, resource configs are loading at validation time, and produce aggregate readable errors like the following: ``` ============================================================ 1. Config file doesn't exist ============================================================ [ERROR] Resource config validation failed: - In step 'start_step', parameter 'config': No such file: /var/folders/_6/k8nvc4_x4610dv3qh8gmrj680000gn/T/tmphjnnc9mw/nonexistent.json ============================================================ 2. Wrong file extension (not .json) ============================================================ [ERROR at declaration time] Only JSON files can be used to load Pydantic-based resources. ============================================================ 3. path_selector doesn't exist in JSON ============================================================ [ERROR] Resource config validation failed: - In step 'start_step', parameter 'config': Expected dictionary for configuration from /private/var/folders/_6/k8nvc4_x4610dv3qh8gmrj680000gn/T/tmphjnnc9mw/config3.json at path wrong, got: <class 'NoneType'> ============================================================ 4. Config data doesn't match Pydantic model (missing required field) ============================================================ [ERROR] Resource config validation failed: - In step 'start_step', parameter 'db_config': 1 validation error for DatabaseConfig username Field required [type=missing, input_value={'host': 'localhost', 'port': 5432}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing ============================================================ 5. Config data has wrong type (port should be int) ============================================================ [ERROR] Resource config validation failed: - In step 'start_step', parameter 'db_config': 1 validation error for DatabaseConfig port Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='not-a-number', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/int_parsing ============================================================ 6. Resource chain: step -> resource -> config ============================================================ [ERROR] Resource config validation failed: - In step 'start_step', parameter 'connection' (create_db_connection -> /var/folders/_6/k8nvc4_x4610dv3qh8gmrj680000gn/T/tmphjnnc9mw/config6.json): 2 validation errors for DatabaseConfig port Field required [type=missing, input_value={'host': 'localhost'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing username Field required [type=missing, input_value={'host': 'localhost'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing ============================================================ 7. Deep resource chain: step -> res -> res -> res -> config ============================================================ [ERROR] Resource config validation failed: - In step 'start_step', parameter 'service' (create_service -> create_pool -> get_config -> /var/folders/_6/k8nvc4_x4610dv3qh8gmrj680000gn/T/tmphjnnc9mw/config7.json): 1 validation error for DatabaseConfig username Field required [type=missing, input_value={'host': 'localhost', 'port': 5432}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing ============================================================ 8. Multiple config errors in same workflow ============================================================ [ERROR] Resource config validation failed: - In step 'step_two', parameter 'config_b': 2 validation errors for DatabaseConfig port Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='bad', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/int_parsing username Field required [type=missing, input_value={'host': 'localhost', 'port': 'bad'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing - In step 'step_one', parameter 'config_a': 2 validation errors for DatabaseConfig port Field required [type=missing, input_value={'host': 'localhost'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing username Field required [type=missing, input_value={'host': 'localhost'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 02:17:12 -05:00
yindo closed this issue 2026-02-16 02:17:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/workflows-py#310