1 | <?php |
||
25 | |||
26 | class QueueWorkBatchCommand extends WorkCommand |
||
27 | { |
||
28 | protected $name = 'queue:work-batch'; |
||
29 | |||
30 | protected $description = 'Run a Job for the AWS Batch queue'; |
||
31 | |||
32 | protected $signature = 'queue:work-batch |
||
33 | {job_id : The job id in the database} |
||
34 | {connection? : The name of the queue connection to work} |
||
35 | {--memory=128 : The memory limit in megabytes} |
||
36 | {--timeout=60 : The number of seconds a child process can run} |
||
37 | {--tries=0 : Number of times to attempt a job before logging it failed} |
||
38 | {--force : Force the worker to run even in maintenance mode} |
||
39 | {--queue= : The names of the queues to work} |
||
40 | {--once : Only process the next job on the queue} |
||
41 | {--stop-when-empty : Stop when the queue is empty}'; |
||
42 | |||
43 | |||
44 | protected $manager; |
||
45 | protected $exceptions; |
||
46 | |||
47 | public function __construct(QueueManager $manager, Worker $worker, Handler $exceptions) |
||
52 | } |
||
53 | |||
54 | public function fire() |
||
55 | { |
||
56 | $this->listenForEvents(); |
||
57 | |||
58 | try { |
||
59 | $this->runJob(); |
||
60 | } catch (\Exception $e) { |
||
61 | $this->exceptions->report($e); |
||
62 | throw $e; |
||
63 | } catch (\Throwable $e) { |
||
64 | $this->exceptions->report(new FatalThrowableError($e)); |
||
|
|||
65 | throw $e; |
||
66 | } |
||
67 | } |
||
68 | |||
69 | // TOOD: Refactor out the logic here into an extension of the Worker class |
||
70 | protected function runJob() |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * Gather all of the queue worker options as a single object. |
||
100 | * |
||
101 | * @return \Illuminate\Queue\WorkerOptions |
||
102 | */ |
||
103 | protected function gatherWorkerOptions() |
||
104 | { |
||
105 | return new WorkerOptions( |
||
106 | 0, |
||
107 | $this->option('memory'), |
||
115 |