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-7409 Execution session preference file path #15511

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/DynamoCore/Configuration/ExecutionSession.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using Dynamo.Interfaces;
Expand Down Expand Up @@ -26,6 +26,7 @@ public ExecutionSession(Scheduler.UpdateGraphAsyncTask updateTask, DynamoModel m
parameters[ParameterKeys.LastExecutionDuration] = new TimeSpan(updateTask.ExecutionEndTime.TickCount - updateTask.ExecutionStartTime.TickCount);
parameters[ParameterKeys.PackagePaths] = pathManager.PackagesDirectories;
parameters[ParameterKeys.Logger] = model.Logger;
parameters[ParameterKeys.PreferenceFilePath] = pathManager.PreferenceFilePath;
}

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion src/NodeServices/ExecutionSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public class ParameterKeys
/// The return value is an ILogger
/// </summary>
public static readonly string Logger = nameof(Logger);


/// <summary>
/// The path to the preference file that is being used by Dynamo.
/// </summary>
public static readonly string PreferenceFilePath = nameof(PreferenceFilePath);
}
}
8 changes: 5 additions & 3 deletions test/DynamoCoreTests/Configuration/ExecutionSessionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ExecutionSessionTests : DynamoModelTestBase
{
private TimeSpan lastExecutionDuration = new TimeSpan();
private IEnumerable<string> packagePaths;
private string preferenceFilePath;

protected override void GetLibrariesToPreload(List<string> libraries)
{
Expand Down Expand Up @@ -38,18 +39,19 @@ public void TestExecutionSession()

[Test]
[Category("UnitTests")]
public void TestExecutionSessionPackagePaths()
public void TestExecutionSessionPaths()
{
ExecutionEvents.GraphPreExecution += ExecutionEvents_GraphPreExecution;
RunModel(@"core\HomogeneousList\HomogeneousInputsValid.dyn");
Assert.IsNotEmpty(packagePaths, "packgePaths was empty");
Assert.IsNotEmpty(packagePaths, "packagePaths was empty");
Assert.IsNotEmpty(preferenceFilePath, "preferenceFilePath was empty");
ExecutionEvents.GraphPreExecution -= ExecutionEvents_GraphPreExecution;
}

private void ExecutionEvents_GraphPreExecution(Session.IExecutionSession session)
{
packagePaths = ExecutionEvents.ActiveSession.GetParameterValue(Session.ParameterKeys.PackagePaths) as IEnumerable<string>;

preferenceFilePath = ExecutionEvents.ActiveSession.GetParameterValue(Session.ParameterKeys.PreferenceFilePath) as string;
}

[OneTimeTearDown]
Expand Down
Loading