Clover icon

Coverage Report

  1. Project Clover database Thu Dec 4 2025 14:43:25 GMT
  2. Package jalview.ws2.api

File JobStatus.java

 

Coverage histogram

../../../img/srcFileCovDistChart8.png
20% of files have more coverage

Code metrics

0
16
1
1
75
49
12
0.75
16
1
12

Classes

Class Line # Actions
JobStatus 3 16 12
0.764705976.5%
 

Contributing tests

This file is covered by 30 tests. .

Source view

1    package jalview.ws2.api;
2   
 
3    public enum JobStatus
4    {
5    /** Initial status before the job is started. */
6    CREATED,
7    /** Job has invalid inputs and cannot be started. */
8    INVALID,
9    /** Job is created and ready for submission. */
10    READY,
11    /** Job has been submitted and awaits processing. */
12    SUBMITTED,
13    /** Job has been queued for execution */
14    QUEUED,
15    /** Job is running */
16    RUNNING,
17    /** Job has completed successfully. */
18    COMPLETED,
19    /** Job has finished with errors. */
20    FAILED,
21    /** Job has been cancelled by the user. */
22    CANCELLED,
23    /** Job cannot be processed due to server error. */
24    SERVER_ERROR,
25    /** Job status cannot be determined. */
26    UNKNOWN;
27   
28    /**
29    * Returns true if the status corresponds to the job completed due to normal
30    * termination, error or cancellation.
31    *
32    * @return {@value true} if status corresponds to a finished job.
33    */
 
34  135 toggle public boolean isDone()
35    {
36  134 switch (this)
37    {
38  0 case INVALID:
39  46 case COMPLETED:
40  4 case FAILED:
41  4 case CANCELLED:
42  4 case SERVER_ERROR:
43  58 return true;
44  26 case CREATED:
45  0 case READY:
46  35 case SUBMITTED:
47  6 case QUEUED:
48  6 case RUNNING:
49  6 case UNKNOWN:
50  75 return false;
51  0 default:
52  0 throw new AssertionError("non-exhaustive switch statement");
53    }
54    }
55   
56    /**
57    * A precedence order of job statuses used to compute the overall task status.
58    */
59    public static final JobStatus[] statusPrecedence = {
60    JobStatus.INVALID, // all must be invalid for task to be invalid
61    JobStatus.COMPLETED, // all but invalid must be completed for task to be
62    // completed
63    JobStatus.UNKNOWN, // unknown prevents successful completion but not
64    // running or failure
65    JobStatus.READY,
66    JobStatus.CREATED,
67    JobStatus.SUBMITTED,
68    JobStatus.QUEUED,
69    JobStatus.RUNNING,
70    JobStatus.CANCELLED, // if any is terminated unsuccessfully, the task is
71    // failed
72    JobStatus.FAILED,
73    JobStatus.SERVER_ERROR
74    };
75    }