52 host->
name = g_strdup(name);
53 host->
address = g_strdup(address);
105 V_HOST(
"HOST[%s] load increased to %d\n", host->
name, host->
running);
116 V_HOST(
"HOST[%s] load decreased to %d\n", host->
name, host->
running);
129 buf = g_strdup_printf(
"host:%s address:%s max:%d running:%d\n",
131 g_output_stream_write(ostr, buf, strlen(buf), NULL, NULL);
146 GList* host_queue = *queue;
150 for(curr = host_queue; curr != NULL; curr = curr->next)
160 host_queue = g_list_remove(host_queue, ret);
161 host_queue = g_list_append(host_queue, ret);
177 g_output_stream_write(ostr,
"\nend\n", 5, NULL, NULL);
void host_insert(host_t *host, scheduler_t *scheduler)
Inserts a new host into the scheduler structure.
host_t * host_init(char *name, char *address, char *agent_dir, int max)
Creates a new host, and adds it to the host list.
void host_decrease_load(host_t *host)
Decrease the number of running agents on a host by 1.
void print_host_load(GTree *host_list, GOutputStream *ostr)
Prints the host information to ostr.
void host_destroy(host_t *host)
Frees and uninitializes any memory associated with the host struct.
host_t * get_host(GList **queue, uint8_t num)
void host_increase_load(host_t *host)
Increase the number of running agents on a host by 1.
static int print_host_all(gchar *host_name, host_t *host, GOutputStream *ostr)
GTraversFunction that allows the information for all hosts to be printed.
void host_print(host_t *host, GOutputStream *ostr)
Prints the information about a host to the output stream.
FUNCTION int max(int permGroup, int permPublic)
Get the maximum group privilege.
Header file for the scheduler.
char * agent_dir
The location on the host machine where the executables are.
int running
The number of agents currently running on this host.
char * address
The address of the host, used by ssh when starting a new agent.
char * name
The name of the host, used to store host internally to scheduler.
int max
The max number of agents that can run on this host.
GList * host_queue
Round-robin queue for choosing which host use next.
GTree * host_list
List of all hosts available to the scheduler.