Exemple #1
0
        public static OpenBond.WorkerNotificationArgs ToOpenBond(this WorkerNotificationArgs message)
        {
            var completedPips = new List <OpenBond.PipCompletionData>();

            if (message.CompletedPips != null)
            {
                foreach (var i in message.CompletedPips)
                {
                    completedPips.Add(new OpenBond.PipCompletionData()
                    {
                        ExecuteStepTicks = i.ExecuteStepTicks,
                        PipIdValue       = i.PipIdValue,
                        QueueTicks       = i.QueueTicks,
                        ResultBlob       = i.ResultBlob.Data,
                        Step             = i.Step
                    });
                }
            }

            var eventMessages = new List <OpenBond.EventMessage>();

            if (message.ForwardedEvents != null)
            {
                foreach (var i in message.ForwardedEvents)
                {
                    eventMessages.Add(new OpenBond.EventMessage()
                    {
                        EventId       = i.EventId,
                        EventKeywords = i.EventKeywords,
                        EventName     = i.EventName,
                        Id            = i.Id,
                        Level         = i.Level,
                        Text          = i.Text
                    });
                }
            }

            return(new OpenBond.WorkerNotificationArgs()
            {
                BuildId = message.BuildId,
                SenderId = message.SenderId,
                SenderName = message.SenderName,
                WorkerId = message.WorkerId,

                CompletedPips = completedPips,
                ExecutionLogBlobSequenceNumber = message.ExecutionLogBlobSequenceNumber,
                ExecutionLogData = message.ExecutionLogData.Data,
                ForwardedEvents = eventMessages
            });
        }
        private static string GetNotificationDescription(WorkerNotificationArgs notificationArgs, IList <long> semiStableHashes)
        {
            string description = string.Empty;

            if (semiStableHashes != null)
            {
                description += string.Join(", ", semiStableHashes.Select(s => s.ToString("X16", CultureInfo.InvariantCulture)));
            }

            if (notificationArgs.ExecutionLogData != null && notificationArgs.ExecutionLogData.Count > 0)
            {
                description += I($"[ExecutionLogData: Size={notificationArgs.ExecutionLogData.Count}, SequenceNumber={notificationArgs.ExecutionLogBlobSequenceNumber}]");
            }

            return(description);
        }
Exemple #3
0
        public static WorkerNotificationArgs ToInternalBond(this OpenBond.WorkerNotificationArgs message)
        {
            var workerNotificationArgs = new WorkerNotificationArgs()
            {
                BuildId    = message.BuildId,
                SenderId   = message.SenderId,
                SenderName = message.SenderName,
                WorkerId   = message.WorkerId,
                ExecutionLogBlobSequenceNumber = message.ExecutionLogBlobSequenceNumber,
                ExecutionLogData = new BondBlob(message.ExecutionLogData),
            };

            foreach (var i in message.CompletedPips)
            {
                workerNotificationArgs.CompletedPips.Add(new PipCompletionData()
                {
                    ExecuteStepTicks = i.ExecuteStepTicks,
                    PipIdValue       = i.PipIdValue,
                    QueueTicks       = i.QueueTicks,
                    ResultBlob       = new BondBlob(i.ResultBlob),
                    Step             = i.Step
                });
            }

            foreach (var i in message.ForwardedEvents)
            {
                workerNotificationArgs.ForwardedEvents.Add(new EventMessage()
                {
                    EventId       = i.EventId,
                    EventKeywords = i.EventKeywords,
                    EventName     = i.EventName,
                    Id            = i.Id,
                    Level         = i.Level,
                    Text          = i.Text
                });
            }

            return(workerNotificationArgs);
        }