Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DYN-7568] Tune-up crashes Dynamo when running all nodes in script with a selected family #80

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions TuneUp/TuneUpWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Dynamo.Graph.Annotations;
using Dynamo.Graph.Nodes;
using Dynamo.Graph.Workspaces;
using Dynamo.Models;
using Dynamo.ViewModels;
using Dynamo.Wpf.Extensions;
using Dynamo.Wpf.Utilities;
Expand Down Expand Up @@ -356,13 +357,22 @@ internal void ResetProfiling()
// Put the graph into manual mode as there is no guarantee that nodes will be marked
// dirty in topologically sorted order during a reset.
SwitchToManualMode();
// TODO: need a way to do this from an extension and not cause a run.
// DynamoModel interface or a more specific reset command.
(viewLoadedParams.DynamoWindow.DataContext as DynamoViewModel).Model.ResetEngine(true);

// Enable profiling on the new engine controller after the reset.
CurrentWorkspace.EngineController.EnableProfiling(true, currentWorkspace, currentWorkspace.Nodes);
// run the graph now that profiling is enabled.
CurrentWorkspace.Run();

// Ensure all nodes are marked as modified
foreach (var node in viewLoadedParams.CurrentWorkspaceModel.Nodes)
{
node.RegisterAllPorts();
node.MarkNodeAsModified(true);
}

// Execute the Run command
viewLoadedParams.CommandExecutive.ExecuteCommand(
new DynamoModel.RunCancelCommand(true, false),
Guid.NewGuid().ToString(),
"TuneUp Run All");

isProfilingEnabled = true;
executionTimeData = CurrentWorkspace.EngineController.ExecutionTimeData;
Expand Down