Skip to content
Snippets Groups Projects
Commit e2e60d42 authored by Riccardo Boero's avatar Riccardo Boero :innocent:
Browse files

Fix workflow task parsing

parent ec9ce410
No related branches found
No related tags found
No related merge requests found
...@@ -110,7 +110,7 @@ system = ServiceRegistry() # Assuming ServiceRegistry is preconfigured ...@@ -110,7 +110,7 @@ system = ServiceRegistry() # Assuming ServiceRegistry is preconfigured
manage_workflow(tasks_list, results_container, system) manage_workflow(tasks_list, results_container, system)
``` ```
""" """
function manage_workflow(tasks_list::Vector{Dict}, results_container::Dict, system::OrchestratorRegistry.ServiceRegistry) function manage_workflow(tasks_list::Vector{<:Dict}, results_container::Dict, system::OrchestratorRegistry.ServiceRegistry)
# Convert tasks_list into a dictionary keyed by the "id" field for easy dependency resolution # Convert tasks_list into a dictionary keyed by the "id" field for easy dependency resolution
# Each element of tasks_list is assumed to have a unique "id" key. # Each element of tasks_list is assumed to have a unique "id" key.
tasks = Dict(task["id"] => task for task in tasks_list) tasks = Dict(task["id"] => task for task in tasks_list)
......
...@@ -51,16 +51,14 @@ function parseWorkflow(filePath::String) ...@@ -51,16 +51,14 @@ function parseWorkflow(filePath::String)
error("Invalid workflow file: 'tasks' section not found.") error("Invalid workflow file: 'tasks' section not found.")
end end
# Flatten tasks into a list of dictionaries # Initialize tasks as a vector of Dict
tasks = [] tasks = Dict{String, Any}[]
for (task_name, task_details) in data["tasks"] for (task_name, task_details) in data["tasks"]
# Skip non-dictionary entries (e.g., `id = "no_counties"`)
if task_details isa Dict if task_details isa Dict
# Add the task name as the "id" and flatten into a single dictionary # Add the task name as the "id" and flatten into a single dictionary
task_details["id"] = task_name task_details["id"] = task_name
push!(tasks, task_details) push!(tasks, task_details)
else
#println("Skipping non-dictionary task entry: '$task_name'. Value: ", task_details)
end end
end end
...@@ -71,4 +69,3 @@ function parseWorkflow(filePath::String) ...@@ -71,4 +69,3 @@ function parseWorkflow(filePath::String)
return tasks return tasks
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment