<commit_before>package main

import (
	"net/http"
	"os"

	"fmt"

	"github.com/Gamebuildr/Dave/client"
	"github.com/Gamebuildr/Dave/pkg/config"
	"github.com/Gamebuildr/Dave/pkg/scaler"
	"github.com/robfig/cron"
)

func main() {
	c := cron.New()
	daveClient := client.DaveClient{}
	daveClient.Create()

	gogetaScaler := createGogetaScaler()
	mrrobotScaler := createMrRobotScaler()

	c.AddFunc("0 * * * * *", func() {
		daveClient.RunClient(gogetaScaler, os.Getenv(config.GogetaSQSEndpoint))
		daveClient.RunClient(mrrobotScaler, os.Getenv(config.MrrobotSQSEndpoint))
	})
	c.Start()

	daveClient.Log.Info("Dave client running on port 3001.")
	fmt.Printf("Dave client running on port 3001")
	err := http.ListenAndServe(":3001", nil)
	if err != nil {
		daveClient.Log.Error(err.Error())
	}
}

func createGogetaScaler() *scaler.ScalableSystem {
	loadAPI := os.Getenv(config.HalGogetaAPI) + "api/container/count"
	addLoadAPI := os.Getenv(config.HalGogetaAPI) + "api/container/run"

	gogetaScaler := scaler.HTTPScaler{
		LoadAPIUrl:    loadAPI,
		AddLoadAPIUrl: addLoadAPI,
		Client:        &http.Client{},
	}
	system := scaler.ScalableSystem{
		System:  gogetaScaler,
		MaxLoad: 10,
	}
	return &system
}

func createMrRobotScaler() *scaler.ScalableSystem {
	loadAPI := os.Getenv(config.HalMrRobotAPI) + "api/container/count"
	addLoadAPI := os.Getenv(config.HalMrRobotAPI) + "api/container/run"

	mrrobotScaler := scaler.HTTPScaler{
		LoadAPIUrl:    loadAPI,
		AddLoadAPIUrl: addLoadAPI,
		Client:        &http.Client{},
	}
	system := scaler.ScalableSystem{
		System:  mrrobotScaler,
		MaxLoad: 3,
	}
	return &system<commit_msg>Add docker image name to run endpoint<commit_after>package main

import (
	"net/http"
	"os"

	"fmt"

	"github.com/Gamebuildr/Dave/client"
	"github.com/Gamebuildr/Dave/pkg/config"
	"github.com/Gamebuildr/Dave/pkg/scaler"
	"github.com/robfig/cron"
)

func main() {
	c := cron.New()
	daveClient := client.DaveClient{}
	daveClient.Create()

	gogetaScaler := createGogetaScaler()
	mrrobotScaler := createMrRobotScaler()

	c.AddFunc("0 * * * * *", func() {
		daveClient.RunClient(gogetaScaler, os.Getenv(config.GogetaSQSEndpoint))
		daveClient.RunClient(mrrobotScaler, os.Getenv(config.MrrobotSQSEndpoint))
	})
	c.Start()

	daveClient.Log.Info("Dave client running on port 3001.")
	fmt.Printf("Dave client running on port 3001")
	err := http.ListenAndServe(":3001", nil)
	if err != nil {
		daveClient.Log.Error(err.Error())
	}
}

func createGogetaScaler() *scaler.ScalableSystem {
	container := "?image=gcr.io/gamebuildr-151415/gamebuildr-gogeta"
	loadAPI := os.Getenv(config.HalGogetaAPI) + "api/container/count"
	addLoadAPI := os.Getenv(config.HalGogetaAPI) + "api/container/run/" + container

	gogetaScaler := scaler.HTTPScaler{
		LoadAPIUrl:    loadAPI,
		AddLoadAPIUrl: addLoadAPI,
		Client:        &http.Client{},
	}
	system := scaler.ScalableSystem{
		System:  gogetaScaler,
		MaxLoad: 10,
	}
	return &system
}

func createMrRobotScaler() *scaler.ScalableSystem {
	container := "?image=gcr.io/gamebuildr-151415/mr-robot-godot-2.1.2"
	loadAPI := os.Getenv(config.HalMrRobotAPI) + "api/container/count"
	addLoadAPI := os.Getenv(config.HalMrRobotAPI) + "api/container/run/" + container

	mrrobotScaler := scaler.HTTPScaler{
		LoadAPIUrl:    loadAPI,
		AddLoadAPIUrl: addLoadAPI,
		Client:        &http.Client{},
	}
	system := scaler.ScalableSystem{
		System:  mrrobotScaler,
		MaxLoad: 3,
	}
	return &system
{'fraction_non_alphanumeric': 0.14481751824817518, 'fraction_numerical': 0.013722627737226278, 'mean_word_length': 4.6072013093289685, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5534745', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1352, 'n_words': 205}