1 | <?php |
||
14 | class JobEntity implements JobEntityInterface |
||
15 | { |
||
16 | public $name = ''; |
||
17 | |||
18 | public $command = ''; |
||
19 | |||
20 | public $description = ''; |
||
21 | |||
22 | public $owner = ''; |
||
23 | |||
24 | public $ownerName = ''; |
||
25 | |||
26 | public $schedule = ''; // todo: move to separate entity |
||
27 | |||
28 | public $scheduleTimeZone = ''; |
||
29 | |||
30 | public $parents = []; // todo: move to separate entity |
||
31 | |||
32 | public $epsilon = ''; |
||
33 | |||
34 | public $executor = ''; |
||
35 | |||
36 | public $executorFlags = ''; |
||
37 | |||
38 | public $shell = true; |
||
39 | |||
40 | public $retries = 0; |
||
41 | |||
42 | public $async = false; |
||
43 | |||
44 | public $successCount = 0; |
||
45 | |||
46 | public $errorCount = 0; |
||
47 | |||
48 | public $errorsSinceLastSuccess = 0; |
||
49 | |||
50 | public $lastSuccess = ''; |
||
51 | |||
52 | public $lastError = ''; |
||
53 | |||
54 | public $cpus = 0.1; |
||
55 | |||
56 | public $disk = 24; |
||
57 | |||
58 | public $mem = 32; |
||
59 | |||
60 | public $disabled = false; |
||
61 | |||
62 | public $softError = false; |
||
63 | |||
64 | public $dataProcessingJobType = false; |
||
65 | |||
66 | public $uris = []; |
||
67 | |||
68 | public $environmentVariables = []; |
||
69 | |||
70 | public $arguments = []; |
||
71 | |||
72 | public $highPriority = false; |
||
73 | |||
74 | public $runAsUser = 'root'; |
||
75 | |||
76 | public $constraints = []; |
||
77 | |||
78 | /** @var ContainerEntity */ |
||
79 | public $container = null; |
||
80 | |||
81 | |||
82 | /** |
||
83 | * @param array|object $mJobData |
||
84 | * @throws \InvalidArgumentException |
||
85 | */ |
||
86 | 87 | public function __construct($mJobData = []) |
|
87 | { |
||
88 | 87 | if (is_array($mJobData) || is_object($mJobData)) |
|
89 | 87 | { |
|
90 | 86 | foreach ($mJobData as $_sKey => $_mValue) |
|
91 | { |
||
92 | 16 | if (property_exists($this, $_sKey)) |
|
93 | 16 | { |
|
94 | 16 | if ($_sKey == 'container') |
|
95 | 16 | { |
|
96 | 2 | $this->{$_sKey} = new ContainerEntity($_mValue); |
|
97 | 1 | } |
|
98 | else |
||
99 | { |
||
100 | 16 | $this->{$_sKey} = $_mValue; |
|
101 | } |
||
102 | 16 | } |
|
103 | 86 | } |
|
104 | 85 | } |
|
105 | else |
||
106 | { |
||
107 | 1 | throw new \InvalidArgumentException(sprintf('Argument 1 passed to "%s" must be an array or object', __METHOD__)); |
|
108 | } |
||
109 | 85 | } |
|
110 | |||
111 | /** |
||
112 | * return entity as one-dimensional array |
||
113 | * |
||
114 | * @return mixed[] |
||
115 | */ |
||
116 | 8 | public function getSimpleArrayCopy() |
|
127 | |||
128 | /** |
||
129 | * @return bool |
||
130 | */ |
||
131 | 28 | public function isSchedulingJob() |
|
135 | |||
136 | /** |
||
137 | * @return bool |
||
138 | */ |
||
139 | 7 | public function isDependencyJob() |
|
143 | |||
144 | /** |
||
145 | * @return array |
||
146 | */ |
||
147 | 7 | public function jsonSerialize() |
|
173 | |||
174 | /** |
||
175 | * @return \ArrayIterator |
||
176 | */ |
||
177 | 22 | public function getIterator() |
|
181 | } |
||
182 |