Reader small image

You're reading from  Apache Mesos Cookbook

Product typeBook
Published inAug 2017
PublisherPackt
ISBN-139781785884627
Edition1st Edition
Right arrow
Authors (2):
David Blomquist
David Blomquist
author image
David Blomquist

David Blomquist been working with computers since the 1980s. His first computer was an Apple Macintosh and the first networked computer he managed was a 10 terminal Xenix system. Since that time, David has held positions in virtually every area of IT, including operations, development, and architecture. David now specializes in designing Big Data, HPC, and Grid Computing systems with applications in Health Care and Science. Most recently, he has designed and deployed several large-scale clusters for the Federal Government.
Read more about David Blomquist

View More author details
Right arrow

Scheduling tasks


In this recipe, we will ask Mesos to run a task.

How to do it...

First of all, we need to know what task we want to schedule. To allow communication with the framework, we will prepare the HTTP API.

To handle HTTP requests, we need to implement the HTTP handler and bind it to some ports.

Let's declare the following variables in the main() function:

listen := ":9090"
webuiURL := fmt.Sprintf("http://%s%s", hostname, listen)

Let's also declare one global variable:

var taskID uint64

Tasks can be launched only when offers are available. To communicate with the offer handler, we will use a channel. If you are not familiar with Golang channels, they're similar to a message queue or pipe. Basically, you write at one end and read at another. Let's declare it globally:

var commandChan = make(chan string, 100)

Extend the FrameworkInfo definition with the just-created web UI URL:

frameworkInfo = FrameworkInfo{
        User: &user,
        Name: &name,
        Hostname: &hostname,
...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Apache Mesos Cookbook
Published in: Aug 2017Publisher: PacktISBN-13: 9781785884627

Authors (2)

author image
David Blomquist

David Blomquist been working with computers since the 1980s. His first computer was an Apple Macintosh and the first networked computer he managed was a 10 terminal Xenix system. Since that time, David has held positions in virtually every area of IT, including operations, development, and architecture. David now specializes in designing Big Data, HPC, and Grid Computing systems with applications in Health Care and Science. Most recently, he has designed and deployed several large-scale clusters for the Federal Government.
Read more about David Blomquist