MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
scheduler_client.h File Reference

Data Structures

struct  status_t
 

Macros

#define scheduler_version   53
 

Enumerations

enum  {
  CMD_START =1 , CMD_FINISH , CMD_STATUS , CMD_CRASH ,
  CMD_MONITOR , CMD_PATH , CMD_KILL , CMD_TRACE ,
  CMD_PROBE , CMD_DRAWCLI , CMD_REMOVE , CMD_DRAWSER ,
  CMD_MAOSCLI , CMD_MAOSSER , CMD_RESTART , CMD_KILLED ,
  CMD_DUMMY , CMD_LAUNCH
}
 
enum  {
  MAOS_SERVER =1 , MAOS_DRAW =10 , MAOS_VAR =20 , MAOS_PAUSE ,
  MAOS_ASSIGN_WFS =100 , MAOS_ASSIGN_EVL , MAOS_ASSIGN_RECON , MAOS_ASSIGN_DONE =199
}
 
enum  {
  MON_CMD =1 , MON_DRAWDAEMON =2 , MON_STATUS =3 , MON_PATH =6 ,
  MON_CLEARJOB =7 , MON_KILLJOB =8 , MON_SAVEJOB =9 , MON_VERSION =13 ,
  MON_LOAD =14 , MON_ADDHOST =17
}
 
enum  {
  S_RUNNING =1 , S_WAIT , S_START , S_QUEUED ,
  S_UNKNOWN , S_FINISH =11 , S_CRASH , S_TOKILL ,
  S_REMOVE , S_KILLED , S_NONEXIST
}
 
enum  {
  DRAW_START =0 , DRAW_DATA , DRAW_HEARTBEAT , DRAW_POINTS ,
  DRAW_STYLE , DRAW_CIRCLE , DRAW_LIMIT , DRAW_FIG ,
  DRAW_NAME , DRAW_TITLE , DRAW_XLABEL , DRAW_YLABEL ,
  DRAW_ZLIM , DRAW_LEGEND , DRAW_XYLOG , DRAW_FIGFN ,
  DRAW_PAUSE , DRAW_RESUME , DRAW_FINAL , DRAW_FLOAT ,
  DRAW_FRAME , DRAW_SINGLE , DRAW_UDPPORT , DRAW_INIT ,
  DRAW_PID , DRAW_ZLOG , DRAW_PATH , DRAW_EXENAME ,
  DRAW_END =100 , DRAW_ENTRY =9999
}
 
enum  { DRAW_ID_MAOS =1 , DRAW_ID_RES , DRAW_ID_BIN , DRAW_ID_TOT }
 

Functions

void parse_host (const char *line)
 
void free_hosts ()
 
void init_hosts ()
 
const char * lookup_hostaddr (const char *hostname)
 
const char * lookup_hostname (const char *hostaddr)
 
int scheduler_connect (const char *hostname)
 
int scheduler_connect_self (int block)
 
pthread_t scheduler_listen (thread_fun fun)
 
void scheduler_report_path (const char *path)
 
void scheduler_start (int nthread, int ngpu, int waiting)
 
void scheduler_finish (int status)
 
void scheduler_report (status_t *status)
 
int scheduler_launch_exe (char *hostarr, int argc, const char *argv[])
 
int scheduler_socket (int dir, int *sfd, int id)
 
int call_addr2line (char *ans, int nans, const char *cmd)
 
int print_backtrace_symbol (void *const *buffer, int size)
 
void print_backtrace ()
 

Detailed Description

Contains routines that will be used to talk to the scheduler.


Data Structure Documentation

◆ status_t

struct status_t

Status about each process. Timing, wavefront error, etc.

+ Collaboration diagram for status_t:
Data Fields
double wfs
double recon
double other
double eval
double tot
double scale
double mean
long rest
long laps
int iseed
int nseed
int nthread
int isim
int simstart
int simend
char done
char warning
char unused1
char unused2
double clerrlo
double clerrhi
int info
time_t timstart
time_t timlast

Function Documentation

◆ parse_host()

void parse_host ( const char *  line)

Parse and add host info to hosts[] and hostaddr[]. hosts contains the shortcut name, without dot and hostaddr contains the FQDN and optionally the port

Parameters
linecontains hostname[=hostaddr:port]

◆ free_hosts()

void free_hosts ( )

free hosts[] and hostsaddr[]

◆ init_hosts()

void init_hosts ( )

Initialize hosts and associate an id number

◆ lookup_hostaddr()

const char * lookup_hostaddr ( const char *  hostname)

Translate hostname to address based on ~/.aos/hosts

◆ lookup_hostname()

const char * lookup_hostname ( const char *  hostaddr)

Translate address to hostname based on ~/.aos/hosts

◆ scheduler_connect_self()

int scheduler_connect_self ( int  block)

To open a port and connect to scheduler in the local host

◆ scheduler_listen()

pthread_t scheduler_listen ( thread_fun  fun)

Started by maos to listen to the sock which connects to the scheduler for commands. It reuses existing connection.

◆ scheduler_start()

void scheduler_start ( int  nthread,
int  ngpu,
int  waiting 
)

Called by maos to report a job start to scheduler and wait for signal before proceeding if waiting is set.

◆ scheduler_finish()

void scheduler_finish ( int  status)

Called by maos to notify scheduler the completion of a job

◆ scheduler_report()

void scheduler_report ( status_t status)

called by sim.c to report job status. Do not try to reconnect.

◆ scheduler_launch_exe()

int scheduler_launch_exe ( char *  hostarr,
int  argc,
const char *  argv[] 
)

Ask scheduler (maybe in another machine) to launch executable. Host may be null or contain coma separated hosts returns <0 for error. >=0 success

◆ scheduler_socket()

int scheduler_socket ( int  dir,
int *  sfd,
int  id 
)

send a drawing sock to the scheduler for caching (dir=1) or request a sock for drawing (dir=-1). id should be between 1 and 9999.

◆ call_addr2line()

int call_addr2line ( char *  ans,
int  nans,
const char *  cmdstr 
)

Execute addr2line as specified in buf, combine the answer, and return the string.

◆ print_backtrace_symbol()

int print_backtrace_symbol ( void *const buffer,
int  size 
)

Convert backtrace address to source line. Do not call routines that may call malloc as the mutex in malloc may already be locked. return 0 if success otherwise -1