00001
00002
00003
00004
00005
00006
00007 #ifndef WORK_QUEUE_CATALOG_H
00008 #define WORK_QUEUE_CATALOG_H
00009
00010 #include "work_queue.h"
00011 #include "work_queue_protocol.h"
00012 #include "work_queue_resources.h"
00013
00014 #include "catalog_query.h"
00015 #include "datagram.h"
00016 #include "domain_name_cache.h"
00017 #include "nvpair.h"
00018 #include "username.h"
00019 #include "link.h"
00020 #include "hash_cache.h"
00021 #include "list.h"
00022 #include "xxmalloc.h"
00023 #include "debug.h"
00024 #include "stringtools.h"
00025 #include "domain_name_cache.h"
00026 #include "timestamp.h"
00027
00028 #include <stdio.h>
00029 #include <stdlib.h>
00030 #include <time.h>
00031 #include <unistd.h>
00032 #include <string.h>
00033 #include <fcntl.h>
00034 #include <errno.h>
00035 #include <sys/types.h>
00036 #include <sys/stat.h>
00037
00038 #define CATALOG_TYPE_WORK_QUEUE_MASTER "wq_master"
00039 #define CATALOG_TYPE_WORK_QUEUE_POOL "wq_pool"
00040
00041 #define WORK_QUEUE_CATALOG_MASTER_UPDATE_INTERVAL 30
00042 #define WORK_QUEUE_CATALOG_MASTER_AD_LIFETIME 300
00043
00044 #define WORK_QUEUE_CATALOG_POOL_UPDATE_INTERVAL 15
00045 #define WORK_QUEUE_CATALOG_POOL_AD_LIFETIME 180
00046
00047 #define WORK_QUEUE_NAME_MAX 256
00048
00049 struct work_queue_master {
00050 char addr[LINK_ADDRESS_MAX];
00051 int port;
00052 char proj[WORK_QUEUE_NAME_MAX];
00053 time_t start_time;
00054 int priority;
00055 int capacity;
00056 int tasks_waiting;
00057 int tasks_running;
00058 int tasks_complete;
00059 int total_tasks_dispatched;
00060 int workers_init;
00061 int workers_ready;
00062 int workers_busy;
00063 int workers_full;
00064 int workers;
00065 char *workers_by_pool;
00066 char owner[USERNAME_MAX];
00067 int default_max_workers_from_pool;
00068 int workers_need;
00069 int workers_need_from_pool;
00070 int workers_connected_from_pool;
00071 int target_workers_from_pool;
00072 };
00073
00074 struct work_queue_pool {
00075 char addr[LINK_ADDRESS_MAX];
00076 char name[WORK_QUEUE_POOL_NAME_MAX];
00077 char *decision;
00078 char owner[USERNAME_MAX];
00079 };
00080
00081 struct pool_info {
00082 char name[WORK_QUEUE_POOL_NAME_MAX];
00083 unsigned int count;
00084 };
00085
00086 void debug_print_masters(struct list *ml);
00087
00088 int parse_catalog_server_description(char *server_string, char **host, int *port);
00089
00090 struct work_queue_pool *parse_work_queue_pool_nvpair(struct nvpair *nv);
00091
00092 void free_work_queue_pool(struct work_queue_pool *p);
00093
00094 int workers_by_item(const char *workers_by_item, const char *item_name);
00095
00096 struct work_queue_master *parse_work_queue_master_nvpair(struct nvpair *nv);
00097
00098 struct work_queue_master *duplicate_work_queue_master(struct work_queue_master *master);
00099
00100 void free_work_queue_master(struct work_queue_master *m);
00101
00102 void free_work_queue_master_list(struct list *ml);
00103
00104 struct list *get_masters_from_catalog(const char *catalog_host, int catalog_port, struct list *regex_list);
00105
00106 int advertise_master_to_catalog(const char *catalog_host, int catalog_port, const char *project_name, const char *master_address, struct work_queue_stats *s, struct work_queue_resources *r, const char *workers_summary );
00107
00108 int get_pool_decisions_from_catalog(const char *catalog_host, int catalog_port, const char *proj, struct list *decisions);
00109
00110 int advertise_pool_decision_to_catalog(const char *catalog_host, int catalog_port, const char *pool_name, pid_t pid, time_t pool_start_time, const char *decision, int workers_requested);
00111 #endif