From 79ddbe990afe5975605c06ec94a67b52520e341c Mon Sep 17 00:00:00 2001 From: "davidad (David A. Dalrymple)" Date: Mon, 27 Apr 2020 17:18:04 -0500 Subject: [PATCH] adapt for binary outputs --- fungi-coord/main.go | 3 +-- fungi-worker/main.go | 4 ++-- types.go | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fungi-coord/main.go b/fungi-coord/main.go index 2c09a0a..f9f01f7 100644 --- a/fungi-coord/main.go +++ b/fungi-coord/main.go @@ -1,7 +1,6 @@ package main import ( - "encoding/json" "fmt" "log" "os" @@ -215,7 +214,7 @@ func (c *Coordinator) writeResult(job int, res *fungi.JobResult) error { } defer fi.Close() - if err := json.NewEncoder(fi).Encode(res); err != nil { + if _, err := fi.Write(res.Output); err != nil { return xerrors.Errorf("failed to write result to file: %w", err) } return nil diff --git a/fungi-worker/main.go b/fungi-worker/main.go index ad1c411..4e978e9 100644 --- a/fungi-worker/main.go +++ b/fungi-worker/main.go @@ -159,7 +159,7 @@ func (w *Worker) Execute(ja *fungi.JobAllocation) { res := &fungi.JobResult{ JobID: ja.ID, Success: false, - Output: string(out), + Output: out, } w.Results <- res return @@ -168,7 +168,7 @@ func (w *Worker) Execute(ja *fungi.JobAllocation) { w.Results <- &fungi.JobResult{ JobID: ja.ID, Success: true, - Output: string(out), + Output: out, } } diff --git a/types.go b/types.go index efc6f51..e8e68a3 100644 --- a/types.go +++ b/types.go @@ -19,7 +19,7 @@ type JobConfig struct { type JobResult struct { JobID int Success bool - Output string + Output []byte } func LoadJobConfig(fn string) (*JobConfig, error) {