Changeset 34783
- Timestamp:
- Dec 10, 2012, 12:07:22 PM (14 years ago)
- Location:
- branches/sc_branches/pantasks_condor
- Files:
-
- 9 edited
- 1 copied
-
. (copied) (copied from trunk/Ohana/src/opihi ) (1 prop)
-
include/pantasks.h (modified) (9 diffs)
-
pantasks/ControllerOps.c (modified) (27 diffs)
-
pantasks/JobOps.c (modified) (9 diffs)
-
pantasks/Makefile (modified) (2 diffs)
-
pantasks/controller_check.c (modified) (3 diffs)
-
pantasks/controller_host.c (modified) (4 diffs)
-
pantasks/controller_run.c (modified) (3 diffs)
-
pantasks/controller_status.c (modified) (3 diffs)
-
pantasks/controller_version.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/sc_branches/pantasks_condor
- Property svn:mergeinfo set to
-
branches/sc_branches/pantasks_condor/include/pantasks.h
r32632 r34783 11 11 typedef enum { 12 12 JOB_NONE, 13 JOB_BUSY, 14 JOB_EXIT, 13 JOB_BUSY, 14 JOB_EXIT, 15 15 JOB_HUNG, 16 16 JOB_CRASH, … … 19 19 20 20 typedef enum { 21 JOB_LOCAL, 22 JOB_CONTROLLER, 21 JOB_LOCAL, 22 JOB_CONTROLLER, 23 23 } JobMode; 24 24 … … 32 32 enum {TIMER_ALLJOBS, TIMER_SUCCESS, TIMER_FAILURE}; 33 33 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, 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, 50 50 TASK_EXEC 51 51 } TaskHashResults; … … 68 68 /* a task is a description of the wrapping of a job */ 69 69 typedef 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' */ 72 72 Macro *timeout; 73 73 Macro *defexit; … … 75 75 int NEXIT; 76 76 int Nexit; 77 Macro **exit; /* name is exit status */77 Macro **exit; /* name is exit status */ 78 78 79 79 int argc; … … 120 120 } Task; 121 121 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) 124 124 // time ranges (e_time - e_time) (use e_time % 86400) 125 125 // time-of-week ranges (e_time - e_time … … 131 131 // keep: TRUE: perform action within this time period 132 132 // keep: FALSE: do not perform action within this time period 133 133 134 134 typedef 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 */ 137 137 138 138 struct timeval last; … … 160 160 int stderr_fd; /* stderr pipe (local only) */ 161 161 162 JobMode mode; /* local or controller? */162 JobMode mode; /* local or controller? */ 163 163 int priority; 164 164 char *realhost; … … 302 302 303 303 int FlushJobs (void); 304 305 #ifdef IPP_CONDOR 306 char* get_hosts_requirement(void); 307 char *get_host_status(char* hostname); 308 #endif -
branches/sc_branches/pantasks_condor/pantasks/ControllerOps.c
r34088 r34783 9 9 static IOBuffer stdout_buffer; 10 10 static IOBuffer stderr_buffer; 11 #ifndef IPP_CONDOR 11 12 static int ControllerPID = 0; 13 #else 14 #include "ipp_condor.h" 15 #include <condor/condor.nsmap> 16 #include <shell.h> 17 static struct soap soap; 18 #endif 12 19 13 20 /* local static variables to track the controller host properties */ … … 18 25 static int NHOSTS = 0; 19 26 27 #ifdef IPP_CONDOR 28 #include "ipp_condor.h" 29 static int hosts_list_modified = TRUE; 30 static char* hosts_requirement = NULL; 31 static int is_host_in_list(char *hostname); 32 #endif 33 20 34 int AddHost (char *hostname, int max_threads) { 21 22 35 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 24 52 N = Nhosts; 25 53 Nhosts ++; 26 27 54 CHECK_REALLOCATE (hosts, Host, NHOSTS, Nhosts, 16); 28 29 55 hosts[N].hostname = strcreate (hostname); 30 56 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 32 61 return (TRUE); 33 62 } … … 37 66 // but perhaps mark it in the client_thread? 38 67 int DeleteHost (char *hostname) { 39 40 68 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 43 78 if (strcmp (hosts[i].hostname, hostname)) continue; 44 45 79 // delete this one 46 80 free (hosts[i].hostname); … … 50 84 } 51 85 Nhosts --; 86 #ifdef IPP_CONDOR 87 hosts_list_modified = TRUE; //Tell get_hosts_requirements to rebuild the hosts based requirement 88 #endif 52 89 return (TRUE); 53 90 } … … 88 125 // float dtime = DTIME (stop, start); 89 126 /* if (VerboseMode()) gprint (GP_ERR, "delete job %f\n", dtime); */ 90 } 127 } 91 128 return (TRUE); 92 129 } … … 95 132 96 133 int status; 97 char cmd[128]; 134 char cmd[128]; 98 135 IOBuffer buffer; 99 136 … … 104 141 return (status); 105 142 } 106 143 107 144 /* ask controller about job status */ 108 145 int CheckControllerJobStatus (Job *job) { … … 169 206 } 170 207 171 /* we read Nbytes from the host, then watch for the prompt */ 208 /* we read Nbytes from the host, then watch for the prompt */ 172 209 int GetJobOutput (char *cmd, int pid, IOBuffer *buffer, int Nbytes) { 173 210 174 211 int i, status, Nstart; 175 212 char *line; … … 222 259 /* submitting a job to the controller automatically starts controller */ 223 260 int SubmitControllerJob (Job *job) { 224 261 #ifndef IPP_CONDOR 262 fprintf(stderr, "Submitting job to pcontrol"); 263 fprintf(stdout, "Submitting job to pcontrol"); 225 264 int i, Nchar, status; 226 265 char *cmd, *p, string[64]; 227 266 IOBuffer buffer; 228 229 if (job[0].task[0].host == NULL) return (FALSE); 230 267 if (job[0].task[0].host == NULL) return (FALSE); 231 268 if (!StartController ()) { 232 269 gprint (GP_ERR, "failure to start pcontrol\n"); 233 270 return (FALSE); 234 271 } 235 236 272 /** construct the line to be sent to the controller **/ 237 238 273 /* determine the total line length */ 239 274 Nchar = 0; … … 247 282 ALLOCATE (cmd, char, Nchar); 248 283 bzero (cmd, Nchar); 249 250 284 /* construct the controller command portion */ 251 285 if (!strcasecmp (job[0].task[0].host, "ANYHOST")) { … … 258 292 } 259 293 } 260 261 294 if (job[0].priority) { 262 295 char tmp[64]; … … 264 297 strcat (cmd, tmp); 265 298 } 266 267 299 /* add the command arguments */ 268 300 for (i = 0; i < job[0].task[0].argc; i++) { … … 270 302 strcat (cmd, job[0].task[0].argv[i]); 271 303 } 272 273 304 // This function is called by the JobTaskThread via SubmitJob. We need to unlock the 274 305 // JobTaskLock to avoid a dead lock with the JobTaskLock called in CheckController … … 280 311 ControlUnlock(__func__); 281 312 JobTaskLock(); 282 283 284 313 /* extract the job PID from the controller response */ 285 314 p = memstr (buffer.buffer, "JobID", buffer.Nbuffer); … … 292 321 sscanf (p, "%*s %s", string); 293 322 FreeIOBuffer (&buffer); 294 295 323 job[0].pid = atoi (string); 296 324 if (job[0].pid < 0) { 297 325 return (FALSE); 298 326 } 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 299 343 return (TRUE); 300 344 } 301 345 302 346 int StartController () { 303 347 #ifndef IPP_CONDOR 304 348 char *p; 305 349 char **argv, cmd[128]; … … 307 351 int stdin_fd[2], stdout_fd[2], stderr_fd[2]; 308 352 IOBuffer buffer; 309 310 353 if (ControllerStatus) return (TRUE); 311 312 354 if (VarConfig ("CONTROLLER", "%s", cmd) == NULL) strcpy (cmd, "pcontrol"); 313 314 355 if (hosts == NULL) { 315 356 NHOSTS = 16; 316 357 ALLOCATE (hosts, Host, NHOSTS); 317 358 } 318 319 359 bzero (stdin_fd, 2*sizeof(int)); 320 360 bzero (stdout_fd, 2*sizeof(int)); 321 361 bzero (stderr_fd, 2*sizeof(int)); 322 323 362 if (pipe (stdin_fd) < 0) goto pipe_error; 324 363 if (pipe (stdout_fd) < 0) goto pipe_error; 325 364 if (pipe (stderr_fd) < 0) goto pipe_error; 326 327 365 ALLOCATE (argv, char *, 2); 328 366 argv[0] = cmd; 329 367 argv[1] = 0; 330 331 368 pid = fork (); 332 369 if (!pid) { /* must be child process */ 333 370 gprint (GP_LOG, "starting controller connection\n"); 334 335 371 /* close the other ends of the pipes */ 336 372 close (stdin_fd[1]); 337 373 close (stdout_fd[0]); 338 374 close (stderr_fd[0]); 339 340 375 /* tie our ends of the pipes to stdin, stdout, stderr */ 341 376 dup2 (stdin_fd[0], STDIN_FILENO); 342 377 dup2 (stdout_fd[1], STDOUT_FILENO); 343 378 dup2 (stderr_fd[1], STDERR_FILENO); 344 345 379 /* set all three unblocking */ 346 380 setvbuf (stdin, (char *) NULL, _IONBF, BUFSIZ); 347 381 setvbuf (stdout, (char *) NULL, _IONBF, BUFSIZ); 348 382 setvbuf (stderr, (char *) NULL, _IONBF, BUFSIZ); 349 350 status = execvp (argv[0], argv); 383 status = execvp (argv[0], argv); 351 384 exit (1); 352 385 } 353 386 free (argv); 354 355 387 /* close the other ends of the pipes */ 356 388 close (stdin_fd[0]); stdin_fd[0] = 0; 357 389 close (stdout_fd[1]); stdout_fd[1] = 0; 358 390 close (stderr_fd[1]); stderr_fd[1] = 0; 359 360 391 /* make the pipes non-blocking */ 361 392 fcntl (stdin_fd[1], F_SETFL, O_NONBLOCK); 362 393 fcntl (stdout_fd[0], F_SETFL, O_NONBLOCK); 363 394 fcntl (stderr_fd[0], F_SETFL, O_NONBLOCK); 364 365 395 /* perform handshake with controller to verify alive & running */ 366 396 /** this handshake is similar to ControllerCommand, but has important differences **/ 367 397 InitIOBuffer (&buffer, 0x100); 368 369 398 /* send handshake command */ 370 399 status = write_fmt (stdin_fd[1], "echo CONNECTED\n"); 371 400 if ((status == -1) && (errno == EPIPE)) goto pipe_error; 372 373 401 /* try to get evidence connection is alive - wait upto a few seconds */ 374 402 /* connection is likely slow; don't bother with nanosleep here */ … … 383 411 if (status == -1) goto io_error; 384 412 FreeIOBuffer (&buffer); 385 386 413 /* set local static vars to pipe connections */ 387 414 stdin_cntl = stdin_fd[1]; 388 415 stdout_cntl = stdout_fd[0]; 389 416 stderr_cntl = stderr_fd[0]; 390 391 417 InitIOBuffer (&stdout_buffer, 0x100); 392 418 InitIOBuffer (&stderr_buffer, 0x100); 393 394 419 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 395 427 ControllerStatus = TRUE; 396 428 gprint (GP_LOG, "Connected\n"); 397 429 return (TRUE); 398 430 #ifndef IPP_CONDOR 399 431 pipe_error: 400 432 perror ("pipe error:"); 401 433 goto close_pipes; 402 403 434 io_error: 404 435 gprint (GP_ERR, "timeout while connecting\n"); 405 436 goto close_pipes; 406 407 437 close_pipes: 408 438 if (stdin_fd[0] != 0) close (stdin_fd[0]); … … 413 443 if (stderr_fd[1] != 0) close (stderr_fd[1]); 414 444 return (FALSE); 445 #endif 415 446 } 416 447 417 448 int ControllerCommand (char *cmd, char *response, IOBuffer *buffer) { 418 449 #ifndef IPP_CONDOR 419 450 int i, j, status; 420 451 char *line; 421 452 struct timespec request, remain; 422 453 //fprintf(stderr, "ControllerCommand: [%s]\n", cmd); 423 454 /* avoid blocking on waitpid, test every 100 usec, up to 50 msec */ 424 455 request.tv_sec = 0; 425 456 request.tv_nsec = 100000; 426 427 457 ReadtoIOBuffer (buffer, stdout_cntl); 428 458 FlushIOBuffer (buffer); 429 430 459 /* send command, is pipe still open? */ 431 460 status = write_fmt (stdin_cntl, "%s\n", cmd); … … 438 467 return (FALSE); 439 468 } 440 441 469 /* for commands which don't return a prompt, don't look for one */ 442 470 if (response == NULL) { 443 471 return (TRUE); 444 472 } 445 446 473 /* watch for response - wait up to 1 second */ 447 474 line = NULL; … … 457 484 fprintf (stderr, "controller is down (EOF), restarting\n"); 458 485 if (!RestartController ()) { 459 return (FALSE);486 return (FALSE); 460 487 } 461 488 return (FALSE); … … 470 497 return (FALSE); 471 498 } 472 473 499 /* need to strip off the prompt */ 474 500 line = memstr (buffer[0].buffer, response, buffer[0].Nbuffer); … … 478 504 } 479 505 if (VerboseMode()) fprintf (stderr, "message received, %d cycles\n", i); 506 #endif 480 507 return (TRUE); 481 508 } … … 498 525 break; 499 526 } 500 527 501 528 /* read stderr buffer */ 502 529 Nread = ReadtoIOBuffer (&stderr_buffer, stderr_cntl); … … 576 603 577 604 int QuitController () { 578 605 #ifndef IPP_CONDOR 579 606 char cmd[128]; 580 607 IOBuffer buffer; 581 582 608 if (!ControllerStatus) return (TRUE); 583 584 609 sprintf (cmd, "quit"); 585 610 InitIOBuffer (&buffer, 0x100); 586 611 ControllerCommand (cmd, NULL, &buffer); 587 612 FreeIOBuffer (&buffer); 588 589 /* the quit command does not return a prompt, 613 /* the quit command does not return a prompt, 590 614 check that the controller exited */ 591 615 StopController (); 616 #else 617 soap_destroy(&soap); 618 soap_end(&soap); 619 soap_done(&soap); 620 #endif 592 621 return (TRUE); 593 622 } 594 623 595 624 int StopController () { 596 625 #ifndef IPP_CONDOR 597 626 int i, waitstatus, result; 598 599 627 if (!ControllerStatus) return (TRUE); 600 601 628 ControllerStatus = FALSE; 602 629 result = waitpid (ControllerPID, &waitstatus, WNOHANG); … … 611 638 FreeIOBuffer (&stdout_buffer); 612 639 FreeIOBuffer (&stderr_buffer); 640 #endif 613 641 return (TRUE); 614 642 } 615 643 616 644 int RestartController () { 617 645 #ifndef IPP_CONDOR 618 646 int i, status; 619 647 char command[256]; 620 648 IOBuffer buffer; 621 622 649 gprint (GP_ERR, "attempting to restart pcontrol\n"); 623 650 if (!StartController ()) { … … 625 652 return (FALSE); 626 653 } 627 628 654 InitIOBuffer (&buffer, 0x100); 629 630 655 status = TRUE; 631 632 656 // XXX lock the host table? no: that would risk a dead lock between client and controller threads: 633 657 gprint (GP_ERR, "pcontrol restarted, reloading hosts\n"); … … 637 661 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 638 662 } 639 640 663 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 670 char* 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 707 static 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 717 char *get_host_status(char* hostname) { 718 return getHostStatus(&soap, hostname); 719 } 720 721 #endif -
branches/sc_branches/pantasks_condor/pantasks/JobOps.c
r32632 r34783 27 27 /* provide a mechanism to loop over the list of jobs */ 28 28 Job *NextJob () { 29 29 30 30 Job *job; 31 31 … … 52 52 } 53 53 return (NULL); 54 } 54 } 55 55 56 56 /* return job with given controller Job ID */ … … 67 67 } 68 68 return (NULL); 69 } 69 } 70 70 71 71 /* list known jobs */ … … 90 90 /* make a new job from a task */ 91 91 Job *CreateJob (Task *task) { 92 92 93 93 int i; 94 94 Job *job; 95 95 96 96 ALLOCATE (job, Job, 1); 97 97 … … 131 131 job[0].task = task; 132 132 job[0].realhost = NULL; 133 133 134 134 /* if we decide we need to be able to dynamically set task qualities (like host, timeouts, etc), the we will 135 135 need to have matched entries to these quantites in the job structure */ … … 160 160 161 161 void FreeJob (Job *job) { 162 162 163 163 int i; 164 164 165 165 if (job == NULL) return; 166 166 167 167 FreeJobID (job[0].JobID); 168 168 … … 230 230 if (jobs[i][0].mode == JOB_LOCAL) { 231 231 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); 234 234 } 235 235 } else { 236 236 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); 239 239 } 240 } 240 } 241 241 jobs[i][0].task[0].Npending = 0; 242 242 FreeJob (jobs[i]); 243 243 } 244 244 245 245 Njobs = 0; 246 246 NJOBS = 20; … … 255 255 256 256 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); 259 260 } else { 260 status = SubmitControllerJob (job); 261 fprintf (stdout, "submit job (non local)\n"); 262 status = SubmitControllerJob (job); 261 263 } 262 264 if (!status) { … … 306 308 default: 307 309 return JobStateNone; 308 } 310 } 309 311 return JobStateNone; 310 312 } -
branches/sc_branches/pantasks_condor/pantasks/Makefile
r32632 r34783 12 12 # programs may add their own internal requirements here 13 13 LIBS1 = -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata 14 LIBS2 = -ldvo -lkapa -lFITS -lohana 15 FULL_CFLAGS = $(BASE_CFLAGS) 16 FULL_CPPFLAGS = $(BASE_CPPFLAGS) 14 LIBS2 = -ldvo -lkapa -lFITS -lohana -lCondor -lgsoap 15 FULL_CFLAGS = $(BASE_CFLAGS) -I/home/panstarrs/ippdor/local/include/gsoap -DIPP_CONDOR 16 FULL_CPPFLAGS = $(BASE_CPPFLAGS) -DIPP_CONDOR 17 17 FULL_LDFLAGS = $(LIBS1) $(LIBS2) $(BASE_LDFLAGS) 18 18 … … 58 58 $(SRC)/JobOps.$(ARCH).o \ 59 59 $(SRC)/JobIDOps.$(ARCH).o \ 60 $(SRC)/TaskOps.$(ARCH).o 60 $(SRC)/TaskOps.$(ARCH).o \ 61 $(SRC)/ipp_condor.$(ARCH).o 61 62 62 63 cmds = \ -
branches/sc_branches/pantasks_condor/pantasks/controller_check.c
r10660 r34783 1 1 # include "pantasks.h" 2 3 #ifdef IPP_CONDOR 4 #include "ipp_condor.h" 5 #endif 2 6 3 7 int controller_check (int argc, char **argv) { … … 8 12 9 13 if (argc != 3) goto usage; 10 if (strcasecmp (argv[1], "JOB") && 14 if (strcasecmp (argv[1], "JOB") && 11 15 strcasecmp (argv[1], "HOST")) goto usage; 12 16 17 #ifndef IPP_CONDOR 13 18 /* check if controller is running */ 14 19 status = CheckControllerStatus (); … … 22 27 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 23 28 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); 26 31 } 27 32 gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); 28 33 FreeIOBuffer (&buffer); 34 #else 35 status = 2; 36 sprintf(command, "balh"); 37 InitIOBuffer (&buffer, 0x100); 38 #endif 29 39 return (TRUE); 30 40 -
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 2 6 3 7 int controller_host (int argc, char **argv) { 8 int N, max_threads; 4 9 5 int N, status, max_threads; 6 char command[1024]; 7 IOBuffer buffer; 10 fprintf(stderr, "in controller_host\n"); 8 11 9 12 max_threads = 0; … … 16 19 if (argc != 3) goto usage; 17 20 if (max_threads && strcasecmp (argv[1], "ADD")) goto usage; 21 22 char command[1024]; 23 IOBuffer buffer; 24 int status; 18 25 19 26 /* start controller connection (if needed) */ … … 28 35 if (!strcasecmp (argv[1], "ADD")) { 29 36 AddHost (argv[2], max_threads); 30 } 37 } 31 38 32 39 if (!strcasecmp (argv[1], "DELETE")) { … … 46 53 47 54 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 48 62 return (TRUE); 49 63 50 64 usage: 51 65 gprint (GP_LOG, "USAGE: controller host (command) (hostname)\n"); -
branches/sc_branches/pantasks_condor/pantasks/controller_run.c
r10694 r34783 3 3 int controller_run (int argc, char **argv) { 4 4 5 #ifndef IPP_CONDOR 5 6 int status; 6 7 char command[1024]; … … 10 11 get_argument (argc, argv, "help") || 11 12 get_argument (argc, argv, "-h") || 12 get_argument (argc, argv, "--help")) 13 get_argument (argc, argv, "--help")) 13 14 { 14 15 if (!strcmp (argv[0], "run")) { … … 46 47 } 47 48 FreeIOBuffer (&buffer); 49 #else 50 gprint (GP_ERR, "Not used in Condor\n"); 51 #endif 52 48 53 return (TRUE); 49 54 } -
branches/sc_branches/pantasks_condor/pantasks/controller_status.c
r23530 r34783 1 # include "pantasks.h" 1 #include "pantasks.h" 2 #include "ipp_condor.h" 2 3 3 4 int controller_status (int argc, char **argv) { 4 5 #ifndef IPP_CONDOR 5 6 int status; 6 7 char command[1024]; 7 8 IOBuffer buffer; 8 9 9 if (argc != 1) { 10 10 gprint (GP_ERR, "USAGE: controller status\n"); 11 11 return (FALSE); 12 12 } 13 14 13 /* check if controller is running */ 15 14 status = CheckControllerStatus (); … … 18 17 return (TRUE); 19 18 } 20 21 22 19 sprintf (command, "status"); 23 20 InitIOBuffer (&buffer, 0x100); 24 25 21 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 26 27 22 if (status) { 28 23 gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); … … 31 26 } 32 27 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 33 33 return (TRUE); 34 34 } -
branches/sc_branches/pantasks_condor/pantasks/controller_version.c
r26411 r34783 3 3 int controller_version (int argc, char **argv) { 4 4 5 #ifndef IPP_CONDOR 5 6 int status; 6 7 char command[1024]; … … 19 20 } 20 21 21 22 22 sprintf (command, "version"); 23 23 InitIOBuffer (&buffer, 0x100); … … 31 31 } 32 32 FreeIOBuffer (&buffer); 33 34 #else 35 gprint(GP_ERR, "TODO: Show a version here\n"); 36 #endif 37 33 38 return (TRUE); 34 39 }
Note:
See TracChangeset
for help on using the changeset viewer.
