Analysis Manager > Application Procedural Interface (API) > Include File
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Include File
This include file (api.h) must be included in any source file using the Analysis Manager API.
 
#ifndef _AMAPI
#define _AMAPI
 
#ifdef __cplusplus
extern “C” {
#endif
 
#if defined(SGI5)
typedef int socklen_t;
#elif defined(DECA)
typedef size_t socklen_t;
#elif defined(HP700)
# if !defined(_ILP32) && !defined(_LP64)
typedef int socklen_t;
# endif
#elif defined(WINNT)
typedef int socklen_t;
#endif
 
#define RMTMGR_RESV_PORT 1800
#define QUEMGR_RESV_PORT 1900
 
#define GLOBAL_AM_VERSION “2003.0.1”
 
#ifndef AM_INITIALIZE
# define AM_EXTERN extern
#else
# define AM_EXTERN
# if !defined(__LINT__)
# if !defined(__TAG_USED)
# define __TAG_USED
static char *sccsid[] =
{
“@(#) MSC Analysis Manager 2003.0.1”,
“@(#) “
};
# endif /* __TAG_USED */
# endif /* __LINT__ */
#endif
 
#if defined(AM_INITIALIZE)
char *global_auth_msg = NULL;
int __is_checked_out = 0;
#else
extern char *global_auth_msg;
extern int __is_checked_out;
#endif
 
#if defined(AM_INITIALIZE)
int xxx_has_input_deck;
int hks_has_restart;
int has_extra_arg;
#else
extern int xxx_has_input_deck;
extern int hks_has_restart;
extern int has_extra_arg;
#endif
 
#define SOCKET_VERSION1 1
#define SOCKET_VERSION2 1
 
#ifndef PATH_LENGTH
# define PATH_LENGTH 400
#endif
 
#ifndef NAME_LENGTH
# define NAME_LENGTH 256
#endif
 
#ifndef MAX_STR_LEN
# define MAX_STR_LEN 256
#endif
 
#ifndef SOMAXCONN
# define SOMAXCONN 20
#endif
 
#ifdef ULTIMA
#define MSGPOP 1
#else
#ifdef MSGPOP
# undef MSGPOP
#endif
#define MSGPOPnotused 1
#endif
 
#define NOT_JOB_OWNER -201
 
#define UNKNOWN_STATUS -1
#define OK_STATUS 0
#define BAD_STATUS 999
 
#define BLOCK_TIMEOUT 60
#define NONB_TIMEOUT 15
 
#define MAX_EVENT_NUMBER 115
 
#define TOTAL_TO_QM_EVENTS 39
 
/* ---------------------------- */
 
/* all events to QueMgr are first (and sequential) */
 
#define TRANS_CONFIG 1
 
#define XX_QM_PING 39 /* highest to QueMgr message */
#define QM_XX_PING 98
 
#define JM_QM_JOB_FINISHED 2
#define JM_QM_JOB_INIT 3
#define JM_QM_ADD_TASK 4
#define JM_QM_DB_UPDATE 19
#define JM_QM_CLEANUP_JOB 26
 
#define TM_QM_TASK_FINISHED 5
#define TM_QM_TASK_RUNNING 6
#define TM_QM_APP_FILES 25
 
#define PM_QM_REMOVE_JOB 7
#define PM_QM_FULL_LIST 8
#define PM_QM_JOB_LIST 9
#define PM_QM_QUEMGR_LOG 10
#define PM_QM_QUE_STATUS 11
#define PM_QM_JOB_SELECT_LIST 12
#define PM_QM_JOB_COMP_LIST 27
#define PM_QM_JOBNUM_REQ 13
 
#define PM_QM_SUSPEND_JOB 21
#define PM_QM_RESUME_JOB 22
 
#define PM_QM_CPU_LOADS 23
 
#define PM_QM_START_UP_JOBMGR 29
 
#define PA_QM_HALT_QUEMGR 14
#define PA_QM_DRAIN_HALT 15
#define PA_QM_DRAIN_RESTART 16
#define PA_QM_CHECK 17
#define PA_QM_GET_RECFG_TEXT 18
 
#define XX_QM_REQ_VERSION 20
 
/* future XX_QM events (33-38) */
 
#define RM_QM_LOAD_INFO 24
#define RM_QM_CMD_OUT 28
#define RM_XX_PROC_OUT 32
 
#define QM_JM_TASK_FINISHED 40
#define QM_JM_TASK_RUNNING 41
#define QM_JM_KILL_TASK 42
#define QM_JM_ACCEPT_REQUEST 43
 
#define TM_JM_IN_PRE 44
#define TM_JM_RUN_INFO 45
#define TM_JM_IN_POS 46
#define TM_JM_GET_FILES 62
#define TM_JM_PUT_FILES 63
#define TM_JM_CFG_STRUCTS 65
#define TM_JM_DISK_INIT 66
#define TM_JM_LOG_INFO 69
#define TM_JM_PRE_PROG 96
#define TM_JM_POS_PROG 97
 
#define TM_JM_SUSPEND_JOB 77
#define TM_JM_RESUME_JOB 78
 
#define TM_JM_ADD_COMMENT 85
 
#define TM_JM_RM_FILE 86
 
#define TM_JM_RUNNING_FILE 87
 
#define TM_JM_MSG_BUFFERS 95
 
#define TM_PM_GET_FILES 108
 
#define XX_RM_STOP_NOW 74
#define XX_RM_RMT_CMD 81
#define XX_RM_RMT_AM_CMD 99
#define XX_RM_SEND_LOADS 82
#define XX_RM_KILL_PROCESS 83
#define XX_RM_REMOVE_FILE 84
#define XX_RM_REMOVE_AM_FILE 100
#define XX_RM_WRITE_FILE 75
#define XX_RM_PUT_FILE 109
#define XX_RM_PUL_FILE 110
#define XX_RM_PING_ME 111
#define XX_RM_GET_UNAME 112
#define XX_RM_EXIST_FILE 113
#define XX_RM_DIR_WRITEABLE 114
#define XX_RM_CAT_FILE 115
 
#define QM_PM_RET_CODE 47
#define QM_PM_FULL_LISTING 48
#define QM_PM_JOB_LIST 49
#define QM_PM_QUEUE_STATUS 50
#define QM_PM_QUEMGR_LOG 51
#define QM_PM_JOB_SEL_LIST 52
#define QM_PM_SEND_JOBNUM 53
 
#define QM_PM_NEEDS_RECFG 91
#define QM_PM_LOAD_INFO 92
 
#define QM_PM_JOBMGR_START 94
 
#define PM_JM_REQ_JOBMON 54
#define PM_JM_REQ_RUNNING_FILE 88
#define PM_JM_KILL_TRANSFERS 90
#define PM_JM_MSGDEST_REQ 101
#define PM_JM_STATS_REQ 102
#define PM_JM_LOGFILE_REQ 103
#define PM_JM_MON_INIT 104
#define PM_JM_LIST_RUN_FILES 105
#define PM_JM_REQ_RUNNING_FILE2 106
 
#define QM_PA_INFO 67
#define QM_PA_SEND_RECFG_TEXT 68
 
#define JM_PM_LOG_COMMENT 55
#define JM_PM_LOG_INIT_JOB 56
#define JM_PM_LOG_TASK_SUBMIT 57
#define JM_PM_LOG_TASK_RUN 58
#define JM_PM_LOG_TASK_COMPLETE 59
#define JM_PM_LOG_JOB_FINISHED 60
#define JM_PM_TIME_SYNC 61
#define JM_PM_LOG_LINE 70
#define JM_PM_FILE_PRESENT 71
 
#define JM_JM_PRE_FINISHED 72
#define JM_JM_POS_FINISHED 73
 
#define JM_TM_RECV_SETUP 64
#define JM_TM_GIVEME_FILE 89
#define JM_TM_GIVEME_FILE2 107
 
#define QM_XX_REQ_VERSION 76
 
#define QM_TM_SUSPEND_JOB 79
#define QM_TM_RESUME_JOB 80
#define QM_TM_KILL_JOB 93
 
#define MAX_ORGS 28
#define MAX_APPS 30
#define MAX_SUB_APPS 50
#define MAX_GEN_APPS 10
 
#define LOCAL 0
#define NFS 1
 
#define MSC_QUEUE 0
#define LSF_QUEUE 1
#define NQS_QUEUE 2
#define MSC_NASTRAN 1
#define HKS_ABAQUS 2
#define MSC_MARC 3
#define GENERAL 20
 
#define MAX_NUM_FILE_SYS 20
 
#define UNITS_WORDS 0
#define UNITS_64BIT_WORDS 99
#define UNITS_KB 1
#define UNITS_MB 2
#define UNITS_GB 3
 
#define MIN_MEM_REQ 1 /* (mb) */
#define MIN_DISK_REQ 1 /* (mb) */
#define MIN_TIME_REQ 99999 /* (min) */
 
#define JOB_SUBMITTED 0
#define JOB_QUEUED 1
#define JOB_RUNNING 2
 
#define JOB_SUCCESSFUL 0
#define JOB_ABORTED 1
#define JOB_FAILED 2
 
#define FILE_STILL_DOWNLOADING 1
#define FILE_DOWNLOAD_COMPLETE 0
 
/* ---------------------------- */
 
#define IC_CLEAN 0
#define IC_CANT_GET_ADDRESS -100
#define IC_CANT_OPEN_HOST_FILE -101
#define IC_CANT_ALLOC_MEM -102
#define IC_NOT_ENUF_HOSTS -103
#define IC_CANT_OPEN_QUE_FILE -104
#define IC_MISSING_FIELDS -105
#define IC_CANT_FIND_HOST -106
#define IC_ADD_QUE_ERROR -107
#define IC_NOT_ENUF_QUES -108
#define IC_CANT_FIND_QUE -109
#define IC_NO_QUE_TYPE -110
#define IC_UNKNOWN_QUE_TYPE -111
#define IC_NO_QUE_PATH -112
#define IC_CANT_FIND_MACH -113
#define IC_BAD_MAXTSK -114
#define IC_TOO_FEW_QUE_APPS -115
#define IC_BAD_APP_TYPE -116
#define IC_NOT_ENUF_SUB_HOSTS -117
#define IC_BAD_PORT -118
#define IC_NO_ADMIN -119
#define IC_BAD_ADMIN -120
 
#define ID_CLEAN 0
#define ID_CANT_OPEN_DISK_FILE -150
#define ID_CANT_GET_ADDRESS -151
#define ID_CANT_ALLOC_MEM -152
#define ID_CANT_FSTAT -153
#define ID_NOT_ENUF_FSYS -154
#define ID_NOT_ENUF_SUBS -155
#define ID_CANT_FIND_HOST -156
 
#define IU_CLEAN 0
#define IU_CANT_ALLOC_MEM -180
 
#define TIME_SYNC 99
#define LOG_COMMENT 100
#define LOG_INIT_JOB 101
#define LOG_TASK_SUBMIT 102
#define LOG_TASK_RUN 103
#define LOG_TASK_COMPLETE 104
#define LOG_JOB_FINISHED 105
#define LOG_DISK_INIT 106
#define LOG_DISK_UPDATE 107
#define LOG_CPU_UPDATE 108
#define LOG_DISK_SUMMARY 109
#define LOG_DISK_FS_SUMMARY 110
#define LOG_CPU_SUMMARY 111
#define LOG_LOGLINE 112
#define LOG_FILE_PRESENT 113
#define LOG_TASK_SUSPEND 114
#define LOG_TASK_RESUME 115
#define LOG_RUNNING_FILE 116
#define LOG_RUNNING_DONE 117
#define LOG_MEM_UPDATE 118
#define LOG_MEM_SUMMARY 119
 
/* ---------------------------- */
 
typedef struct{
char file_sys_name[PATH_LENGTH];
int disk_used_pct;
int disk_max_size_mb;
}JOB_FS_LIST;
 
typedef struct{
char filename[PATH_LENGTH];
int sizekb;
}FILE_LIST;
 
typedef struct{
char org_name[NAME_LENGTH];
char org_name2[NAME_LENGTH];
char host_name[NAME_LENGTH];
unsigned int addr;
int port;
}ORG;
 
typedef struct{
char prog_name[NAME_LENGTH];
char app_name[NAME_LENGTH];
int maxapptsk;
char args[PATH_LENGTH];
char extension[24];
}PROGS;
 
typedef struct{
char pseudohost_name[NAME_LENGTH];
char host_name[NAME_LENGTH];
char exepath[PATH_LENGTH];
char rcpath[PATH_LENGTH];
int glob_index;
int sub_index;
int maxapptsk;
char arch[NAME_LENGTH];
unsigned int address;
}HSTS;
 
typedef struct{
int num_hosts;
HSTS *hosts;
}HOST;
 
typedef struct{
char pseudohost_name[NAME_LENGTH];
char exepath[PATH_LENGTH];
char rcpath[PATH_LENGTH];
int maxapptsk;
int type;
}APPS;
 
typedef struct{
char host_name[NAME_LENGTH];
int num_subapps;
APPS subapp[MAX_SUB_APPS];
int maxtsk;
char arch[NAME_LENGTH];
unsigned int address;
}TOT_HST;
 
typedef struct{
char queue_name1[NAME_LENGTH];
char queue_name2[NAME_LENGTH];
int glob_index;
}QUES;
 
typedef struct{
int num_queues;
QUES *queues;
}QUEUE;
 
typedef struct{
char queue_name1[NAME_LENGTH];
char queue_name2[NAME_LENGTH];
HOST sub_host[MAX_APPS];
}TOT_QUE;
 
typedef struct{
char file_sys_name[NAME_LENGTH];
int model;
int max_size;
int cur_free;
}FILES;
 
typedef struct{
char pseudohost_name[NAME_LENGTH];
int num_fsystems;
FILES *sub_fsystems;
}TOT_FSYS;
 
typedef struct{
char sepuser_name[NAME_LENGTH];
}SEP_USER;
 
/* ---------------------------- */
 
typedef struct{
 
int QUE_TYPE;
 
char ADMIN[128];
 
int NUM_APPS;
 
int config_file_version;
 
unsigned int timestamp;
 
char prog_version[32];
 
/* prog names */
 
PROGS progs[MAX_APPS];
 
/* host stuff */
 
HOST hsts[MAX_APPS];
 
int total_h;
TOT_HST *total_h_list;
 
/* que stuff */
 
char que_install_path[PATH_LENGTH];
 
char que_options[PATH_LENGTH];
 
int min_mem_value;
int min_disk_value;
int min_time_value;
 
QUEUE ques[MAX_APPS];
 
int total_q;
TOT_QUE *total_q_list;
 
/* file stuff */
 
int total_f;
TOT_FSYS *total_f_list;
 
/* separate user stuff */
 
int total_u;
SEP_USER *total_u_list;
 
int qmgr_port;
int rmgr_port;
char qmgr_host[256];
 
}CONFIG;
 
/************************************************************************/
/* Defines for setting the different values of the config structure */
/************************************************************************/
#define CONFIG_VERSION 1
 
#define NO_JOB_MON 0
#define START_JOB_MON 1
 
#define SUBMIT_NOW 0
#define SUBMIT_DELAY 1
#define SUBMIT_SPECIFIC 2
 
#define SUNDAY 0
#define MONDAY 1
#define TUESDAY 2
#define WEDNESDAY 3
#define THURSDAY 4
#define FRIDAY 5
#define SATURDAY 6
 
#define MAIL_OFF 0
#define MAIL_ON 1
 
#define UI_MGR_MAIL 0
#define MASTER_MAIL 1
 
#define MAX_PROJ_LENGTH 16
 
typedef struct{
#ifndef CRAY
int pad1;
#endif
int version;
#ifndef CRAY
int pad2;
#endif
int job_mon_flag;
#ifndef CRAY
int pad3;
#endif
int time_type;
#ifndef CRAY
int pad4;
#endif
int delay_hour;
#ifndef CRAY
int pad5;
#endif
int delay_min;
#ifndef CRAY
int pad6;
#endif
int specific_hour;
#ifndef CRAY
int pad7;
#endif
int specific_min;
#ifndef CRAY
int pad8;
#endif
int specific_day;
#ifndef CRAY
int pad9;
#endif
int mail_on_off;
#ifndef CRAY
int pad10;
#endif
int bogus;
#ifndef CRAY
int pad11;
#endif
int mon_file_flag;
#ifndef CRAY
int pad12;
#endif
int copy_link_flag;
#ifndef CRAY
int pad13;
#endif
int job_max_time;
#ifndef CRAY
int pad14;
#endif
int bogus1;
char project_name[128];
char orig_pre_prog[256];
char orig_pos_prog[256];
char exec_pre_prog[256];
char exec_pos_prog[256];
char separate_user[128];
char p3db_file[256];
char email_addr[256];
} Universal_Config_Info;
 
/* ---------------------------- */
 
typedef struct {
char host_name[128];
int num_running;
int num_waiting;
int maxtsk;
char stat_str[64];
}Que_List;
 
typedef struct {
char msg[2048];
}Msg_List;
 
typedef struct {
int job_number;
char job_name[128];
char job_user[128];
char job_submit_host[128];
char am_host_name[128];
char job_proj[128];
char work_dir[256];
int application;
int port_number;
char job_run_host[128];
char sub_time_str[128];
int jobstatus;
}Job_List;
 
typedef struct {
char host_name[128];
int cpu_util;
int free_disk;
int avail_mem;
int status;
}Cpu_List;
 
/************************************************************************/
/* */
/* MSC.Nastran specific configuration structures. */
/* */
/************************************************************************/
 
#define DEFAULT_BUFFSIZE 8193
 
/*
** mck 6/12/98 - change to 0, so they dont get added unless you type something ...
**
#define CONFIG_DEFAULT_SMEM ( (DEFAULT_BUFFSIZE-1) * 100 )
#define CONFIG_DEFAULT_MEM 8000000
*/
 
#define CONFIG_DEFAULT_SMEM 0
#define CONFIG_DEFAULT_MEM 0
 
#define NAS_NONE 0
 
#define NO 0
#define YES 1
 
#define SINGLE 1
#define MULTI 2
 
#define DB_GET_NO_FILES 500
#define DB_GET_MST_P3_FILE 600
#define DB_GET_ALL_P3_FILES 650
#define DB_GET_MST_MK_FILE 700
#define DB_GET_ALL_MK_FILES 750
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int host_index; /* Global Host Index. */
#ifndef CRAY
int pad2;
#endif
float mem; /* stored as whatever. */
#ifndef CRAY
int pad3;
#endif
float smem; /* stored as whatever. */
#ifndef CRAY
int pad4;
#endif
int num_cpus; /* Number cpu’s on machine. */
 
char host_name[128]; /* Real Host Name (host_name) */
char mem_str[64];
char smem_str[64];
} Nas_Config_Host;
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int application_type; /* Should be set to MSC_NASTRAN */
#ifndef CRAY
int pad2;
#endif
int default_index; /* Index just within Nas List */
#ifndef CRAY
int pad3;
#endif
int disk_master; /* stored as KB. */
#ifndef CRAY
int pad4;
#endif
int disk_dball; /* stored as KB. */
#ifndef CRAY
int pad5;
#endif
int disk_scratch; /* stored as KB. */
#ifndef CRAY
int pad6;
#endif
int disk_units; /* see defines below */
#ifndef CRAY
int pad7;
#endif
int scr_run_flag;
#ifndef CRAY
int pad8;
#endif
int save_db_flag;
#ifndef CRAY
int pad9;
#endif
int copy_db_flag;
#ifndef CRAY
int pad10;
#endif
float mem_req; /* stored as whatever */
#ifndef CRAY
int pad11;
#endif
int mem_units;
#ifndef CRAY
int pad12;
#endif
int smem_units;
#ifndef CRAY
int pad13;
#endif
int num_hosts;
#ifndef CRAY
int pad14;
#endif
int bogus;
char default_host[128]; /* uihost_name is saved here */
char default_queue[128]; /* queue_name1 is saved here */
char mem_req_str[64];
char extra_arg[256];
Nas_Config_Host *host_ptr;
} Nas_Configure_Info;
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int submit_index; /* Index just within Nas List */
#ifndef CRAY
int pad2;
#endif
int specific_index; /* see descrip below. */
#ifndef CRAY
int pad3;
#endif
int restart_type;
#ifndef CRAY
int pad4;
#endif
int restart;
#ifndef CRAY
int pad5;
#endif
int modfms;
#ifndef CRAY
int pad6;
#endif
int bogus;
char nas_input_deck[256]; /* full path and filename */
char cold_jobname[256]; /* coldstart jobname */
} Nas_Submit_Info;
 
