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

Commit

Permalink
Merge pull request #2 from davidad/binary-outputs
Browse files Browse the repository at this point in the history
adapt for binary outputs
  • Loading branch information
whyrusleeping authored May 4, 2020
2 parents 54594cb + 79ddbe9 commit 95b77c5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
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

0 comments on commit 95b77c5

Please sign in to comment.