work_queue_catalog.h

00001 /*
00002 Copyright (C) 2012- The University of Notre Dame
00003 This software is distributed under the GNU General Public License.
00004 See the file COPYING for details.
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 
00013 #include "catalog_query.h"
00014 #include "catalog_server.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 WORK_QUEUE_CATALOG_UPDATE_INTERVAL 60
00039 #define WORK_QUEUE_CATALOG_LIFETIME     300
00040 
00041 #define WORK_QUEUE_NAME_MAX 256
00042 #define WORK_QUEUE_PROTOCOL_BLANK_FIELD "-"
00043 #define WORK_QUEUE_PROTOCOL_FIELD_MAX 256
00044 
00045 struct work_queue_master {
00046         char addr[LINK_ADDRESS_MAX];
00047         int port;
00048         char proj[WORK_QUEUE_NAME_MAX];
00049         timestamp_t start_time;
00050         int priority;
00051         int capacity;
00052         int tasks_waiting;
00053         int tasks_running;
00054         int tasks_complete;
00055         int total_tasks_dispatched;
00056         int workers_init;
00057         int workers_ready;
00058         int workers_busy;
00059         int workers;
00060         char *workers_by_pool;
00061         char owner[USERNAME_MAX];
00062         int default_max_workers_from_pool;
00063         int workers_need;
00064         int workers_from_this_pool;
00065         int target_workers_from_pool;
00066 };
00067 
00068 struct work_queue_pool {
00069         char addr[LINK_ADDRESS_MAX];
00070         char name[WORK_QUEUE_POOL_NAME_MAX];
00071         char *decision;
00072         char owner[USERNAME_MAX];
00073 };
00074 
00075 struct pool_info {
00076         char name[WORK_QUEUE_POOL_NAME_MAX];
00077         unsigned int count;
00078 };
00079 
00080 void debug_print_masters(struct list *ml);
00081 
00082 int parse_catalog_server_description(char *server_string, char **host, int *port);
00083 
00084 struct work_queue_pool *parse_work_queue_pool_nvpair(struct nvpair *nv);
00085 
00086 void free_work_queue_pool(struct work_queue_pool *p);
00087 
00088 int workers_by_item(const char *workers_by_item, const char *item_name);
00089 
00090 struct work_queue_master *parse_work_queue_master_nvpair(struct nvpair *nv);
00091 
00092 struct work_queue_master *duplicate_work_queue_master(struct work_queue_master *master);
00093 
00094 void free_work_queue_master(struct work_queue_master *m);
00095 
00096 void free_work_queue_master_list(struct list *ml);
00097 
00098 struct list *get_masters_from_catalog(const char *catalog_host, int catalog_port, struct list *regex_list);
00099 
00100 int advertise_master_to_catalog(const char *catalog_host, int catalog_port, const char *project_name, struct work_queue_stats *s, const char *workers_summary, int now);
00101 
00102 int get_pool_decisions_from_catalog(const char *catalog_host, int catalog_port, const char *proj, struct list *decisions);
00103 
00104 int advertise_pool_decision_to_catalog(const char *catalog_host, int catalog_port, const char *pool_name, const char *decision);
00105 #endif

Generated on Fri Nov 2 15:39:23 2012 for cctools by  doxygen 1.4.7