/* The “specific_index” variable is only used when the queuing type is */
/* not MSC_QUEUE (i.e. it is LSF). If it is -1 then that means the */
/* task can be submitted to any host in the defined queue. If the */
/* “specific_index” has a value other than -1, then this is a index into*/
/* the host list (host list for the application, not global index) */
/* of the specific host the task should be submited to. */
 
/************************************************************************/
/* */
/* ABAQUS specific configuration structures. */
/* */
/************************************************************************/
 
/* Following default values are in words (64bit). */
 
/*
** mck - 6/12/98 change to 0 so they dont get added unless you type something ...
**
#define DEFAULT_PRE_BUF 400000
#define DEFAULT_PRE_MEM 1000000
#define DEFAULT_MAIN_BUF 2000000
#define DEFAULT_MAIN_MEM 6000000
*/
 
#define DEFAULT_PRE_BUF 0
#define DEFAULT_PRE_MEM 0
#define DEFAULT_MAIN_BUF 0
#define DEFAULT_MAIN_MEM 0
 
#define ABA_NONE 0
#define ABA_RESTART 1
#define ABA_CHECK 2
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int host_index; /* Global Host Index. */
#ifndef CRAY
int pad2;
#endif
int num_cpus; /* Number cpu’s on machine. */
#ifndef CRAY
int pad3;
#endif
float pre_buf; /* stored as whatever. */
#ifndef CRAY
int pad4;
#endif
float pre_mem; /* stored as whatever. */
#ifndef CRAY
int pad5;
#endif
float main_buf; /* stored as whatever. */
#ifndef CRAY
int pad6;
#endif
float main_mem; /* stored as whatever. */
char pre_buf_str[64];
char pre_mem_str[64];
char main_buf_str[64];
char main_mem_str[64];
char host_name[128]; /* Real Host Name (host_name) */
} Aba_Config_Host;
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int application_type; /* Should be set to HKS_ABAQUS */
#ifndef CRAY
int pad2;
#endif
int default_index; /* Index just within Aba List */
#ifndef CRAY
int pad3;
#endif
int copy_res_file;
#ifndef CRAY
int pad4;
#endif
int save_res_file;
#ifndef CRAY
int pad5;
#endif
float mem_req; /* stored as whatever */
#ifndef CRAY
int pad6;
#endif
int mem_units; /* One of the defines above */
#ifndef CRAY
int pad7;
#endif
int disk_units; /* One of the defines above */
#ifndef CRAY
int pad8;
#endif
int space_req; /* stored as KB. */
#ifndef CRAY
int pad9;
#endif
int append_fil; /* 0 = no 1 = yes */
#ifndef CRAY
int pad10;
#endif
int num_hosts;
#ifndef CRAY
int pad11;
#endif
int use_standard; /* 0 = no 1 = yes */
char default_host[128]; /* uihost_name is saved here */
char default_queue[128]; /* queue_name1 is saved here */
char user_sub[128];
char mem_req_str[64];
char extra_arg[256];
Aba_Config_Host *host_ptr;
} Aba_Configure_Info;
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int submit_index; /* Index just within Aba list */
#ifndef CRAY
int pad2;
#endif
int specific_index; /* see description below */
#ifndef CRAY
int pad3;
#endif
int restart;
#ifndef CRAY
int pad4;
#endif
int bogus;
char aba_input_deck[256]; /* full path and filename */
char restart_file[256];
} Aba_Submit_Info;
 
