import worker code
This commit is contained in:
parent
61654a06e8
commit
8831040043
64 changed files with 20853 additions and 1 deletions
104
src/worker/include/xcecd.h
Normal file
104
src/worker/include/xcecd.h
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
#ifndef XCECD_H
|
||||
#define XCECD_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include "xcecd_conf.h"
|
||||
#include "thread_pool.h"
|
||||
#include "controller_connector.h"
|
||||
#include "process_manager.h"
|
||||
#include "system_monitor.h"
|
||||
#include "hardware_monitor.h"
|
||||
#include "resource_sync.h"
|
||||
#include "node_information.h"
|
||||
#include "job_information.h"
|
||||
#include "xcecd_worker_utils.h"
|
||||
#include "xcecd_dbus_manager.h"
|
||||
#include "static_array.h"
|
||||
#include "uv_ipc.h"
|
||||
#include "xcecd_db.h"
|
||||
#include "xcelog.h"
|
||||
#include "xcectx.h"
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <pdh.h>
|
||||
typedef HANDLE process_handle_t;
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
typedef pid_t process_handle_t;
|
||||
#endif
|
||||
|
||||
#define REMOTE_PORT 6789
|
||||
#define DEFAULT_PORT 0 // disable by default
|
||||
#define BUFFER_SIZE 4096
|
||||
#define RESTART_FLAG_FILE "/tmp/.xcecd.restarting"
|
||||
|
||||
typedef struct {
|
||||
int thread_pool_size;
|
||||
int resource_update_interval;
|
||||
int job_status_update_interval;
|
||||
uint16_t port;
|
||||
const char* acct_file;
|
||||
char* log_file;
|
||||
const char* db_path;
|
||||
const char* work_dir;
|
||||
const char* domain_sock_file;
|
||||
const char* remote_host;
|
||||
const char* virutal_name;
|
||||
int remote_port;
|
||||
int join_interval;
|
||||
int update_interval;
|
||||
int domain_sock;
|
||||
int debug_level;
|
||||
} xcecd_config_t;
|
||||
|
||||
typedef struct {
|
||||
thread_pool_t* thread_pool;
|
||||
network_handler_t* network;
|
||||
process_manager_t* process_manager;
|
||||
system_monitor_t* system_monitor;
|
||||
hardware_monitor_t* hardware_monitor;
|
||||
resource_sync_t* resource_sync;
|
||||
xcecd_worker_t* worker_list;
|
||||
xcecd_db_t *db;
|
||||
xce_ctx_t* xce_ctx;
|
||||
bool running;
|
||||
bool normal_restart;
|
||||
char* remote_host;
|
||||
int local_port;
|
||||
int remote_port;
|
||||
int update_interval;
|
||||
int join_interval;
|
||||
int domain_sock;
|
||||
int debug_level;
|
||||
char* work_dir;
|
||||
char* log_dir;
|
||||
char* db_path;
|
||||
char* virtual_name;
|
||||
} xcecd_context_t;
|
||||
|
||||
|
||||
extern xcecd_context_t xcecd_ctx;
|
||||
extern hostattrs_t host_attrs;
|
||||
|
||||
int xcecd_config_init(xcecd_config_t* config);
|
||||
int xcecd_init(const xcecd_config_t* config);
|
||||
int xcecd_start(void);
|
||||
void xcecd_stop(void);
|
||||
void xcecd_cleanup(void);
|
||||
int send_status_and_receive_tasks(void);
|
||||
void xcecd_process_command(void* arg);
|
||||
const char* handle_network_request(const char* request, void* user_data);
|
||||
bool xcecd_config_is_valid(const xcecd_config_t* config);
|
||||
void xcecd_prepare_restart(void);
|
||||
bool xcecd_check_restart_type(void);
|
||||
|
||||
#endif // XCECD_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue