1 /*
2  * JobConstants.java
3  *
4  * Copyright (C) 2021 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant
7  * to the terms of a commercial license agreement with RStudio, then
8  * this program is licensed to you under the terms of version 3 of the
9  * GNU Affero General Public License. This program is distributed WITHOUT
10  * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
12  * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
13  *
14  */
15 package org.rstudio.studio.client.workbench.views.jobs.model;
16 
17 public class JobConstants
18 {
19    // job update types
20    public final static int JOB_ADDED   = 0;
21    public final static int JOB_UPDATED = 1;
22    public final static int JOB_REMOVED = 2;
23 
24    // possible job states
25    public final static int STATE_IDLE      = 1;
26    public final static int STATE_RUNNING   = 2;
27    public final static int STATE_SUCCEEDED = 3;
28    public final static int STATE_CANCELLED = 4;
29    public final static int STATE_FAILED    = 5;
30 
31    // special job actions
32    public final static String ACTION_STOP = "stop";
33    public final static String ACTION_INFO = "info";
34    public final static String ACTION_REPLAY = "replay";
35 
36    // job types
37    public final static int JOB_TYPE_UNKNOWN = 0;
38    public final static int JOB_TYPE_SESSION = 1; // local job, child of rsession
39    public final static int JOB_TYPE_LAUNCHER = 2; // cluster job via job launcher
40 
stateDescription(int state)41    public final static String stateDescription(int state)
42    {
43       switch(state)
44       {
45          case JobConstants.STATE_RUNNING:
46             return "Running";
47          case JobConstants.STATE_IDLE:
48             return "Idle";
49          case JobConstants.STATE_CANCELLED:
50             return "Cancelled";
51          case JobConstants.STATE_FAILED:
52             return "Failed";
53          case JobConstants.STATE_SUCCEEDED:
54             return "Succeeded";
55       }
56       return "Unknown " + state;
57    }
58 }