/* The “specific_index” variable is only used when the queuing type is */
/* not P3_QUEUE (i.e. it is LSF). If it is -1 then that means the */
/* task can be submitted to any host in the defined queue. If the */
/* “specific_index” has a value other than -1, then this is a index into*/
/* the host list (host list for the application, not global index) */
/* of the specific host the task should be submited to. */
 
/************************************************************************/
/* */
/* MSC.Marc specific configuration structures. */
/* */
/************************************************************************/
 
#define MAR_NONE 0
#define MAR_RESTART 1
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int host_index; /* Global Host Index. */
#ifndef CRAY
int pad2;
#endif
int num_cpus; /* Number cpu’s on machine. */
#ifndef CRAY
int pad3;
#endif
int bogus;
char host_name[128]; /* Real Host Name (host_name) */
} Mar_Config_Host;
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int application_type; /* Should be set to MSC_MARC */
#ifndef CRAY
int pad2;
#endif
int default_index; /* Index just within Mar List */
#ifndef CRAY
int pad3;
#endif
int disk_units; /* One of the defines above */
#ifndef CRAY
int pad4;
#endif
int space_req; /* stored as KB. */
#ifndef CRAY
int pad5;
#endif
int mem_units; /* One of the defines above */
#ifndef CRAY
int pad6;
#endif
float mem_req; /* stored as whatever */
#ifndef CRAY
int pad7;
#endif
int num_hosts;
#ifndef CRAY
int pad8;
#endif
int translate_input;
char default_host[128]; /* uihost_name is saved here */
char default_queue[128]; /* queue_name1 is saved here */
char cmd_line[256]; /* command line to run with */
char mon_file[256]; /* log file to monitor */
char mem_req_str[64];
Mar_Config_Host *host_ptr;
} Mar_Configure_Info;
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int submit_index; /* Index just within Mar list */
#ifndef CRAY
int pad2;
#endif
int rid; /* Flag: restart file (-rid filename) */
#ifndef CRAY
int pad3;
#endif
int pid; /* Flag: post_name (-pid filename) */
#ifndef CRAY
int pad4;
#endif
int prog; /* Flag: program_name (-prog progname) */
#ifndef CRAY
int pad5;
#endif
int user; /* Flag: user_subroutine_name (-user subname)*/
#ifndef CRAY
int pad6;
#endif
int save; /* Flag: save executable (0/1) (-save yes/no) */
#ifndef CRAY
int pad7;
#endif
int vf; /* Flag: viewfactor file (-vf vfname) */
#ifndef CRAY
int pad8;
#endif
int nprocd; /* Number processes or domains (-nprocd #) */
#ifndef CRAY
int pad9;
#endif
int host; /* Flag: hostfile (-host hostfilename) */
#ifndef CRAY
int pad10;
#endif
int iam; /* Flag: iam flag for licensing (-iam iamtag) */
#ifndef CRAY
int pad11;
#endif
int specific_index; /* see description below */
/* All files should have full path and filename */
char datfile_name[256]; /* input deck */
char restart_name[256]; /* restart file */
char post_name[256]; /* post file */
char program_name[256]; /* program file */
char user_subroutine_name[256]; /* user subroutine file */
char viewfactor[256]; /* viewfactor file */
char hostfile[256]; /* hostfile */
char iamval[256]; /* iam licensing tag - no file involved */
} Mar_Submit_Info;
 
/* The “specific_index” variable is only used when the queuing type is */
/* not P3_QUEUE (i.e. it is LSF). If it is -1 then that means the */
/* task can be submitted to any host in the defined queue. If the */
/* “specific_index” has a value other than -1, then this is a index into*/
/* the host list (host list for the application, not global index) */
/* of the specific host the task should be submited to. */
 
 
/************************************************************************/
/* */
/* GENERAL specific configuration structures. */
/* */
/************************************************************************/
typedef struct {
#ifndef CRAY
int pad1;
#endif
int host_index; /* Global Host Index. */
#ifndef CRAY
int pad2;
#endif
int bogus;
char host_name[128]; /* Real Host Name (host_name) */
} Gen_Config_Host;
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int application_type; /* Should be set to GEN - RANGE */
#ifndef CRAY
int pad2;
#endif
int default_index; /* Index just within Gen List */
#ifndef CRAY
int pad3;
#endif
int disk_units; /* One of the defines above */
#ifndef CRAY
int pad4;
#endif
int space_req; /* stored as KB. */
#ifndef CRAY
int pad5;
#endif
int mem_units; /* One of the defines above */
#ifndef CRAY
int pad6;
#endif
float mem_req; /* stored as whatever */
#ifndef CRAY
int pad7;
#endif
int num_hosts;
#ifndef CRAY
int pad8;
#endif
int translate_input;
char default_host[128]; /* uihost_name is saved here */
char default_queue[128]; /* queue_name1 is saved here */
char cmd_line[256]; /* command line to run with */
char mon_file[256]; /* log file to monitor */
char mem_req_str[64];
Gen_Config_Host *host_ptr;
} Gen_Configure_Info;
 
