Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

adapt for binary outputs #2

Merged
merged 1 commit into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions fungi-coord/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"encoding/json"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions fungi-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
}
}

Expand Down
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type JobConfig struct {
type JobResult struct {
JobID int
Success bool
Output string
Output []byte
}

func LoadJobConfig(fn string) (*JobConfig, error) {
Expand Down