Exemplo n.º 1
0
        /// <inheritdoc/>
        public override Task <RpcResponse> ExecutePips(PipBuildRequest message, ServerCallContext context)
        {
            var bondMessage = message.ToOpenBond();

            m_workerService.ExecutePipsCore(bondMessage);
            return(Task.FromResult(new RpcResponse()));
        }
Exemplo n.º 2
0
        public static PipBuildRequest ToGrpc(this OpenBond.PipBuildRequest message)
        {
            var pipBuildRequest = new PipBuildRequest();

            foreach (var i in message.Hashes)
            {
                var fileArtifactKeyedHash = new FileArtifactKeyedHash()
                {
                    ContentHash      = i.ContentHash.Data.ToByteString(),
                    FileName         = i.FileName ?? string.Empty,
                    Length           = i.Length,
                    PathString       = i.PathString ?? string.Empty,
                    PathValue        = i.PathValue,
                    ReparsePointType = (FileArtifactKeyedHash.Types.GrpcReparsePointType)i.ReparsePointType,
                    RewriteCount     = i.RewriteCount,
                    IsSourceAffected = i.IsSourceAffected,
                };

                if (i.ReparsePointTarget != null)
                {
                    fileArtifactKeyedHash.ReparsePointTarget = i.ReparsePointTarget;
                }

                if (i.AssociatedDirectories != null)
                {
                    foreach (var j in i.AssociatedDirectories)
                    {
                        fileArtifactKeyedHash.AssociatedDirectories.Add(new GrpcDirectoryArtifact()
                        {
                            DirectoryPathValue      = j.DirectoryPathValue,
                            DirectorySealId         = j.DirectorySealId,
                            IsDirectorySharedOpaque = j.IsDirectorySharedOpaque,
                        });
                    }
                }

                pipBuildRequest.Hashes.Add(fileArtifactKeyedHash);
            }

            foreach (var i in message.Pips)
            {
                var singlePipBuildRequest = new SinglePipBuildRequest()
                {
                    ActivityId = i.ActivityId,
                    ExpectedPeakWorkingSetMb    = i.ExpectedPeakWorkingSetMb,
                    ExpectedAverageWorkingSetMb = i.ExpectedAverageWorkingSetMb,
                    ExpectedPeakCommitSizeMb    = i.ExpectedPeakCommitSizeMb,
                    ExpectedAverageCommitSizeMb = i.ExpectedAverageCommitSizeMb,
                    Fingerprint    = i.Fingerprint.Data.ToByteString(),
                    PipIdValue     = i.PipIdValue,
                    Priority       = i.Priority,
                    SequenceNumber = i.SequenceNumber,
                    Step           = i.Step
                };

                pipBuildRequest.Pips.Add(singlePipBuildRequest);
            }

            return(pipBuildRequest);
        }
