aboutsummaryrefslogtreecommitdiff
path: root/src/classes/Job.php
blob: 4ecbf6c89a48f93560d73505ce534212cba83e33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

abstract class Job extends model {

    // ENUM status
    const STATUS_WAITING = 'waiting';
    const STATUS_MANUAL = 'manual';
    const STATUS_ACCEPTED = 'accepted';
    const STATUS_IGNORED = 'ignored';
    const STATUS_RUNNING = 'running';
    const STATUS_DONE = 'done';

    // ENUM result
    const RESULT_OK = 'ok';
    const RESULT_FAIL = 'fail';

    const DB_TABLE = 'jobs';

    protected static $Fields = [
        'id' => model::INTEGER,
        'target' => model::STRING,
        'name' => model::STRING,
        'time_created' => model::INTEGER,
        'time_started' => model::INTEGER,
        'time_finished' => model::INTEGER,
        'status' => model::STRING, // ENUM
        'result' => model::STRING, // ENUM
        'return_code' => model::INTEGER,
        'sig' => model::STRING,
        'stdout' => model::STRING,
        'stderr' => model::STRING,
        'input' => model::SERIALIZED,
    ];

    public $id;
    public $target;
    public $name;
    public $timeCreated;
    public $timeStarted;
    public $timeFinished;
    public $status;
    public $result;
    public $returnCode;
    public $sig;
    public $stdout;
    public $stderr;
    public $input;

    abstract public function run();

}