Repository navigation
Replace Associate Session merging flows with Composite Sessions - #59
matias-mcl wants to merge 5 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Matias Radmand <matias.radmand@motionapplied.com>
| /// It then retrieves and prints a small number of sample values for a | ||
| /// specified parameter from both the Primary and the Associate sessions. | ||
| /// </summary> | ||
| private static void LoadSSNWtihAssociates() |
There was a problem hiding this comment.
Should bin off LoadSSNWtihAssociates to be LoadAndAppendSSNSessions as it isn't limited to an Associate session.
Similarly
/// <summary>
/// This example loads a Primary session and appends another session (but multiple can base passed in) in order to
/// create a Composite Session (a session made up of one or more sessions).
/// It then retrieves and prints a small number of sample values for a
/// specified parameter from both the Primary and the Appended session(s).
/// </summary>
And then all variables referring to an associate do not make sense.
| /// a small number of sample values for a specified parameter from both the | ||
| /// Primary session and its Associate. | ||
| /// </summary> | ||
| private static void LoadSqlRaceDatabaseSessionWithAssociates() |
There was a problem hiding this comment.
Similar to the above, this is not locked down to an Associate so should refer to the action of Appending.
Rather than LoadSqlRaceDatabaseSessionWithAssociates something like LoadAndAppendSqlRaceDatabaseSessions
/// <summary>
/// This example demonstrates how to load a Primary session and Append a session
/// from a SQL backed session database in order to create a Composite Session
/// (a session made up of one or more sessions). It then retrieves and prints
/// a small number of sample values for a specified parameter from both the
/// Primary session and its Appended session.
/// </summary>
And then all variables referring to an associate do not make sense.
| var qm = QueryManager.CreateQueryManager(ConnectionString); | ||
| // Get the most recent live session from the database | ||
|
|
||
| // Get the most recent live sessions from the database |
There was a problem hiding this comment.
Not sure this statement is correct?
| /// used to retrieve samples. The example prints both the raw parameter values and the | ||
| /// resulting Function values to the console. | ||
| /// </summary> | ||
| private static void CreateFunctionAcrossMultipleSessionsWithCompositeSession() |
There was a problem hiding this comment.
Summary mentions Associate sessions but it is Appending any session.
Need to update variables with and comments to be Appended related rather than associates.
| using (var pda = compositeSession.CreateParameterDataAccess(primaryParamId)) | ||
| { | ||
| pda.GoTo(compositeSession.StartTime + (compositeSession.EndTime - compositeSession.StartTime) / 2); | ||
| var samples = pda.GetNextSamples(10); |
There was a problem hiding this comment.
My original PR had a comment for me to
var samples = pda.GetNextSamples(10);
if (samples == null)
{
Console.WriteLine($"Failed to get samples for {primaryParameterIdentifier}");
return;
}
Forgot to add a check to make sure we have samples.
| using (var pda = compositeSession.CreateParameterDataAccess(associateParamId)) | ||
| { | ||
| pda.GoTo(compositeSession.StartTime + (compositeSession.EndTime - compositeSession.StartTime) / 2); | ||
| var samples = pda.GetNextSamples(10); |
There was a problem hiding this comment.
Original PR has a comment to
var samples = pda.GetNextSamples(10);
if (samples == null)
{
Console.WriteLine($"Failed to get samples for {associateParameterIdentifier}");
return;
}
Forgot to add a check to make sure we have samples.
| /// </summary> | ||
| private static void CreateFunctionAcrossMultipleSessionsWithCompositeSession() | ||
| { | ||
| // ========= EDITABLE SECTION (tweak these values for your run) ========= |
There was a problem hiding this comment.
From Previous PR.
// ===================== REMINDER =====================
// To use Functions, LicenceProgramName must be "ATLAS Data Platform"
// =====================================================
Might be worth adding a reminder above the editable section.
| [ | ||
| primarySessionParameterIdentifier, | ||
| associateParameterIdentifier | ||
| ]); |
There was a problem hiding this comment.
From Previous PR.
var buildResults = functionManager.Build(functionDefinition);
if (buildResults .Errors.Any())
{
Console.WriteLine("Function build failed.");
foreach (var error in buildResults .Errors)
{
Console.WriteLine($"{error}");
}
return;
}
Forgot to actually build the function. Needs to happen before we build the PDA.
| /// and prints their identifiers. | ||
| /// | ||
| /// This is particularly useful in situations where you know you want to load associate | ||
| /// sessions but do not yet know which associates are available. The returned summaries |
There was a problem hiding this comment.
The return session summaries...
|
|
||
| var compositeSession = new CompositeSession( | ||
| CompositeSessionKey.NewKey(), | ||
| "CompositeSessionWithvTagSessionsTest"); |
There was a problem hiding this comment.
The name of the composite should probably be "AppendSessions", or something other than CompositeSessionWithvTagSessionsTest.
Summary
Updates all SQL Race examples for the new CompositeSession API.
Changes
New examples demonstrating CompositeSession API:
LoadSSNWtihAssociates()— Load file session with associates viaFileSessionManager.LoadCompositeSessionLoadSqlRaceDatabaseSessionWithAssociates()— Load from SQL database viaSessionManager.LoadCompositeSessionLoadSessionViaQueryManagerWithAssociate()— Discover sessions via QueryManager, then load as compositeCreateFunctionAcrossMultipleSessionsWithCompositeSession()— Create FDL functions that span primary + associate sessionsAppendSessions()— Append multiple sessions into a composite sessionNew file:
FunctionHelper.cs— Utility for creating FDL function definitions (single and multi-parameter)API migration:
SetSQLRaceConnection— last param changed fromint(0/1/2) toboolfor delete-on-closeRecordersConfiguration.AddConfiguration— sameint→boolchangeLoadSSNWithAssociatedMerge()(old merging flow)CreateSessionWithTimeZoneValue()(moved to separate PR TimeZone Property SQL Race Example #57)LoadAssociated()→GetAssociatedSessionSummaries()Supersedes