typedef struct {
#ifndef CRAY
int pad1;
#endif
int submit_index; /* Index just within Gen list */
#ifndef CRAY
int pad2;
#endif
int specific_index; /* see description below */
char gen_input_deck[256]; /* full path and filename */
} Gen_Submit_Info;
 
/* The “specific_index” variable is only used when the queuing type is */
/* not MSC_QUEUE (i.e. it is LSF). If it is -1 then that means the */
/* task can be submitted to any host in the defined queue. If the */
/* “specific_index” has a value other than -1, then this is a index into*/
/* the host list (host list for the application, not global index) */
/* of the specific host the task should be submited to. */
 
/* ---------------------------- */
 
/*
** api globals ...
*/
 
#ifdef AM_INITIALIZE
AM_EXTERN int gbl_nwrk_timeout_secs = BLOCK_TIMEOUT;
AM_EXTERN int api_use_this_host = 0;
#else
AM_EXTERN int gbl_nwrk_timeout_secs;
AM_EXTERN int api_use_this_host;
#endif
AM_EXTERN CONFIG *cfg;
AM_EXTERN ORG *org;
AM_EXTERN int num_orgs;
AM_EXTERN Universal_Config_Info ui_config;
AM_EXTERN Nas_Configure_Info nas_config;
AM_EXTERN Nas_Submit_Info nas_submit;
AM_EXTERN Aba_Configure_Info aba_config;
AM_EXTERN Aba_Submit_Info aba_submit;
AM_EXTERN Mar_Configure_Info mar_config;
AM_EXTERN Mar_Submit_Info mar_submit;
AM_EXTERN Gen_Configure_Info gen_config[MAX_GEN_APPS];
AM_EXTERN Gen_Submit_Info gen_submit[MAX_GEN_APPS];
AM_EXTERN char api_this_host[256];
AM_EXTERN char api_user_name[256];
AM_EXTERN char api_application_name[64];
AM_EXTERN int api_application_index;
 
