Exemplo n.º 1
0
func (etr *ExhibitorTaskRunner) RunTask(context *framework.Variables, application *framework.Application, task map[string]string) error {
	api := context.MustGet(fmt.Sprintf("%s.api", application.ID))

	client := NewExhibitorMesosClient(api)
	_, err := client.Add(task)
	if err != nil {
		return err
	}

	_, err = client.Update(task)
	if err != nil {
		return err
	}

	response, err := client.Start(task)
	if err != nil {
		return err
	}

	err = etr.fillTaskContext(context, application, response)
	if err != nil {
		return err
	}

	return client.AwaitZookeeperRunning()
}
Exemplo n.º 2
0
func (ztr *ZipkinTaskRunner) RunTask(context *framework.Variables, application *framework.Application, task map[string]string) error {
	api := context.MustGet(fmt.Sprintf("%s.api", application.ID))

	id, ok := task["id"]
	if !ok {
		return errors.New("Missing task id")
	}

	taskType, ok := task["type"]
	if !ok {
		return fmt.Errorf("Missing task type for id %s", id)
	}

	client := NewZipkinMesosClient(api)
	_, err := client.Add(task)
	if err != nil {
		return err
	}

	response, err := client.Start(task)
	if err != nil {
		return err
	}

	if taskType == "query" {
		return ztr.fillTaskContext(context, application, response)
	}

	return nil
}
Exemplo n.º 3
0
func (str *StatsdTaskRunner) RunTask(context *framework.Variables, application *framework.Application, task map[string]string) error {
	api := context.MustGet(fmt.Sprintf("%s.api", application.ID))

	client := NewStatsdMesosClient(api)
	err := client.Update(task)
	if err != nil {
		return err
	}
	return client.Start(task)
}
Exemplo n.º 4
0
func (dtr *DSETaskRunner) RunTask(context *framework.Variables, application *framework.Application, task map[string]string) error {
	api := context.MustGet(fmt.Sprintf("%s.api", application.ID))

	client := NewDSEMesosClient(api)
	_, err := client.Add(task)
	if err != nil {
		return err
	}

	response, err := client.Start(task)
	if err != nil {
		return err
	}

	return dtr.fillTaskContext(context, application, response)
}