~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/common/execution_states.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*___INFO__MARK_BEGIN__*/
 
2
/*************************************************************************
 
3
 * 
 
4
 *  The Contents of this file are made available subject to the terms of
 
5
 *  the Sun Industry Standards Source License Version 1.2
 
6
 * 
 
7
 *  Sun Microsystems Inc., March, 2001
 
8
 * 
 
9
 * 
 
10
 *  Sun Industry Standards Source License Version 1.2
 
11
 *  =================================================
 
12
 *  The contents of this file are subject to the Sun Industry Standards
 
13
 *  Source License Version 1.2 (the "License"); You may not use this file
 
14
 *  except in compliance with the License. You may obtain a copy of the
 
15
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
16
 * 
 
17
 *  Software provided under this License is provided on an "AS IS" basis,
 
18
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
19
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
20
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
21
 *  See the License for the specific provisions governing your rights and
 
22
 *  obligations concerning the Software.
 
23
 * 
 
24
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
25
 * 
 
26
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
27
 * 
 
28
 *   All Rights Reserved.
 
29
 * 
 
30
 ************************************************************************/
 
31
/*___INFO__MARK_END__*/
 
32
#include "execution_states.h"
 
33
 
 
34
 
 
35
int shepherd_state = SSTATE_BEFORE_PROLOG;
 
36
pid_t coshepherd_pid = -999;
 
37
/*
 
38
** NAME
 
39
**   get_sstate_description
 
40
** PARAMETER
 
41
**   sstate    -    shepherd exit states
 
42
** RETURN
 
43
**   char *    -    description string
 
44
**                  "invalid execution state" if exit state is unknown
 
45
** EXTERNAL
 
46
**
 
47
** DESCRIPTION
 
48
**   string description of execution exit states
 
49
*/
 
50
char *get_sstate_description(
 
51
int sstate 
 
52
) {
 
53
   int i;
 
54
   static struct _state_message {
 
55
      char *message;
 
56
      int state;
 
57
   } state_message[] = {
 
58
      {"", 0},
 
59
      {"on reading config file", SSTATE_READ_CONFIG},
 
60
      {"setting processor set", SSTATE_PROCSET_NOTSET},
 
61
      {"before prolog", SSTATE_BEFORE_PROLOG},
 
62
      {"in prolog", SSTATE_PROLOG_FAILED},
 
63
      {"before pestart", SSTATE_BEFORE_PESTART},
 
64
      {"in pestart", SSTATE_PESTART_FAILED},
 
65
      {"before job", SSTATE_BEFORE_JOB},
 
66
      {"before pestop", SSTATE_BEFORE_PESTOP},
 
67
      {"in pestop", SSTATE_PESTOP_FAILED},
 
68
      {"before epilog", SSTATE_BEFORE_EPILOG},
 
69
      {"in epilog", SSTATE_EPILOG_FAILED},
 
70
      {"releasing processor set", SSTATE_PROCSET_NOTFREED},
 
71
      {"on executing shepherd", ESSTATE_NO_SHEPHERD},
 
72
      {"before writing config", ESSTATE_NO_CONFIG},
 
73
      {"before writing pid", ESSTATE_NO_PID},
 
74
      {"through signal", ESSTATE_DIED_THRU_SIGNAL},
 
75
      {"shepherd returned error", ESSTATE_SHEPHERD_EXIT},
 
76
      {"before writing exit_status", ESSTATE_NO_EXITSTATUS},
 
77
      {"found unexpected error file", ESSTATE_UNEXP_ERRORFILE},
 
78
      {"in recognizing job", ESSTATE_UNKNOWN_JOB},
 
79
      {"removed manually", ESSTATE_EXECD_LOST_RUNNING},
 
80
      {"assumedly before job", SSTATE_FAILURE_BEFORE_JOB},
 
81
      {"assumedly after job", SSTATE_FAILURE_AFTER_JOB},
 
82
      {"migrating", SSTATE_MIGRATE},
 
83
      {"rescheduling", SSTATE_AGAIN},
 
84
      {"opening input/output file", SSTATE_OPEN_OUTPUT},
 
85
      {"searching requested shell", SSTATE_NO_SHELL},
 
86
      {"changing into working directory", SSTATE_NO_CWD},
 
87
      {"rescheduling on application error", SSTATE_APPERROR},
 
88
      {"accessing sgepasswd file", SSTATE_PASSWD_FILE_ERROR},
 
89
      {"entry is missing in password file", SSTATE_PASSWD_MISSING},
 
90
      {"wrong password", SSTATE_PASSWD_WRONG},
 
91
      {"communicating with Sun Grid Engine Helper Service", SSTATE_HELPER_SERVICE_ERROR},
 
92
      {"before job in Sun Grid Engine Helper Service", SSTATE_HELPER_SERVICE_BEFORE_JOB},
 
93
      {"checking configured daemons", SSTATE_CHECK_DAEMON_CONFIG}
 
94
   };
 
95
 
 
96
   for (i=0; i<sizeof(state_message)/sizeof(struct _state_message); i++) {
 
97
      if (state_message[i].state == sstate) 
 
98
         return state_message[i].message;
 
99
   }   
 
100
   
 
101
   return "invalid execution state";
 
102
}
 
103