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); }
public Task <RpcCallResult <Unit> > ExecutePipsAsync(OpenBond.PipBuildRequest message, IList <long> semiStableHashes) { var grpcMessage = message.ToGrpc(); return(m_connectionManager.CallAsync( (callOptions) => m_client.ExecutePipsAsync(grpcMessage, options: callOptions), GetExecuteDescription(semiStableHashes))); }
public static PipBuildRequest ToInternalBond(this OpenBond.PipBuildRequest message) { var pipBuildRequest = new PipBuildRequest(); pipBuildRequest.Hashes = new List <FileArtifactKeyedHash>(); foreach (var hash in message.Hashes) { var fileArtifactKeyedHash = new FileArtifactKeyedHash() { ContentHash = hash.ContentHash.ToDistributedContentHash(), FileName = hash.FileName, Length = hash.Length, PathString = hash.PathString, PathValue = hash.PathValue, ReparsePointType = (BondReparsePointType)hash.ReparsePointType, RewriteCount = hash.RewriteCount, ReparsePointTarget = hash.ReparsePointTarget, }; if (hash.AssociatedDirectories != null) { fileArtifactKeyedHash.AssociatedDirectories = new List <BondDirectoryArtifact>(); foreach (var dir in hash.AssociatedDirectories) { fileArtifactKeyedHash.AssociatedDirectories.Add(new BondDirectoryArtifact() { DirectoryPathValue = dir.DirectoryPathValue, DirectorySealId = dir.DirectorySealId, IsDirectorySharedOpaque = dir.IsDirectorySharedOpaque, }); } } pipBuildRequest.Hashes.Add(fileArtifactKeyedHash); } pipBuildRequest.Pips = new List <SinglePipBuildRequest>(); foreach (var pip in message.Pips) { var singlePipBuildRequest = new SinglePipBuildRequest() { ActivityId = pip.ActivityId, ExpectedRamUsageMb = pip.ExpectedRamUsageMb, Fingerprint = pip.Fingerprint.ToDistributionCacheFingerprint(), PipIdValue = pip.PipIdValue, Priority = pip.Priority, SequenceNumber = pip.SequenceNumber, Step = pip.Step }; pipBuildRequest.Pips.Add(singlePipBuildRequest); } return(pipBuildRequest); }
public async Task <RpcCallResult <Unit> > ExecutePipsAsync(OpenBond.PipBuildRequest message, IList <long> semiStableHashes) { var internalBondMessage = message.ToInternalBond(); var result = await m_proxyManager.Call <PipBuildRequest, Void>( internalBondMessage, functionName : "ExecutePips", description : DistributionHelpers.GetExecuteDescription(semiStableHashes)); return(result.ToUnit()); }