/*
* api functions ...
*/
 
/*
* init - MUST BE FIRST api_* call made by application ...
*/
extern int api_init(char *out_str);
 
/*
* just to set the global timeout for communication ...
*/
extern int api_get_gbl_timeout();
extern int api_set_gbl_timeout(int secs);
 
/*
* reads an org.cfg file if possible and builds the ORG struct for list of QueMgrs ...
*/
extern ORG *api_read_orgs(char *dir,int *num_orgs,int *status);
 
/*
* contacts running QueMgr and builds cfg struct ...
*/
extern CONFIG *api_get_config(char *qmgr_host,int qmgr_port,int *status,char *out_str);
 
/*
* reads *.cfg files and builds cfg struct (No QueMgr process involved) ...
*/
extern CONFIG *api_read_config(CONFIG *cfg,char *path,char *orgname,int *status,char *out_str);
/*
* reads *.cfg files (without building path) and builds cfg struct (No QueMgr process involved) ...
*/
extern CONFIG *api_read_config_fullpath(CONFIG *cfg,char *path,int *status,char *out_str);
/*
* writes *.cfg files from cfg struct (No QueMgr process involved) ...
*/
extern void api_write_config(CONFIG *cfg,char *path,char *orgname,int *stauts,char *out_str);
 
/*
* tries to contact running QueMgr and check if timestamp is ok ...
* returns 0 if all ok ...
*/
extern int api_ping_quemgr(char *qmgr_host,int qmgr_port,unsigned int timestamp,char *out_str);
 
