IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13542


Ignore:
Timestamp:
May 30, 2007, 12:14:51 PM (19 years ago)
Author:
eugene
Message:

enable job deletion

Location:
trunk/Ohana/src/opihi/pantasks
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pantasks/delete.c

    r7917 r13542  
    33int delete_job (int argc, char **argv) {
    44
     5  Job *job;
    56  int JobID;
    67
    7   if (argc < 2) {
    8     gprint (GP_ERR, "USAGE: delete (JobID)\n");
     8  if (argc != 3) goto usage;
     9
     10  if (!strcasecmp (argv[1], "job")) {
     11    JobID = atoi (argv[2]);
     12
     13    job = FindJob (JobID);
     14    if (job == NULL) {
     15      gprint (GP_LOG, "job not found\n");
     16      return (TRUE);
     17    }
     18
     19    if (job[0].mode == JOB_LOCAL) {
     20      if (!KillLocalJob (job)) {
     21        job[0].state = JOB_HUNG;
     22        if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid);
     23        return (FALSE);
     24      }
     25    } else {
     26      if (!KillControllerJob (job)) {
     27        job[0].state = JOB_HUNG;
     28        if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid);
     29        return (FALSE);
     30      }
     31    }   
     32    DeleteJob (job);
     33    gprint (GP_LOG, "job removed\n");
     34    return (TRUE);
     35  }
     36
     37  if (!strcasecmp (argv[1], "task")) {
     38    gprint (GP_ERR, "delete task not implemented yet\n");
    939    return (FALSE);
    1040  }
    11   JobID = atoi (argv[1]);
    12   /* use a string interp to convert JobIDs to ints ? */
    1341
    14   gprint (GP_ERR, "this function is not yet implemented\n");
    15   return (TRUE);
     42usage:
     43    gprint (GP_ERR, "USAGE: delete job (JobID)\n");
     44    gprint (GP_ERR, "USAGE: delete task (TaskName)\n");
     45    return (FALSE);
    1646}
    1747
  • trunk/Ohana/src/opihi/pantasks/kill.c

    r7917 r13542  
    1313
    1414  job = FindJob (JobID);
     15  if (job == NULL) {
     16    gprint (GP_LOG, "job not found\n");
     17    return (TRUE);
     18  }
    1519
    1620  if (job[0].mode == JOB_LOCAL) {
     
    2731    }
    2832  }   
    29    
    30   gprint (GP_ERR, "this function is not yet implemented\n");
     33  DeleteJob (job);
     34  gprint (GP_LOG, "job removed\n");
    3135  return (TRUE);
    3236}
Note: See TracChangeset for help on using the changeset viewer.