Skip to content

Commit

Permalink
fix: adapt doc and gui code after error capture
Browse files Browse the repository at this point in the history
The error capture introduces a slight change in the engine 
interface, so we need to adapt these so they keep working as before.
  • Loading branch information
jhonasiv committed Feb 24, 2025
1 parent 66c00d7 commit bc251de
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/syskit/cli/doc/gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def self.compute_system_network(model, main_plan = Roby::Plan.new, **options)
main_plan.add(original_task = model.as_plan)
engine = Syskit::NetworkGeneration::Engine.new(main_plan)
planning_task = original_task.planning_task
mapping = engine.compute_system_network([planning_task], **options)
mapping, = engine.compute_system_network([planning_task], **options)

if engine.work_plan.respond_to?(:commit_transaction)
engine.work_plan.commit_transaction
Expand Down
5 changes: 3 additions & 2 deletions lib/syskit/gui/component_network_base_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ def compute_system_network(model, main_plan = nil)
main_plan.add(original_task = model.as_plan)
base_task = original_task.as_service
engine = Syskit::NetworkGeneration::Engine.new(main_plan)
engine.compute_system_network([base_task.task.planning_task])
base_task.task
_, resolution_errors =
engine.compute_system_network([base_task.task.planning_task])
[base_task.task, resolution_errors]
ensure
if engine && engine.work_plan.respond_to?(:commit_transaction)
engine.work_plan.commit_transaction
Expand Down
10 changes: 8 additions & 2 deletions lib/syskit/gui/component_network_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,17 @@ def render(model,
begin
if method == :compute_system_network
tic = Time.now
@task = compute_system_network(model, plan)
@task, resolution_errors = compute_system_network(model, plan)
exception = NetworkGeneration::PartialNetworkResolution.new(
resolution_errors
)
timing = Time.now - tic
elsif method == :compute_deployed_network
tic = Time.now
@task = compute_deployed_network(model, plan)
@task, resolution_errors = compute_deployed_network(model, plan)
exception = NetworkGeneration::PartialNetworkResolution.new(
resolution_errors
)
timing = Time.now - tic
else
@task = instanciate_model(model, plan, instanciate_options)
Expand Down
2 changes: 1 addition & 1 deletion lib/syskit/test/network_manipulation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def syskit_deploy_normalized_placeholder_tasks(
resolution_errors.each do |error|
t = error.planned_task
expect_execution do
t.failed_event.emit(error.original_exceptions)
t.failed_event.emit(error.original_exception)
end
end
raise NetworkGeneration::PartialNetworkResolution, resolution_errors
Expand Down
2 changes: 1 addition & 1 deletion test/test/test_network_manipulation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ module Test
assert_equal "test_level", task.orocos_name
end

it "on error, it changes the planning failed and mission failed " \
it "on error, it filters out the planning failed and mission failed " \
"error caused by itself" do
task_m = Syskit::TaskContext.new_submodel
assert_raises(Syskit::MissingDeployment) do
Expand Down

0 comments on commit bc251de

Please sign in to comment.