Comments (5)
Few modifications to get it works with a real case:
In Subpipline.cs
public override void Dispose()
{
this.Stop(this.parentPipeline.GetCurrentTime(), true);
this.DisposeComponents();
this.parentPipeline.RemoveSubpipline(this);
this.DiagnosticsCollector?.PipelineDisposed(this);
}
In Pipline.cs
internal bool RemoveSubpipline(Subpipeline subpipeline)
{
PipelineElement node = this.components.FirstOrDefault(c => c.StateObject == subpipeline);
if (node == null)
{
return false;
}
if (!subpipeline.IsCompleted)
{
throw new InvalidOperationException($"Subpipeline is still running, it can't be removed from parent pipeline.");
}
List<PipelineElement> list = subpipeline.Components.ToList();
list.Add(node);
SynchronizationLock locker = new SynchronizationLock(this, true);
this.scheduler.Freeze(locker);
this.components = new ConcurrentQueue<PipelineElement>(this.components.Where(x => !list.Contains(x)));
this.DiagnosticsCollector?.PipelineElementDisposed(this, node);
locker.Release();
return true;
}
It probably still needs some improvements (DiagnosticsCollector).
from psi.
Hello, can you explain a bit more about your use case which would benefit from stopping and resuming subpipelines? Pausing, stopping, and resuming (sub)pipelines mid-process is a bit tricky given the way the system has been designed so far. Take a look at the long discussion in issue #256.
Another idea is to look into the use of the Parallel Operator. This operator already has the ability to dynamically construct and tear down subpipelines according to the data flowing into it, and it's pretty extensible. It was carefully designed to do this in the right way. I wonder if you could use Parallel to achieve the goals in your scenario?
from psi.
Thanks for the answers and the information.
What we want to do is to be able to remove a subpipeline without disposing the parent pipeline. At the moment, in our setup we have a dedicated computer for handling a kinect azure camera. We’ve done a WPF application that stream the data through the RendezVous system. Our next step is to able able to start and stop the kinect streaming with a command from a remote computer (as we might have configuration modification).
What we try to have is a pipeline that own RemoteClockImporter and a RemoteExporter for diagnostics. And have subpipeline for each RendezVous.Process that can be created and disposed while the pipline is still running.
We was looking at independents pipelines with Connector for the clock and the diagnostics. But maybe the ParallelOperator is the way to go, thanks!
from psi.
I've checked the ParallelOperator, it does not seems to work on my case as I have different type of streams. I may have found a better solution for my use case by adding a method in the Pipeline class :
/// <summary>
/// Create new pipeline setting time offset and diagnostics collector from given pipeline.
/// </summary>
/// <param name="pipeline">Pipeline to retrieve time offset and diagonistic configuration.</param>
/// <param name="name">Pipeline name.</param>
/// <param name="threadCount">Number of threads.</param>
/// <param name="allowSchedulingOnExternalThreads">Whether to allow scheduling on external threads.</param>
/// <param name="enableDiagnostics">Indicates whether to enable collecting and publishing diagnostics information on the Pipeline.Diagnostics stream.</param>
/// <returns>Created pipeline.</returns>
public static Pipeline CreateSynchedPipeline(
Pipeline pipeline,
string name = null,
int threadCount = 0,
bool allowSchedulingOnExternalThreads = false,
bool enableDiagnostics = false)
{
Pipeline newPipeline = new Pipeline(name == null ? $"Synched|{pipeline.Name}" : name, pipeline.defaultDeliveryPolicy, threadCount, allowSchedulingOnExternalThreads);
newPipeline.VirtualTimeOffset = pipeline.VirtualTimeOffset;
newPipeline.DiagnosticsCollector = enableDiagnostics ? pipeline.DiagnosticsCollector : null;
newPipeline.DiagnosticsConfiguration = pipeline.DiagnosticsConfiguration;
return newPipeline;
}
from psi.
I'm closing this issue, the implementation is available at https://github.com/SaacPSI/psi/tree/Pipline%2BExporter.
from psi.
Related Issues (20)
- Poor Serialization Performance for the Diagnostics's `TrackMessageSize` HOT 4
- .NET Native Support
- PsiStoreReader has an inconsistent output for indexed entries on different projects (DotNet vs. UWP) same x64 architecture HOT 2
- Could not load file or assembly 'Microsoft.Psi.Media_Interop.Windows.x64, Version=0.18.72.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. HOT 2
- PsiStudio not displaying correctly properties with new visualizers HOT 4
- Connecting windows C# and Ubuntu py with interop HOT 2
- If operator to compare to ip producer variables in order to send a specific frame HOT 2
- [whoisusing] MIT Interactive Robotics Group
- Exporting audio and video from PSI store HOT 4
- Using Kinect and a Webcam HOT 3
- sigma exception when connecting to server HOT 3
- [Bug] Diagnostics crash HOT 7
- How to Determine if a Message is the Last Message? HOT 2
- Pipeline still accessing PSIStore after leaving call (PSIBot) HOT 1
- Error: Invalid Index Entry HOT 2
- PsiStoreTool runtime error
- Microsoft.Psi.Language.csproj needs to be included in Sigma.sln
- Clarification on offline capabilities HOT 1
- [Bug] Some audio assemblies are not present in the Microsoft.Psi.Audio NuGet package HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psi.