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

Running a new job

Once the master node creates a new masterJobCoordinator instance, it invokes its RunJob method to kick off the execution of the job. Since the method is a bit lengthy, we will break it down into a set of smaller blocks:

execFactory := newMasterExecutorFactory(c.cfg.serializer, c.barrier)
executor, err := c.cfg.jobRunner.StartJob(c.cfg.jobDetails, execFactory)
if err != nil {
    c.cancelJobCtx()
    return xerrors.Errorf("unable to start job on master: %w", err)
}

for assignedPartition, w := range c.cfg.workers {
    w.SetDisconnectCallback(c.handleWorkerDisconnect)
    if err := c.publishJobDetails(w, assignedPartition); err != nil {
        c.cfg.jobRunner.AbortJob(c.cfg.jobDetails)
        c.cancelJobCtx()
        return err
    }
}

The first two lines in the ...

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