Exemplo n.º 3
0
        public static OpenBond.PipBuildRequest ToOpenBond(this PipBuildRequest message)
        {
            var hashes = new List <OpenBond.FileArtifactKeyedHash>();

            foreach (var i in message.Hashes)
            {
                var bondDirectories = new List <OpenBond.BondDirectoryArtifact>();
                foreach (var j in i.AssociatedDirectories)
                {
                    bondDirectories.Add(new OpenBond.BondDirectoryArtifact()
                    {
                        DirectoryPathValue      = j.DirectoryPathValue,
                        DirectorySealId         = j.DirectorySealId,
                        IsDirectorySharedOpaque = j.IsDirectorySharedOpaque
                    });
                }

                hashes.Add(new OpenBond.FileArtifactKeyedHash()
                {
                    AssociatedDirectories = bondDirectories,
                    ContentHash           = i.ContentHash.ToBondContentHash(),
                    FileName           = i.FileName ?? string.Empty,
                    Length             = i.Length,
                    PathString         = i.PathString,
                    PathValue          = i.PathValue,
                    ReparsePointTarget = i.ReparsePointTarget,
                    ReparsePointType   = (BondReparsePointType)((int)i.ReparsePointType),
                    RewriteCount       = i.RewriteCount,
                    IsSourceAffected   = i.IsSourceAffected,
                });
            }

            var pips = new List <OpenBond.SinglePipBuildRequest>();

            foreach (var i in message.Pips)
            {
                pips.Add(new OpenBond.SinglePipBuildRequest()
                {
                    ActivityId = i.ActivityId,
                    ExpectedPeakWorkingSetMb    = i.ExpectedPeakWorkingSetMb,
                    ExpectedAverageWorkingSetMb = i.ExpectedAverageWorkingSetMb,
                    ExpectedPeakCommitSizeMb    = i.ExpectedPeakCommitSizeMb,
                    ExpectedAverageCommitSizeMb = i.ExpectedAverageCommitSizeMb,
                    Fingerprint = new BondFingerprint()
                    {
                        Data = i.Fingerprint.ToArraySegmentByte()
                    },
                    PipIdValue     = i.PipIdValue,
                    Priority       = i.Priority,
                    SequenceNumber = i.SequenceNumber,
                    Step           = i.Step,
                });
            }

            return(new OpenBond.PipBuildRequest()
            {
                Hashes = hashes,
                Pips = pips
            });
        }
Exemplo n.º 4
0
        internal void ExecutePipsCore(PipBuildRequest request)
        {
            var reportInputsResult = TryReportInputs(request.Hashes);

            for (int i = 0; i < request.Pips.Count; i++)
            {
                SinglePipBuildRequest pipBuildRequest = request.Pips[i];

                // Start the pip. Handle the case of a retry - the pip may be already started by a previous call.
                if (m_handledBuildRequests.Add(pipBuildRequest.SequenceNumber))
                {
                    HandlePipStepAsync(pipBuildRequest, reportInputsResult).Forget();
                }
            }
        }
Exemplo n.º 5
0
        internal void ExecutePipsCore(PipBuildRequest request)
        {
            var reportInputsResult = TryReportInputs(request.Hashes);

            for (int i = 0; i < request.Pips.Count; i++)
            {
                SinglePipBuildRequest pipBuildRequest = request.Pips[i];

                // Start the pip. Handle the case of a retry - the pip may be already started by a previous call.
                if (m_handledBuildRequests.Add(pipBuildRequest.SequenceNumber))
                {
                    var pipId = new PipId(pipBuildRequest.PipIdValue);
                    var pip   = m_pipTable.HydratePip(pipId, PipQueryContext.HandlePipStepOnWorker);
                    m_pendingBuildRequests[pipId] = pipBuildRequest;
                    var pipCompletionData = new ExtendedPipCompletionData(new PipCompletionData()
                    {
                        PipIdValue = pipId.Value, Step = pipBuildRequest.Step
                    })
                    {
                        SemiStableHash = m_pipTable.GetPipSemiStableHash(pipId)
                    };

                    m_pendingPipCompletions[pipId] = pipCompletionData;

                    HandlePipStepAsync(pip, pipCompletionData, pipBuildRequest, reportInputsResult).Forget((ex) =>
                    {
                        Scheduler.Tracing.Logger.Log.HandlePipStepOnWorkerFailed(
                            m_appLoggingContext,
                            pip.GetDescription(m_environment.Context),
                            ex.ToString());

                        // HandlePipStep might throw an exception after we remove pipCompletionData from m_pendingPipCompletions.
                        // That's why, we check whether the pipCompletionData still exists there.
                        if (m_pendingPipCompletions.ContainsKey(pip.PipId))
                        {
                            ReportResult(
                                pip,
                                ExecutionResult.GetFailureNotRunResult(m_appLoggingContext),
                                (PipExecutionStep)pipBuildRequest.Step);
                        }
                    });
                }
            }
        }