/*
* initializes UI config structs (nas, aba, gen[] subimt and config) ...
*/
extern void api_init_uiconfig(CONFIG *cfg);
 
/*
* gets logged in user name
*/
extern char *api_getlogin(void);
 
/*
* checks on job data deck and returns possible question for UI to ask, setting answer for
* submit call below ...
*/
extern int api_check_job(char *ques_text,char *ans1_text,char *ans2_text,char *out_str);
 
/*
* submits job (needs filled in UI config and submit structs as well as global cfg struct) ...
*/
extern int api_submit_job(char *qmgr_host,int qmgr_port,char *jobname,int background,int *job_number,char *base_path,int *jmgr_port,int answer,char *out_str);
 
/*
* gets list of all running jobs from QueMgr ...
*/
extern Job_List *api_get_runningjob_list(char *qmgr_host,int qmgr_port,int *job_count,char *out_str);
 
/*
* gets initial socket for later on api_mon_job_* calls ...
*/
extern int api_mon_job_init(char *job_host,int job_port,int *msg_port,char *out_str);
 
/*
* gets all messages of sev level and lower from JobMgr ...
*/
extern Msg_List *api_mon_job_msgs(int msg_sock,char *ui_host,int msg_port,int sev_level,
int *num_msgs,char *out_str);
 
