aboutsummaryrefslogtreecommitdiff
path: root/zenserver/compute/apply.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/compute/apply.cpp')
-rw-r--r--zenserver/compute/apply.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/zenserver/compute/apply.cpp b/zenserver/compute/apply.cpp
index 2c3243655..e40c6918d 100644
--- a/zenserver/compute/apply.cpp
+++ b/zenserver/compute/apply.cpp
@@ -806,11 +806,14 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
CbPackage OutputPackage;
CbObject Output = zen::LoadCompactBinaryObject(OutputData.Data[0]);
+ uint64_t TotalAttachmentBytes = 0;
+ uint64_t TotalRawAttachmentBytes = 0;
+
Output.IterateAttachments([&](CbFieldView Field) {
IoHash Hash = Field.AsHash();
std::filesystem::path OutputPath{SandboxPath / "Outputs" / Hash.ToHexString()};
- FileContents ChunkData = zen::ReadFile(SandboxPath / "build.output");
+ FileContents ChunkData = zen::ReadFile(OutputPath);
if (ChunkData.ErrorCode)
{
@@ -819,12 +822,27 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
ZEN_ASSERT(OutputData.Data.size() == 1);
- CbAttachment Attachment(CompressedBuffer::FromCompressed(SharedBuffer(ChunkData.Data[0])));
+ CompressedBuffer AttachmentBuffer = CompressedBuffer::FromCompressed(SharedBuffer(ChunkData.Data[0]));
+
+ if (!AttachmentBuffer)
+ {
+ throw std::runtime_error("Invalid output encountered (not valid CompressedBuffer format)");
+ }
+
+ TotalAttachmentBytes += AttachmentBuffer.GetCompressedSize();
+ TotalRawAttachmentBytes += AttachmentBuffer.GetCompressedSize();
+
+ CbAttachment Attachment(AttachmentBuffer);
OutputPackage.AddAttachment(Attachment);
});
OutputPackage.SetObject(Output);
+ ZEN_DEBUG("Action completed with {} attachments ({} compressed, {} uncompressed)",
+ OutputPackage.GetAttachments().size(),
+ NiceBytes(TotalAttachmentBytes),
+ NiceBytes(TotalRawAttachmentBytes));
+
return OutputPackage;
}