protected override void AttachToViewProcess(RemoteViewClient remoteViewClient) { //Still want to tick on time changed because it may need a recompile //Should probably deal with this ourselves var options = new ExecutionOptions(new InfiniteViewCycleExecutionSequence(), ViewExecutionFlags.TriggersEnabled | ViewExecutionFlags.AwaitMarketData, null, new ViewCycleExecutionOptions(default(DateTimeOffset), new LiveMarketDataSpecification())); remoteViewClient.AttachToViewProcess(_basisViewName, options); }
private void Prepare() { try { CheckDisposed(); _remoteViewClient = _remoteEngineContext.ViewProcessor.CreateClient(); CheckDisposed(); var eventViewResultListener = new EventViewResultListener(); eventViewResultListener.CycleCompleted += (sender, e) => Update(e.FullResult); eventViewResultListener.ViewDefinitionCompilationFailed += (sender, e) => SetError(e.Exception); eventViewResultListener.ViewDefinitionCompiled += delegate { _graphsOutOfDate = true; }; eventViewResultListener.CycleExecutionFailed += (sender, e) => SetError(e.Exception); _remoteViewClient.SetResultListener(eventViewResultListener); _remoteViewClient.SetViewCycleAccessSupported(true); CheckDisposed(); AttachToViewProcess(_remoteViewClient); } catch (Exception ex) { SetError(ex); } }
public Dictionary<YieldCurveKey, Dictionary<string, ValueRequirement>> GetYieldCurveRequirements(RemoteViewClient client, IViewCycle cycle) { UniqueId clientId = client.GetUniqueId(); UniqueId cycleId = cycle.UniqueId; var createTarget = _rest.Resolve("yieldCurveSpecs", clientId.ToString(), cycleId.ToString()); return createTarget.Get<Dictionary<YieldCurveKey, Dictionary<string, ValueRequirement>>>(); }
public ManageableMarketDataSnapshot CreateSnapshot(RemoteViewClient client, IViewCycle cycle) { UniqueId clientId = client.GetUniqueId(); UniqueId cycleId = cycle.UniqueId; var createTarget = _rest.Resolve("create", clientId.ToString(), cycleId.ToString()); return createTarget.Get<ManageableMarketDataSnapshot>(); }
public static IEnumerable <CycleCompletedArgs> GetCycles(this RemoteViewClient client, Action <RemoteViewClient> attachAction) { using (var resultQueue = new BlockingCollection <object>(new ConcurrentQueue <object>())) using (var otherQueue = new BlockingCollection <object>(new ConcurrentQueue <object>())) { var resultListener = new EventViewResultListener(); resultListener.CycleCompleted += (sender, e) => resultQueue.Add(e); resultListener.CycleExecutionFailed += (s, e) => otherQueue.Add(e); resultListener.ProcessTerminated += (s, e) => otherQueue.Add(e); resultListener.ViewDefinitionCompilationFailed += (s, e) => otherQueue.Add(e); client.SetResultListener(resultListener); attachAction(client); TimeSpan timeout = TimeSpan.FromMinutes(1); try { while (true) { object next; var index = BlockingCollection <object> .TryTakeFromAny(new[] { resultQueue, otherQueue }, out next, timeout); if (index == 0) { yield return((CycleCompletedArgs)next); } else { var detailMessage = string.Format("for {0} after {1}\n state {2} is completed {3}", client.GetViewDefinition().Name, timeout, client.GetState(), client.IsCompleted); switch (index) { case 0: throw new ArgumentException("index"); case 1: throw new Exception(string.Format("Error occured whilst getting results {0}\n{1}", next, detailMessage)); default: throw new TimeoutException("No results received " + detailMessage); } } } } finally { client.RemoveResultListener(); } } }
protected abstract void AttachToViewProcess(RemoteViewClient remoteViewClient);
protected override void AttachToViewProcess(RemoteViewClient remoteViewClient) { remoteViewClient.AttachToViewProcess(_viewDefinition.UniqueID, ExecutionOptions.Snapshot(_snapshotId)); }
public static IEnumerable <CycleCompletedArgs> GetCycles(this RemoteViewClient client, UniqueId viewDefinitionId, IViewExecutionOptions executionOptions, bool newBatchProcess = false) { return(GetCycles(client, rvc => rvc.AttachToViewProcess(viewDefinitionId, executionOptions, newBatchProcess))); }
public static IEnumerable <IViewComputationResultModel> GetResults(this RemoteViewClient client, UniqueId viewDefinitionId, IViewExecutionOptions executionOptions, bool newBatchProcess = false) { return(GetCycles(client, viewDefinitionId, executionOptions, newBatchProcess).Select(e => e.FullResult)); }