/*
* gets current job statistics and run status ...
*/
extern JOB_FS_LIST *api_mon_job_stats(int msg_sock,char *ui_host,int msg_port,
int *cpu,int *pct_cpu,
int *mem, int *pct_mem,
int *dsk,int *pct_dsk,
int *elapsed,int *status,
int *num_fs,int *retcod,
char *out_str);
 
/*
* gets last 100 lines of job mon file ...
*/
extern char *api_mon_job_mon(int msg_sock,char *ui_host,int msg_port,char *out_str);
 
/*
* returns list of files active while job is running ...
*/
extern FILE_LIST *api_mon_job_running_files_list(int msg_sock,char *ui_host,int msg_port,
int *num_files,char *out_str);
 
 
/*
** returns general info about a job from a mon_file ...
*/
extern Job_List *api_com_job_gen(char *sub_host,char *mon_file,char *out_str);
 
/*
* gets job statistics and run status from mon file
*/
extern JOB_FS_LIST *api_com_job_stats(char *sub_host,char *mon_file,
int *cpu,int *pct_cpu_avg,int *pct_cpu_max,
int *mem,int *pct_mem_avg,int *pct_mem_max,
int *dsk,int *pct_dsk_avg,int *pct_dsk_max,
int *elapsed,int *status,
int *num_fs,int *retcod,
char *out_str);
 
/*
* gets last 100 lines of job mon file ...
*/
extern char *api_com_job_mon(char *sub_host,char *mon_file,char *out_str);
 
/*
* returns list of files from mon file ...
*/
extern FILE_LIST *api_com_job_received_files_list(char *sub_host,char *mon_file,int *num_files,char *out_str);
 
/*
* starts file download ...
*/
extern int api_download_file_start(int msg_sock,int job_number,char *filename,char *out_str);
 
/*
* checks on donwload file status ...
*/
extern int api_download_file_check(int job_number,char *filename,int *filesizekb);
 
/*
* returns all jobs for all hosts and apps from a running QueMgr ...
*/
extern Que_List *api_mon_que_full(char *qmgr_host,int qmgr_port,int *num_tsks,char *out_str);
 
/*
* gets last 4k bytes of QueMgr log file ...
*/
extern char *api_mon_que_log(char *qmgr_host,int qmgr_port,char *out_str);
 
/*
* gets all hosts statistics ...
*/
extern Cpu_List *api_mon_que_cpu(char *qmgr_host,int qmgr_port,char *out_str);
 
/*
* gets list of last 25 or so completed jobs from QueMgr ...
*/
extern Job_List *api_get_completedjob_list(char *qmgr_host,int qmgr_port,int *job_count,char *out_str);
 
/*
* abort job ...
*/
extern int api_abort_job(char *qmgr_host,int qmgr_port,int job_number,char *job_user,char *out_str);
 
/*
* reads rc file and overrides all UI settings found ..
*/
extern int api_rcfile_read(char *rcfile,char *out_str);
 
/*
* writes rc file from UI settigns ...
*/
extern int api_rcfile_write( char *rcfile,char *out_str);
extern int api_rcfile_write2(FILE *stream,int short_or_long);
 
/*
* prints UI settings in rc format to screen (0 is short, != 0 is full display) ...
*/
extern void api_rcfile_print(int fullprint);
 
/*
* calls admin test procedure(s) and returns status and msgs ...
*/
extern char *api_admin_test(char *orgpth,char *orgnam,int rport,int *status,char *out_str);
 
/*
* just to get home dir ...
*/
extern void api_get_home_dir(char *home_dir);
 
/*
* to reconfig quemgr ...
*/
extern char *api_reconfig_quemgr(char *qmgr_host,int quemgr_port,int *status,char *out_str);
 
/*
* license checkout and return ...
*/
extern int api_checkout_license(char *license_file);
extern void api_release_license(void);
 
#ifdef __cplusplus
}
#endif
 
#endif /* _AMAPI */