| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package server
- import "time"
- func (server *Server) agentManager() {
- // Declare variables
- // Agents free to run solutions
- var agents_free int
- // Tasks up for grabs
- var tasks_free int
- // Start the great for-loop
- for {
- agents_free = 0
- // Count the number of agents without a runnig task
- for key := range server.Agents {
- if server.Agents[key].TaskId == 0 {
- agents_free += 1
- }
- }
- // Check if there are any new Tasks up for grabs
- for key := range server.Tasks {
- if server.Tasks[key].Status == 0 {
- tasks_free += 1
- }
- }
- // See if the task can be divided by the number of agents
- // if agents_free > len(row1s) {} <-- Where the fuck does row1s come from?
- // For proof-of-conept I will just send it
- // If so, split
- // if not, split-1
- // Try again
- // Give agents task, maybe even look for the ones with the most CPUs
- // 😴
- time.Sleep(10 * time.Second)
- }
- }
|