View Issue Details

IDProjectCategoryView StatusLast Update
0000553bareos-coreapipublic2019-12-18 15:25
Reporterjoergs Assigned Tojoergs  
PrioritylowSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Fixed in Version16.1.0 
Summary0000553: Expose additional JobStatus information to external programs
DescriptionThe JobStatus is a character between "a"-"z" and "A"-"Z". 26 (?) characters are used.

Each job is stored in the database Job table and has a JobStatus assigned to it.

Current status:
The interpretation of the JobStatus is done in different places in the bareos-director code.
External programs need to interpret the status in their own code.
This could lead to different interpretations of the JobStatus.

Occurances in the code:

* src/include/jcr.h
#define JS_Canceled 'A' /* Canceled by user */
...

#define job_terminated_successfully(jcr)
#define job_canceled(jcr)
#define job_waiting(jcr)

In a lot of the SQL commands (src/cats/*.c):
    WHERE JobStatus IN ('T','W')
    WHERE JobStatus IN ('T','W','f','A','E')

src/dird/ua_cmds.c:wait_cmd(UAContext *ua, const char *cmd)
    defines ExitStatus between 0-3
    uses and outputs job_status_to_str(int stat)

database table "Status" defines:
   JobStatus CHAR(1) NOT NULL,
   JobStatusLong BLOB,
   Severity INTEGER,
Only used by bat (?).

Also:
src/lib/util.c:
void jobstatus_to_ascii(int JobStatus, char *msg, int maxlen)
    called from 8 places
void jobstatus_to_ascii_gui(int JobStatus, char *msg, int maxlen)
    with fallback to jobstatus_to_ascii
    called from 3 places (only from qt-console)
const char *job_status_to_str(int stat)
    (handles only a subset of JobStatus)
    only called from src/dird/ua_cmds.c:wait_cmd(UAContext *ua, const char *cmd)

Wishlist:
Have a unified handling of interpreting JobStatus.
* expose JobStatus information to external programs
* devide in JobStatus classes:
    - running (all, otherwise it would not be in the database Job table)
      - running and waiting (is the waiting information relevant for searches? If not, it might be enough to show the long desciption of a JobStatus)
    - terminated
      - ok
      - warnings
      - errors
* get JobStatus description from external programs
* get JobStatus description for deferent language settings
* bcommnd: extend "llist jobs" by option: minjobexitstatus=<Ok|Warning|Error>]

Approaches:
* add bcommand: .jobstatus [=<jobstatus>] [=lang=<languagesettings>]
  * return json structure with:
    * JobStatus
    * JobStatusLong
    * JobStatusLong according language
    * Severity
    * JobStatusExitLevel (NULL, Ok, Warning, Error)
    * JobExitStatusLevel (NULL, 0, 1, 2)
  * this could be done without extending the database table "Status"
* extend bcommand llist jobs output by join with "Status" table with columns:
  * Status.JobStatusLong (?)
  * Status.JobExitStatusLevel (?)
  * JobExitStatus: (NULL, Ok, Warning, Error)
TagsNo tags attached.

Issue History

Date Modified Username Field Change
2015-11-06 12:19 joergs New Issue
2015-11-06 12:19 joergs Status new => assigned
2015-11-06 12:19 joergs Assigned To => joergs
2016-03-10 15:17 joergs Note Added: 0002208
2016-03-10 15:17 joergs Status assigned => resolved
2016-03-10 15:17 joergs Fixed in Version => 16.1.0
2016-03-10 15:17 joergs Resolution open => fixed
2019-12-18 15:25 arogge Status resolved => closed