Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Implementing the job runner for master nodes

Let's begin by examining the rather trivial StartJob method implementation for the master node:

func (n *MasterNode) StartJob(_ job.Details, execFactory bspgraph.ExecutorFactory) (*bspgraph.Executor, error) {
    if err := n.calculator.Graph().Reset(); err != nil {
        return nil, err
    }

    n.jobStartedAt = n.cfg.Clock.Now()
    n.calculator.SetExecutorFactory(execFactory)
    return n.calculator.Executor(), nil
}

The StartJob method records the time when the job was started and performs the following three tasks:

  1. It resets the graph's internal state. This is important as the calculator component instance is re-used between subsequent job runs.
  2. It overrides the calculator component's executor factory with the version ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content