IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34783


Ignore:
Timestamp:
Dec 10, 2012, 12:07:22 PM (14 years ago)
Author:
Serge CHASTEL
Message:

Pantasks/Condor branch

Location:
branches/sc_branches/pantasks_condor
Files:
9 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/sc_branches/pantasks_condor

  • branches/sc_branches/pantasks_condor/include/pantasks.h

    r32632 r34783  
    1111typedef enum {
    1212  JOB_NONE,
    13   JOB_BUSY, 
    14   JOB_EXIT, 
     13  JOB_BUSY,
     14  JOB_EXIT,
    1515  JOB_HUNG,
    1616  JOB_CRASH,
     
    1919
    2020typedef enum {
    21   JOB_LOCAL, 
    22   JOB_CONTROLLER, 
     21  JOB_LOCAL,
     22  JOB_CONTROLLER,
    2323} JobMode;
    2424
     
    3232enum {TIMER_ALLJOBS, TIMER_SUCCESS, TIMER_FAILURE};
    3333
    34 enum {TASK_NONE, 
    35       TASK_EMPTY, 
    36       TASK_COMMENT, 
    37       TASK_NMAX, 
    38       TASK_ACTIVE, 
    39       TASK_TRANGE, 
    40       TASK_END, 
    41       TASK_HOST, 
    42       TASK_NICE, 
    43       TASK_STDOUT, 
    44       TASK_STDERR, 
    45       TASK_COMMAND, 
    46       TASK_OPTIONS, 
    47       TASK_PERIODS, 
    48       TASK_NPENDING, 
    49       TASK_EXIT, 
     34enum {TASK_NONE,
     35      TASK_EMPTY,
     36      TASK_COMMENT,
     37      TASK_NMAX,
     38      TASK_ACTIVE,
     39      TASK_TRANGE,
     40      TASK_END,
     41      TASK_HOST,
     42      TASK_NICE,
     43      TASK_STDOUT,
     44      TASK_STDERR,
     45      TASK_COMMAND,
     46      TASK_OPTIONS,
     47      TASK_PERIODS,
     48      TASK_NPENDING,
     49      TASK_EXIT,
    5050      TASK_EXEC
    5151} TaskHashResults;
     
    6868/* a task is a description of the wrapping of a job */
    6969typedef struct {
    70   Macro  *exec;                         /* name is 'exec' */
    71   Macro  *crash;                        /* name is 'crash' */
     70  Macro  *exec;                         /* name is 'exec' */
     71  Macro  *crash;                        /* name is 'crash' */
    7272  Macro  *timeout;
    7373  Macro  *defexit;
     
    7575  int     NEXIT;
    7676  int     Nexit;
    77   Macro **exit;                         /* name is exit status */
     77  Macro **exit;                         /* name is exit status */
    7878
    7979  int     argc;
     
    120120} Task;
    121121
    122 // time period include/exclude periods: 
    123 // date ranges (e_time - e_time) 
     122// time period include/exclude periods:
     123// date ranges (e_time - e_time)
    124124// time ranges (e_time - e_time) (use e_time % 86400)
    125125// time-of-week ranges  (e_time - e_time
     
    131131// keep: TRUE: perform action within this time period
    132132// keep: FALSE: do not perform action within this time period
    133  
     133
    134134typedef struct {
    135   int JobID;                            /* internal ID for job */
    136   int pid;                              /* external ID for job */
     135  int JobID;                            /* internal ID for job */
     136  int pid;                              /* external ID for job */
    137137
    138138  struct timeval last;
     
    160160  int         stderr_fd;      /* stderr pipe (local only) */
    161161
    162   JobMode     mode;                     /* local or controller? */
     162  JobMode     mode;                     /* local or controller? */
    163163  int     priority;
    164164  char   *realhost;
     
    302302
    303303int FlushJobs (void);
     304
     305#ifdef IPP_CONDOR
     306char* get_hosts_requirement(void);
     307char *get_host_status(char* hostname);
     308#endif
  • branches/sc_branches/pantasks_condor/pantasks/ControllerOps.c

    r34088 r34783  
    99static IOBuffer stdout_buffer;
    1010static IOBuffer stderr_buffer;
     11#ifndef IPP_CONDOR
    1112static int ControllerPID = 0;
     13#else
     14#include "ipp_condor.h"
     15#include <condor/condor.nsmap>
     16#include <shell.h>
     17static struct soap soap;
     18#endif
    1219
    1320/* local static variables to track the controller host properties */
     
    1825static int NHOSTS = 0;
    1926
     27#ifdef IPP_CONDOR
     28#include "ipp_condor.h"
     29static int hosts_list_modified = TRUE;
     30static char* hosts_requirement = NULL;
     31static int is_host_in_list(char *hostname);
     32#endif
     33
    2034int AddHost (char *hostname, int max_threads) {
    21 
    2235  int N;
    23 
     36#ifdef IPP_CONDOR
     37  int index;
     38  index = is_host_in_list(hostname);
     39  if (index != -1) {
     40      if (hosts[index].max_threads != max_threads) {
     41          fprintf(stderr, "Hostname [%s] already declared. Changing max_threads from %d to %d",
     42                 hostname,
     43                 hosts[index].max_threads,
     44                 max_threads);
     45          hosts[index].max_threads = max_threads;
     46      } else {
     47          fprintf(stderr, "Hostname [%s] already declared. Aborting", hostname);
     48      }
     49      return (TRUE);
     50  }
     51#endif
    2452  N = Nhosts;
    2553  Nhosts ++;
    26 
    2754  CHECK_REALLOCATE (hosts, Host, NHOSTS, Nhosts, 16);
    28 
    2955  hosts[N].hostname = strcreate (hostname);
    3056  hosts[N].max_threads = max_threads;
    31  
     57#ifdef IPP_CONDOR
     58  fprintf(stderr, "Adding host %s (%d)\n", hostname, max_threads);
     59  hosts_list_modified = TRUE; //Tell get_hosts_requirements to rebuild the hosts based requirement
     60#endif
    3261  return (TRUE);
    3362}
     
    3766// but perhaps mark it in the client_thread?
    3867int DeleteHost (char *hostname) {
    39 
    4068  int i, j;
    41 
    42   for (i = 0; i < Nhosts; i++) {
     69  fprintf(stderr, "Attempting to delete %s\n", hostname);
     70#ifdef IPP_CONDOR
     71  int index;
     72  index = is_host_in_list(hostname);
     73  if (index == -1) {
     74      return (FALSE);
     75  }
     76#endif
     77  for (i = 0; i < Nhosts; i++) { //Optimize this for condor
    4378    if (strcmp (hosts[i].hostname, hostname)) continue;
    44    
    4579    // delete this one
    4680    free (hosts[i].hostname);
     
    5084    }
    5185    Nhosts --;
     86#ifdef IPP_CONDOR
     87    hosts_list_modified = TRUE; //Tell get_hosts_requirements to rebuild the hosts based requirement
     88#endif
    5289    return (TRUE);
    5390  }
     
    88125    // float dtime = DTIME (stop, start);
    89126    /* if (VerboseMode()) gprint (GP_ERR, "delete job %f\n", dtime); */
    90   } 
     127  }
    91128  return (TRUE);
    92129}
     
    95132
    96133  int status;
    97   char cmd[128]; 
     134  char cmd[128];
    98135  IOBuffer buffer;
    99136
     
    104141  return (status);
    105142}
    106  
     143
    107144/* ask controller about job status */
    108145int CheckControllerJobStatus (Job *job) {
     
    169206}
    170207
    171 /* we read Nbytes from the host, then watch for the prompt */ 
     208/* we read Nbytes from the host, then watch for the prompt */
    172209int GetJobOutput (char *cmd, int pid, IOBuffer *buffer, int Nbytes) {
    173  
     210
    174211  int i, status, Nstart;
    175212  char *line;
     
    222259/* submitting a job to the controller automatically starts controller */
    223260int SubmitControllerJob (Job *job) {
    224 
     261#ifndef IPP_CONDOR
     262  fprintf(stderr, "Submitting job to pcontrol");
     263  fprintf(stdout, "Submitting job to pcontrol");
    225264  int i, Nchar, status;
    226265  char *cmd, *p, string[64];
    227266  IOBuffer buffer;
    228 
    229   if (job[0].task[0].host == NULL) return (FALSE);
    230 
     267  if (job[0].task[0].host == NULL) return (FALSE);
    231268  if (!StartController ()) {
    232269    gprint (GP_ERR, "failure to start pcontrol\n");
    233270    return (FALSE);
    234271  }
    235 
    236272  /** construct the line to be sent to the controller **/
    237 
    238273  /* determine the total line length */
    239274  Nchar = 0;
     
    247282  ALLOCATE (cmd, char, Nchar);
    248283  bzero (cmd, Nchar);
    249 
    250284  /* construct the controller command portion */
    251285  if (!strcasecmp (job[0].task[0].host, "ANYHOST")) {
     
    258292    }
    259293  }
    260  
    261294  if (job[0].priority) {
    262295    char tmp[64];
     
    264297    strcat (cmd, tmp);
    265298  }
    266 
    267299  /* add the command arguments */
    268300  for (i = 0; i < job[0].task[0].argc; i++) {
     
    270302    strcat (cmd, job[0].task[0].argv[i]);
    271303  }
    272 
    273304  // This function is called by the JobTaskThread via SubmitJob.  We need to unlock the
    274305  // JobTaskLock to avoid a dead lock with the JobTaskLock called in CheckController
     
    280311  ControlUnlock(__func__);
    281312  JobTaskLock();
    282 
    283 
    284313  /* extract the job PID from the controller response */
    285314  p = memstr (buffer.buffer, "JobID", buffer.Nbuffer);
     
    292321  sscanf (p, "%*s %s", string);
    293322  FreeIOBuffer (&buffer);
    294 
    295323  job[0].pid = atoi (string);
    296324  if (job[0].pid < 0) {
    297325    return (FALSE);
    298326  }
     327#else
     328  struct ns1__Transaction *transaction;
     329  int clusterId;
     330  //Create a Transaction
     331  transaction = beginTransaction(&soap, 10);
     332  //Get a clusterId
     333  clusterId = newCluster(&soap, transaction);
     334  fprintf(stderr, "ClusterId = %d\n", clusterId);
     335  fprintf(stdout, "Submitting job to HTCondor\n");
     336  char *args = paste_args(job[0].task[0].argc-1, job[0].task[0].argv+1);
     337  submitJob(&soap, transaction, clusterId, 0,
     338            job[0].task[0].argv[0],
     339            args,
     340            get_hosts_requirements());
     341  commitTransaction(&soap, transaction);
     342#endif
    299343  return (TRUE);
    300344}
    301345
    302346int StartController () {
    303 
     347#ifndef IPP_CONDOR
    304348  char *p;
    305349  char **argv, cmd[128];
     
    307351  int stdin_fd[2], stdout_fd[2], stderr_fd[2];
    308352  IOBuffer buffer;
    309 
    310353  if (ControllerStatus) return (TRUE);
    311 
    312354  if (VarConfig ("CONTROLLER", "%s", cmd) == NULL) strcpy (cmd, "pcontrol");
    313 
    314355  if (hosts == NULL) {
    315356    NHOSTS = 16;
    316357    ALLOCATE (hosts, Host, NHOSTS);
    317358  }
    318 
    319359  bzero (stdin_fd,  2*sizeof(int));
    320360  bzero (stdout_fd, 2*sizeof(int));
    321361  bzero (stderr_fd, 2*sizeof(int));
    322 
    323362  if (pipe (stdin_fd)  < 0) goto pipe_error;
    324363  if (pipe (stdout_fd) < 0) goto pipe_error;
    325364  if (pipe (stderr_fd) < 0) goto pipe_error;
    326 
    327365  ALLOCATE (argv, char *, 2);
    328366  argv[0] = cmd;
    329367  argv[1] = 0;
    330 
    331368  pid = fork ();
    332369  if (!pid) { /* must be child process */
    333370    gprint (GP_LOG, "starting controller connection\n");
    334 
    335371    /* close the other ends of the pipes */
    336372    close (stdin_fd[1]);
    337373    close (stdout_fd[0]);
    338374    close (stderr_fd[0]);
    339 
    340375    /* tie our ends of the pipes to stdin, stdout, stderr */
    341376    dup2 (stdin_fd[0],  STDIN_FILENO);
    342377    dup2 (stdout_fd[1], STDOUT_FILENO);
    343378    dup2 (stderr_fd[1], STDERR_FILENO);
    344 
    345379    /* set all three unblocking */
    346380    setvbuf (stdin,  (char *) NULL, _IONBF, BUFSIZ);
    347381    setvbuf (stdout, (char *) NULL, _IONBF, BUFSIZ);
    348382    setvbuf (stderr, (char *) NULL, _IONBF, BUFSIZ);
    349 
    350     status = execvp (argv[0], argv);
     383    status = execvp (argv[0], argv);
    351384    exit (1);
    352385  }
    353386  free (argv);
    354 
    355387  /* close the other ends of the pipes */
    356388  close (stdin_fd[0]);  stdin_fd[0]  = 0;
    357389  close (stdout_fd[1]); stdout_fd[1] = 0;
    358390  close (stderr_fd[1]); stderr_fd[1] = 0;
    359 
    360391  /* make the pipes non-blocking */
    361392  fcntl (stdin_fd[1],  F_SETFL, O_NONBLOCK);
    362393  fcntl (stdout_fd[0], F_SETFL, O_NONBLOCK);
    363394  fcntl (stderr_fd[0], F_SETFL, O_NONBLOCK);
    364 
    365395  /* perform handshake with controller to verify alive & running */
    366396  /** this handshake is similar to ControllerCommand, but has important differences **/
    367397  InitIOBuffer (&buffer, 0x100);
    368 
    369398  /* send handshake command */
    370399  status = write_fmt (stdin_fd[1], "echo CONNECTED\n");
    371400  if ((status == -1) && (errno == EPIPE)) goto pipe_error;
    372 
    373401  /* try to get evidence connection is alive - wait upto a few seconds */
    374402  /* connection is likely slow; don't bother with nanosleep here */
     
    383411  if (status == -1) goto io_error;
    384412  FreeIOBuffer (&buffer);
    385 
    386413  /* set local static vars to pipe connections */
    387414  stdin_cntl  = stdin_fd[1];
    388415  stdout_cntl = stdout_fd[0];
    389416  stderr_cntl = stderr_fd[0];
    390 
    391417  InitIOBuffer (&stdout_buffer, 0x100);
    392418  InitIOBuffer (&stderr_buffer, 0x100);
    393 
    394419  ControllerPID = pid;
     420#else
     421  if (ControllerStatus == FALSE) {
     422      //Initiate the HTcondor connection
     423      soap_init(&soap);
     424      soap_set_namespaces(&soap, condor_namespaces);
     425  }
     426#endif
    395427  ControllerStatus = TRUE;
    396428  gprint (GP_LOG, "Connected\n");
    397429  return (TRUE);
    398 
     430#ifndef IPP_CONDOR
    399431pipe_error:
    400432  perror ("pipe error:");
    401433  goto close_pipes;
    402 
    403434io_error:
    404435  gprint (GP_ERR, "timeout while connecting\n");
    405436  goto close_pipes;
    406 
    407437close_pipes:
    408438  if (stdin_fd[0]  != 0) close (stdin_fd[0]);
     
    413443  if (stderr_fd[1] != 0) close (stderr_fd[1]);
    414444  return (FALSE);
     445#endif
    415446}
    416447
    417448int ControllerCommand (char *cmd, char *response, IOBuffer *buffer) {
    418 
     449#ifndef IPP_CONDOR
    419450  int i, j, status;
    420451  char *line;
    421452  struct timespec request, remain;
    422 
     453  //fprintf(stderr, "ControllerCommand: [%s]\n", cmd);
    423454  /* avoid blocking on waitpid, test every 100 usec, up to 50 msec */
    424455  request.tv_sec = 0;
    425456  request.tv_nsec = 100000;
    426 
    427457  ReadtoIOBuffer (buffer, stdout_cntl);
    428458  FlushIOBuffer (buffer);
    429 
    430459  /* send command, is pipe still open? */
    431460  status = write_fmt (stdin_cntl, "%s\n", cmd);
     
    438467    return (FALSE);
    439468  }
    440  
    441469  /* for commands which don't return a prompt, don't look for one */
    442470  if (response == NULL) {
    443471    return (TRUE);
    444472  }
    445 
    446473  /* watch for response - wait up to 1 second */
    447474  line = NULL;
     
    457484      fprintf (stderr, "controller is down (EOF), restarting\n");
    458485      if (!RestartController ()) {
    459         return (FALSE);
     486        return (FALSE);
    460487      }
    461488      return (FALSE);
     
    470497    return (FALSE);
    471498  }
    472 
    473499  /* need to strip off the prompt */
    474500  line = memstr (buffer[0].buffer, response, buffer[0].Nbuffer);
     
    478504  }
    479505  if (VerboseMode()) fprintf (stderr, "message received, %d cycles\n", i);
     506#endif
    480507  return (TRUE);
    481508}
     
    498525      break;
    499526  }
    500  
     527
    501528  /* read stderr buffer */
    502529  Nread = ReadtoIOBuffer (&stderr_buffer, stderr_cntl);
     
    576603
    577604int QuitController () {
    578 
     605#ifndef IPP_CONDOR
    579606  char cmd[128];
    580607  IOBuffer buffer;
    581 
    582608  if (!ControllerStatus) return (TRUE);
    583 
    584609  sprintf (cmd, "quit");
    585610  InitIOBuffer (&buffer, 0x100);
    586611  ControllerCommand (cmd, NULL, &buffer);
    587612  FreeIOBuffer (&buffer);
    588 
    589   /* the quit command does not return a prompt,
     613  /* the quit command does not return a prompt,
    590614     check that the controller exited */
    591615  StopController ();
     616#else
     617  soap_destroy(&soap);
     618  soap_end(&soap);
     619  soap_done(&soap);
     620#endif
    592621  return (TRUE);
    593622}
    594623
    595624int StopController () {
    596 
     625#ifndef IPP_CONDOR
    597626  int i, waitstatus, result;
    598 
    599627  if (!ControllerStatus) return (TRUE);
    600 
    601628  ControllerStatus = FALSE;
    602629  result = waitpid (ControllerPID, &waitstatus, WNOHANG);
     
    611638  FreeIOBuffer (&stdout_buffer);
    612639  FreeIOBuffer (&stderr_buffer);
     640#endif
    613641  return (TRUE);
    614642}
    615643
    616644int RestartController () {
    617 
     645#ifndef IPP_CONDOR
    618646  int i, status;
    619647  char command[256];
    620648  IOBuffer buffer;
    621 
    622649  gprint (GP_ERR, "attempting to restart pcontrol\n");
    623650  if (!StartController ()) {
     
    625652    return (FALSE);
    626653  }
    627 
    628654  InitIOBuffer (&buffer, 0x100);
    629 
    630655  status = TRUE;
    631 
    632656  // XXX lock the host table? no: that would risk a dead lock between client and controller threads:
    633657  gprint (GP_ERR, "pcontrol restarted, reloading hosts\n");
     
    637661    status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
    638662  }
    639 
    640663  if (status) gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
    641 
    642   FreeIOBuffer (&buffer);
    643 
    644   return (TRUE);
    645 }
     664  FreeIOBuffer (&buffer);
     665#endif
     666  return (TRUE);
     667}
     668
     669#ifdef IPP_CONDOR
     670char* get_hosts_requirements(void) {
     671    int i;
     672    int hr_length;
     673    char* base_requirement_pattern_b = " (machine == \"";
     674    char* base_requirement_pattern_e = "\")";
     675    char* base_requirement_pattern_or = " || ";
     676    if ( (hosts_requirement != NULL) && (hosts_list_modified == FALSE) ) {
     677        return hosts_requirement;
     678    }
     679    if (hosts_requirement != NULL) {
     680        free(hosts_requirement);
     681    }
     682    printf("Generating hosts based requirement\n");
     683    hosts_requirement = strcreate("");
     684    hr_length = strlen(hosts_requirement);
     685    if (Nhosts > 0) {
     686        hosts_requirement = opihi_append(hosts_requirement, &hr_length, "( ", NULL);
     687        for (i = 0; i < Nhosts; i++) {
     688            hosts_requirement = opihi_append(hosts_requirement, &hr_length,
     689                                             base_requirement_pattern_b, NULL);
     690            hosts_requirement = opihi_append(hosts_requirement, &hr_length,
     691                                             hosts[i].hostname, NULL);
     692            hosts_requirement = opihi_append(hosts_requirement, &hr_length,
     693                                             base_requirement_pattern_e, NULL);
     694            if (i != Nhosts-1) {
     695                hosts_requirement = opihi_append(hosts_requirement, &hr_length,
     696                                                 base_requirement_pattern_or, NULL);
     697            }
     698        }
     699    } else { // No host defined: leave it empty
     700        //pass
     701    }
     702    hosts_list_modified = FALSE;
     703    printf("end of Generating hosts based requirement\n");
     704    return hosts_requirement;
     705}
     706
     707static int is_host_in_list(char *hostname) {
     708    int i;
     709    for (i = 0; i < Nhosts; i++) {
     710        if (strcmp(hosts[i].hostname, hostname) == 0) {
     711            return i;
     712        }
     713    }
     714    return -1;
     715}
     716
     717char *get_host_status(char* hostname) {
     718    return getHostStatus(&soap, hostname);
     719}
     720
     721#endif
  • branches/sc_branches/pantasks_condor/pantasks/JobOps.c

    r32632 r34783  
    2727/* provide a mechanism to loop over the list of jobs */
    2828Job *NextJob () {
    29  
     29
    3030  Job *job;
    3131
     
    5252  }
    5353  return (NULL);
    54 } 
     54}
    5555
    5656/* return job with given controller Job ID */
     
    6767  }
    6868  return (NULL);
    69 } 
     69}
    7070
    7171/* list known jobs */
     
    9090/* make a new job from a task */
    9191Job *CreateJob (Task *task) {
    92  
     92
    9393  int i;
    9494  Job *job;
    95  
     95
    9696  ALLOCATE (job, Job, 1);
    9797
     
    131131  job[0].task = task;
    132132  job[0].realhost = NULL;
    133  
     133
    134134  /* if we decide we need to be able to dynamically set task qualities (like host, timeouts, etc), the we will
    135135     need to have matched entries to these quantites in the job structure */
     
    160160
    161161void FreeJob (Job *job) {
    162  
     162
    163163  int i;
    164164
    165165  if (job == NULL) return;
    166  
     166
    167167  FreeJobID (job[0].JobID);
    168168
     
    230230    if (jobs[i][0].mode == JOB_LOCAL) {
    231231      if (!KillLocalJob (jobs[i])) {
    232         jobs[i][0].state = JOB_HUNG;
    233         if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", jobs[i][0].pid);
     232        jobs[i][0].state = JOB_HUNG;
     233        if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", jobs[i][0].pid);
    234234      }
    235235    } else {
    236236      if (!KillControllerJob (jobs[i])) {
    237         jobs[i][0].state = JOB_HUNG;
    238         if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", jobs[i][0].pid);
     237        jobs[i][0].state = JOB_HUNG;
     238        if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", jobs[i][0].pid);
    239239      }
    240     }   
     240    }
    241241    jobs[i][0].task[0].Npending = 0;
    242242    FreeJob (jobs[i]);
    243243  }
    244    
     244
    245245  Njobs = 0;
    246246  NJOBS = 20;
     
    255255
    256256  if (job[0].mode == JOB_LOCAL) {
    257     if (DEBUG) fprintf (stderr, "submit job: (%zx) %d of %d\n", (size_t) job[0].stdout_buff.buffer, job[0].stdout_buff.Nbuffer, job[0].stdout_buff.Nalloc);
    258     status = SubmitLocalJob (job);
     257      if (DEBUG) { fprintf (stderr, "submit job: (%zx) %d of %d\n", (size_t) job[0].stdout_buff.buffer, job[0].stdout_buff.Nbuffer, job[0].stdout_buff.Nalloc); }
     258      fprintf (stdout, "submit job (local)\n");
     259      status = SubmitLocalJob (job);
    259260  } else {
    260     status = SubmitControllerJob (job);
     261      fprintf (stdout, "submit job (non local)\n");
     262      status = SubmitControllerJob (job);
    261263  }
    262264  if (!status) {
     
    306308    default:
    307309      return JobStateNone;
    308   }     
     310  }
    309311  return JobStateNone;
    310312}
  • branches/sc_branches/pantasks_condor/pantasks/Makefile

    r32632 r34783  
    1212# programs may add their own internal requirements here
    1313LIBS1   =       -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata
    14 LIBS2   =       -ldvo -lkapa -lFITS -lohana
    15 FULL_CFLAGS   = $(BASE_CFLAGS)
    16 FULL_CPPFLAGS = $(BASE_CPPFLAGS)
     14LIBS2   =       -ldvo -lkapa -lFITS -lohana -lCondor -lgsoap
     15FULL_CFLAGS   = $(BASE_CFLAGS) -I/home/panstarrs/ippdor/local/include/gsoap -DIPP_CONDOR
     16FULL_CPPFLAGS = $(BASE_CPPFLAGS) -DIPP_CONDOR
    1717FULL_LDFLAGS  = $(LIBS1) $(LIBS2) $(BASE_LDFLAGS)
    1818
     
    5858$(SRC)/JobOps.$(ARCH).o \
    5959$(SRC)/JobIDOps.$(ARCH).o \
    60 $(SRC)/TaskOps.$(ARCH).o
     60$(SRC)/TaskOps.$(ARCH).o \
     61$(SRC)/ipp_condor.$(ARCH).o
    6162
    6263cmds = \
  • branches/sc_branches/pantasks_condor/pantasks/controller_check.c

    r10660 r34783  
    11# include "pantasks.h"
     2
     3#ifdef IPP_CONDOR
     4#include "ipp_condor.h"
     5#endif
    26
    37int controller_check (int argc, char **argv) {
     
    812
    913  if (argc != 3) goto usage;
    10   if (strcasecmp (argv[1], "JOB") && 
     14  if (strcasecmp (argv[1], "JOB") &&
    1115      strcasecmp (argv[1], "HOST")) goto usage;
    1216
     17#ifndef IPP_CONDOR
    1318  /* check if controller is running */
    1419  status = CheckControllerStatus ();
     
    2227  status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
    2328  if (VerboseMode()) {
    24     gprint (GP_LOG, "controller command sent\n"); 
    25     gprint (GP_LOG, "\n Nbytes received: %d\n", buffer.Nbuffer); 
     29    gprint (GP_LOG, "controller command sent\n");
     30    gprint (GP_LOG, "\n Nbytes received: %d\n", buffer.Nbuffer);
    2631  }
    2732  gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
    2833  FreeIOBuffer (&buffer);
     34#else
     35  status = 2;
     36  sprintf(command, "balh");
     37  InitIOBuffer (&buffer, 0x100);
     38#endif
    2939  return (TRUE);
    3040
  • branches/sc_branches/pantasks_condor/pantasks/controller_host.c

    r23530 r34783  
    1 # include "pantasks.h"
     1#include "pantasks.h"
     2
     3#ifdef IPP_CONDOR
     4#include "ipp_condor.h"
     5#endif
    26
    37int controller_host (int argc, char **argv) {
     8  int N, max_threads;
    49
    5   int N, status, max_threads;
    6   char command[1024];
    7   IOBuffer buffer;
     10  fprintf(stderr, "in controller_host\n");
    811
    912  max_threads = 0;
     
    1619  if (argc != 3) goto usage;
    1720  if (max_threads && strcasecmp (argv[1], "ADD")) goto usage;
     21
     22  char command[1024];
     23  IOBuffer buffer;
     24  int status;
    1825
    1926  /* start controller connection (if needed) */
     
    2835  if (!strcasecmp (argv[1], "ADD")) {
    2936    AddHost (argv[2], max_threads);
    30   } 
     37  }
    3138
    3239  if (!strcasecmp (argv[1], "DELETE")) {
     
    4653
    4754  FreeIOBuffer (&buffer);
     55
     56#ifdef IPP_CONDOR
     57# ifdef DEBUG
     58  printf("Showing hosts requirements\n");
     59  printf("[%s]\n", get_hosts_requirements());
     60# endif
     61#endif
    4862  return (TRUE);
    49  
     63
    5064usage:
    5165  gprint (GP_LOG, "USAGE: controller host (command) (hostname)\n");
  • branches/sc_branches/pantasks_condor/pantasks/controller_run.c

    r10694 r34783  
    33int controller_run (int argc, char **argv) {
    44
     5#ifndef IPP_CONDOR
    56  int status;
    67  char command[1024];
     
    1011      get_argument (argc, argv, "help") ||
    1112      get_argument (argc, argv, "-h") ||
    12       get_argument (argc, argv, "--help")) 
     13      get_argument (argc, argv, "--help"))
    1314  {
    1415    if (!strcmp (argv[0], "run")) {
     
    4647  }
    4748  FreeIOBuffer (&buffer);
     49#else
     50  gprint (GP_ERR, "Not used in Condor\n");
     51#endif
     52
    4853  return (TRUE);
    4954}
  • branches/sc_branches/pantasks_condor/pantasks/controller_status.c

    r23530 r34783  
    1 # include "pantasks.h"
     1#include "pantasks.h"
     2#include "ipp_condor.h"
    23
    34int controller_status (int argc, char **argv) {
    4 
     5#ifndef IPP_CONDOR
    56  int status;
    67  char command[1024];
    78  IOBuffer buffer;
    8 
    99  if (argc != 1) {
    1010    gprint (GP_ERR, "USAGE: controller status\n");
    1111    return (FALSE);
    1212  }
    13 
    1413  /* check if controller is running */
    1514  status = CheckControllerStatus ();
     
    1817    return (TRUE);
    1918  }
    20 
    21 
    2219  sprintf (command, "status");
    2320  InitIOBuffer (&buffer, 0x100);
    24 
    2521  status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
    26 
    2722  if (status) {
    2823    gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
     
    3126  }
    3227  FreeIOBuffer (&buffer);
     28#else
     29  gprint(GP_LOG, strprintf("%s\n", get_hosts_requirements()));
     30  gprint(GP_LOG, strprintf("%s\n", get_host_status("ippc63.ifa.hawaii.edu")));
     31
     32#endif
    3333  return (TRUE);
    3434}
  • branches/sc_branches/pantasks_condor/pantasks/controller_version.c

    r26411 r34783  
    33int controller_version (int argc, char **argv) {
    44
     5#ifndef IPP_CONDOR
    56  int status;
    67  char command[1024];
     
    1920  }
    2021
    21 
    2222  sprintf (command, "version");
    2323  InitIOBuffer (&buffer, 0x100);
     
    3131  }
    3232  FreeIOBuffer (&buffer);
     33
     34#else
     35  gprint(GP_ERR, "TODO: Show a version here\n");
     36#endif
     37
    3338  return (TRUE);
    3439}
Note: See TracChangeset for help on using the changeset viewer.