MAOS
Multithreaded Adaptive Optics Simulator
scheduler_client.h File Reference

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_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 (const char *host, 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.

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[]

◆ 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_listen()

int scheduler_listen ( thread_fun  fun)

Started by maos to listen to the sock which connects to the scheduler for commands. It requires a new connection to the scheduler to avoid data racing.

◆ 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 ( const char *  host,
int  argc,
const char *  argv[] 
)

Ask scheduler (maybe in another machine) to launch executable.

◆ scheduler_socket()

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

send a drawing sock to the scheduler for caching or request a sock for drawing

◆ 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