Panoptes/JobQueue.pm untested

filter: Statementstmt 0.0% 0 / 295 Branchbran 0.0% 0 / 70 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 420 CC 36 SCAR 44.1
CC
36
Cov
0%
rm_job_queue
132.0
rm_job_queue_count
132.0
rm_job_history
56.0
CRAP 82.2
1 package Helios::Panoptes::JobQueue;
2  
3 use 5.008;
4 use strict;
5 use warnings;
6 use base 'Helios::Panoptes::Base';
7  
8 use CGI::Application::Plugin::DBH qw(dbh_config dbh);
9  
10 our $VERSION = '1.51_2830';
11  
12 sub setup {
13 my $self = shift;
14 $self->start_mode('dispatcher');
15 $self->mode_param('rm');
16 $self->run_modes(
17 dispatcher => 'rm_dispatcher',
18 job_queue => 'rm_job_queue',
19 job_queue_count => 'rm_job_queue_count',
20 job_history => 'rm_job_history',
21 job_history_count => 'rm_job_history_count'
22 );
23 my $config = $self->parseConfig();
24
25 # connect to db
26 $self->dbh_config($config->{dsn},$config->{user},$config->{password});
27 }
28  
29 =head2 rm_dispatcher()
30  
31 =cut
32  
33 sub rm_dispatcher {
34 my $self = shift;
35 my $q = $self->query();
36 if ( $q->param('status') eq 'done') {
37 if ( $q->param('job_detail') ) {
38 return $self->rm_job_history();
39 } else {
40 return $self->rm_job_history_count();
41 }
42 } else {
43 if ( $q->param('job_detail') ) {
44 return $self->rm_job_queue();
45 } else {
46 return $self->rm_job_queue_count();
47 }
48 }
49 }
50  
51  
52 =head2 rm_job_queue()
53  
54 =cut
55  
56 sub rm_job_queue {
57 my $self = shift;
58 my $q = $self->query();
59 my $job_detail = $q->param('job_detail');
60  
61 my $dbh = $self->dbh();
62 my $now = time();
63 my %funcmap = $self->getFuncmapByFuncid();
64 my $output;
65 my $sql;
66 my @where_clauses;
67 my @plhdr_values;
68  
69 # defaults
70  
71 $sql = <<ACTIVEJOBSQL;
72 SELECT funcid,
73 jobid,
74 uniqkey,
75 insert_time,
76 run_after,
77 grabbed_until,
78 priority,
79 coalesce
80 FROM
81 job j
82 ACTIVEJOBSQL
83  
84 # form values
85 my $form_thorizon = defined($q->param('time')) ? $q->param('time') : 300;
86 my $form_status = defined($q->param('status')) ? $q->param('status') : 'run';
87 my $form_detail = defined($q->param('job_detail')) ? $q->param('job_detail') : 1;
88  
89 # sanity checks
90 if ( $form_thorizon =~ /\D/ ) { $form_thorizon = 300; }
91 unless ( length($form_status) < 5 && ($form_status eq 'run' || $form_status eq 'wait' || $form_status eq 'done') ) {
92 $form_status = 'run';
93 }
94  
95 SWITCH: {
96 if ($form_status eq 'run') {
97 push(@where_clauses,"grabbed_until != 0");
98 $form_thorizon = 0;
99 last SWITCH;
100 }
101 if ($form_status eq 'wait') {
102 push(@where_clauses,"run_after < ?");
103 push(@plhdr_values, $now);
104 push(@where_clauses,"grabbed_until < ?");
105 push(@plhdr_values, $now);
106 last SWITCH;
107 }
108 $form_thorizon = 0;
109 }
110  
111 # time horizon filter
112 #[]?
113 # if ( $form_thorizon ) {
114 # push(@where_clauses, "run_after > ?");
115 # push(@plhdr_values, $now - $form_thorizon);
116 # }
117  
118 # complete WHERE
119 if (scalar(@where_clauses)) {
120 $sql .= " WHERE ". join(' AND ',@where_clauses);
121 }
122  
123 # ORDER BY
124 $sql .= " ORDER BY funcid asc, run_after desc";
125  
126 #t print $q->header();
127 #t print $sql;
128  
129 my $sth = $dbh->prepare_cached($sql);
130 $sth->execute(@plhdr_values);
131  
132 # BEGIN CODE Copyright (C) 2008-9 by CEB Toolbox, Inc.
133  
134 # These methods have been modified from the original code extracted from
135 # Helios::Panoptes 1.44 to better fit operation in H::P 1.5x.
136  
137 my @job_types;
138 my $job_count = 0;
139 my @dbresult;
140 my $current_job_class;
141 my $first_result = 1;
142 my $last_class = undef;
143 while ( my $result = $sth->fetchrow_arrayref() ) {
144 if ($first_result) {
145 $last_class = $result->[0];
146 $first_result = 0;
147 }
148 if ($result->[0] ne $last_class) {
149 push(@job_types, $current_job_class);
150 undef $current_job_class;
151 $last_class = $result->[0];
152 $job_count = 0;
153 }
154
155 my $insert_time = $self->parseEpochDate($result->[3]);
156 my $run_after = $self->parseEpochDate($result->[4]);
157 my $grabbed_until = $self->parseEpochDate($result->[5]);
158 $current_job_class->{JOB_CLASS} = $funcmap{$result->[0]};
159 $current_job_class->{JOB_COUNT} = ++$job_count;
160 push(@{ $current_job_class->{JOBS} },
161 { JOBID => $result->[1],
162 UNIQKEY => $result->[2],
163 INSERT_TIME => $insert_time->{yyyy} .'-'.$insert_time->{mm} .'-'.$insert_time->{dd} .' '.$insert_time->{hh} .':'.$insert_time->{mi} .':'.$insert_time->{ss},
164 RUN_AFTER => $run_after->{yyyy} .'-'.$run_after->{mm} .'-'.$run_after->{dd} .' '.$run_after->{hh} .':'.$run_after->{mi} .':'.$run_after->{ss},
165 GRABBED_UNTIL => $grabbed_until->{yyyy}.'-'.$grabbed_until->{mm}.'-'.$grabbed_until->{dd}.' '.$grabbed_until->{hh}.':'.$grabbed_until->{mi}.':'.$grabbed_until->{ss},
166 PRIORITY => $result->[6],
167 COALESCE => $result->[7]
168 });
169 }
170 push(@job_types, $current_job_class);
171  
172 # END CODE Copyright CEB Toolbox, Inc.
173  
174 # (re)create form
175 my $time_list = $q->popup_menu(
176 -name => 'time',
177 -values => ['0', '60', '300', '900', '1800', '3600', '7200', '14400', '28800', '57600', '86400', '172800', '259200', '640800'],
178 -labels => {
179 '0' => 'All',
180 '60' => '1 Minute',
181 '300' => '5 Minutes',
182 '900' => '15 Minutes',
183 '1800' => '30 Minutes',
184 '3600' => '1 Hour',
185 '7200' => '2 Hours',
186 '14400' => '4 Hours',
187 '28800' => '8 Hours',
188 '57600' => '16 Hours',
189 '86400' => '1 Day',
190 '172800' => '2 Days',
191 '259200' => '3 Days',
192 '640800' => '1 Week'
193 },
194 -default => "$form_thorizon"
195 );
196
197 my $status_list = $q->popup_menu(
198 -name => 'status',
199 -values => ['run', 'wait', 'done'],
200 -labels => { 'run' => 'Running Jobs', 'wait' => 'Waiting Jobs', 'done' => 'Completed Jobs'},
201 -default => $form_status
202 );
203  
204 my $tmpl = $self->load_tmpl('jobmanager.html', die_on_bad_params => 0);
205 $tmpl->param(TITLE => "Helios - Job Queue");
206 $tmpl->param(STATUS_LIST => $status_list);
207 $tmpl->param(TIME_LIST => $time_list);
208 $tmpl->param(JOB_DETAIL_CHECKED => 1);
209 $tmpl->param(JOB_CLASSES => \@job_types);
210 return $tmpl->output();
211 }
212  
213 =head2 rm_job_queue_count()
214  
215 This method will handle a job queue view that displays only counts.
216  
217 =cut
218  
219 sub rm_job_queue_count {
220 my $self = shift;
221 my $q = $self->query();
222 my $job_status = $q->param('status');
223  
224 my $dbh = $self->dbh();
225 my $now = time();
226 my %funcmap = $self->getFuncmapByFuncid();
227 my $output;
228 my $sql;
229 my @where_clauses;
230 my @plhdr_values;
231  
232 $sql = "SELECT funcid, count(*) FROM job ";
233  
234 my $form_thorizon = defined($q->param('time')) ? $q->param('time') : 300;
235 my $form_status = defined($q->param('status')) ? $q->param('status') : 'run';
236 my $form_detail = defined($q->param('detail')) ? $q->param('detail') : 0;
237  
238 # sanity checks
239 if ( $form_thorizon =~ /\D/ ) { $form_thorizon = 300; }
240 unless ( length($form_status) < 5 && ($form_status eq 'run' || $form_status eq 'wait' || $form_status eq 'done') ) {
241 $form_status = 'run';
242 }
243  
244 SWITCH: {
245 if ($form_status eq 'run') {
246 push(@where_clauses,"grabbed_until != 0");
247 $form_thorizon = 0;
248 last SWITCH;
249 }
250 if ($form_status eq 'wait') {
251 push(@where_clauses,"run_after < ?");
252 push(@plhdr_values, $now);
253 push(@where_clauses,"grabbed_until < ?");
254 push(@plhdr_values, $now);
255 last SWITCH;
256 }
257 $form_thorizon = 0;
258 }
259  
260 # time horizon filter
261 #[]
262 # if ( $form_thorizon ) {
263 # push(@where_clauses, "run_after > ?");
264 # push(@plhdr_values, $now - $form_thorizon);
265 # }
266  
267 # complete WHERE
268 if (scalar(@where_clauses)) {
269 $sql .= " WHERE ". join(' AND ',@where_clauses);
270 }
271  
272 # GROUP BY
273 $sql .= " GROUP BY funcid ";
274 # ORDER BY
275 $sql .= " ORDER BY funcid asc";
276  
277 #t print $q->header();
278 #t print $sql;
279  
280 my $sth = $dbh->prepare_cached($sql);
281 $sth->execute(@plhdr_values);
282  
283 my @job_types;
284 my $job_count = 0;
285 my @dbresult;
286 my $current_job_class;
287 my $first_result = 1;
288 my $last_class = undef;
289 while ( my $result = $sth->fetchrow_arrayref() ) {
290 if ($first_result) {
291 $last_class = $result->[0];
292 $first_result = 0;
293 }
294 if ($result->[0] ne $last_class) {
295 push(@job_types, $current_job_class);
296 undef $current_job_class;
297 $last_class = $result->[0];
298 $job_count = 0;
299 }
300
301 $current_job_class->{JOB_CLASS} = $funcmap{$result->[0]};
302 $current_job_class->{JOB_COUNT} = $result->[1];
303 }
304 push(@job_types, $current_job_class);
305  
306 # (re)create form
307 my $time_list = $q->popup_menu(
308 -name => 'time',
309 -values => [0, 60, 300, 900, 1800, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 259200, 640800],
310 -labels => {
311 0 => 'All',
312 60 => '1 Minute',
313 300 => '5 Minutes',
314 900 => '15 Minutes',
315 1800 => '30 Minutes',
316 3600 => '1 Hour',
317 7200 => '2 Hours',
318 14400 => '4 Hours',
319 28800 => '8 Hours',
320 57600 => '16 Hours',
321 86400 => '1 Day',
322 172800 => '2 Days',
323 259200 => '3 Days',
324 640800 => '1 Week'
325 },
326 -default => $form_thorizon
327 );
328
329 my $status_list = $q->popup_menu(
330 -name => 'status',
331 -values => ['run', 'wait', 'done'],
332 -labels => { 'run' => 'Running Jobs', 'wait' => 'Waiting Jobs', 'done' => 'Completed Jobs'},
333 -default => $form_status
334 );
335  
336 my $tmpl = $self->load_tmpl('jobmanager.html', die_on_bad_params => 0);
337 $tmpl->param(TITLE => "Helios - Job Queue");
338 $tmpl->param(STATUS_LIST => $status_list);
339 $tmpl->param(TIME_LIST => $time_list);
340 $tmpl->param(JOB_DETAIL_CHECKED => 0);
341 $tmpl->param(JOB_CLASSES => \@job_types);
342 return $tmpl->output();
343 }
344  
345  
346  
347  
348 =head2 rm_job_history()
349  
350 =cut
351  
352 sub rm_job_history {
353 my $self = shift;
354 my $q = $self->query();
355 my $config = $self->getConfig();
356 my $dbh = $self->dbh();
357 my $now = time();
358 my %funcmap = $self->getFuncmapByFuncid();
359 my $job_status;
360 my $output;
361 my $sql;
362 my @where_clauses;
363  
364 my $form_thorizon;
365  
366 # this is where it gets tricky...
367 if ( $config->{dsn} =~ /\:oracle/i ) {
368 # you're using Oracle! Big collective you've got there!
369 # need a consultant to help you out? Contact me! :)
370 $sql = q{
371 SELECT rank, jobid, funcid, run_after, grabbed_until, exitstatus, complete_time
372 FROM (
373 SELECT
374 jobid,
375 funcid,
376 run_after,
377 grabbed_until,
378 exitstatus,
379 complete_time,
380 RANK() OVER (PARTITION BY jobid ORDER BY complete_time DESC) AS rank
381 FROM
382 helios_job_history_tb
383 WHERE
384 complete_time >= ?
385 ORDER BY jobid, complete_time DESC
386 )
387 WHERE rank < 2
388 ORDER BY funcid ASC, complete_time DESC
389 };
390 } else {
391 # we'll default to MySQL
392
393 $sql = q{
394 select *
395 from (select
396 if (@jid = jobid,
397 if (@time = complete_time,
398 @rnk := @rnk + least(0, @inc := @inc + 1),
399 @rnk := @rnk + greatest(@inc, @inc := 1)
400 + least(0, @time := complete_time)
401 ),
402 @rnk := 1 + least(0, @jid := jobid)
403 + least(0, @time := complete_time)
404 + least(0, @inc := 1)
405 ) rank,
406 jobid,
407 funcid,
408 run_after,
409 grabbed_until,
410 exitstatus,
411 complete_time
412 from helios_job_history_tb,
413 (select (@jid := 0)) as x
414 where complete_time >= ?
415 order by jobid, complete_time desc
416 ) as y
417 where rank < 2
418 order by funcid asc, complete_time desc
419 };
420 }
421  
422 # form values
423 if ( defined($q->param('time')) ) {
424 if ( $q->param('time') =~ /\D/ || !($q->param('time')) ) {
425 $form_thorizon = 300;
426 } else {
427 $form_thorizon = $q->param('time');
428 }
429 }
430  
431 my $sth = $dbh->prepare_cached($sql);
432 $sth->execute($now - $form_thorizon);
433
434 my @job_types;
435 my $job_count = 0;
436 my $job_count_failed = 0;
437 my @dbresult;
438 my $current_job_class;
439 my $first_result = 1;
440 my $last_class = undef;
441 my $last_jobid = 0;
442 while ( my $result = $sth->fetchrow_arrayref() ) {
443 # print join("|",($result->[0],$result->[1],$result->[2],$result->[3],$result->[4],$result->[5],$result->[6],$result->[7])),"<br>\n"; #p
444 if ($first_result) {
445 $last_class = $result->[2];
446 $first_result = 0;
447 }
448 if ($result->[2] ne $last_class) {
449 push(@job_types, $current_job_class);
450 undef $current_job_class;
451 $last_class = $result->[2];
452 $job_count = 0;
453 $job_count_failed = 0;
454 }
455
456 my $run_after = $self->parseEpochDate($result->[3]);
457 my $grabbed_until = $self->parseEpochDate($result->[4]);
458 my $complete_time = $self->parseEpochDate($result->[6]);
459 $current_job_class->{JOB_CLASS} = $funcmap{$result->[2]};
460 $current_job_class->{JOB_COUNT} = ++$job_count;
461 if ( $result->[5] != 0 ) { $current_job_class->{JOB_COUNT_FAILED} = ++$job_count_failed; }
462 # if this jobid is the same as the last, that means it was a failure that was retried
463 # dump it, because we've already added the final completion of the job (whether success or fail)
464 # because we sorted "jobid, complete_time desc"
465 push(@{ $current_job_class->{JOBS} },
466 { JOBID => $result->[1],
467 RUN_AFTER => $run_after->{yyyy} .'-'.$run_after->{mm} .'-'.$run_after->{dd} .' '.$run_after->{hh} .':'.$run_after->{mi} .':'.$run_after->{ss},
468 GRABBED_UNTIL => $grabbed_until->{yyyy}.'-'.$grabbed_until->{mm}.'-'.$grabbed_until->{dd}.' '.$grabbed_until->{hh}.':'.$grabbed_until->{mi}.':'.$grabbed_until->{ss},
469 COMPLETE_TIME => $complete_time->{yyyy}.'-'.$complete_time->{mm}.'-'.$complete_time->{dd}.' '.$complete_time->{hh}.':'.$complete_time->{mi}.':'.$complete_time->{ss},
470 EXITSTATUS => $result->[5]
471 });
472 $last_jobid = $result->[1];
473 }
474 push(@job_types, $current_job_class);
475 @job_types = sort { $a->{JOB_CLASS} cmp $b->{JOB_CLASS} } @job_types;
476  
477  
478 # (re)create form
479 my $time_list = $q->popup_menu(
480 -name => 'time',
481 -values => ['0','60', '300', '900', '1800', '3600', '7200', '14400', '28800', '57600', '86400', '172800', '259200', '640800'],
482 -labels => {
483 '0' => 'All',
484 '60' => '1 Minute',
485 '300' => '5 Minutes',
486 '900' => '15 Minutes',
487 '1800' => '30 Minutes',
488 '3600' => '1 Hour',
489 '7200' => '2 Hours',
490 '14400' => '4 Hours',
491 '28800' => '8 Hours',
492 '57600' => '16 Hours',
493 '86400' => '1 Day',
494 '172800' => '2 Days',
495 '259200' => '3 Days',
496 '640800' => '1 Week'
497 },
498 -default => '300'
499 );
500
501 my $status_list = $q->popup_menu(
502 -name => 'status',
503 -values => ['run', 'wait', 'done'],
504 -labels => { 'run' => 'Running Jobs', 'wait' => 'Waiting Jobs', 'done' => 'Completed Jobs'},
505 -default => 'done'
506 );
507  
508 #t
509 #print $q->header('text/plain');
510 #print $sql,"\n";
511 #print $form_thorizon,"\n";
512 #print $time_list,"\n";
513  
514  
515 my $tmpl = $self->load_tmpl('jobmanager.html', die_on_bad_params => 0);
516 $tmpl->param(TITLE => 'Helios - Job History');
517 $tmpl->param(STATUS_LIST => $status_list);
518 $tmpl->param(TIME_LIST => $time_list);
519 $tmpl->param(JOB_DETAIL_CHECKED => 1);
520 $tmpl->param(JOB_CLASSES => \@job_types);
521 return $tmpl->output();
522 }
523  
524  
525 =head2 rm_job_history_count()
526  
527 =cut
528  
529 sub rm_job_history_count {
530 my $self = shift;
531 my $q = $self->query;
532 my $config = $self->getConfig();
533 my $dbh = $self->dbh();
534 my $now = time();
535 my %funcmap = $self->getFuncmapByFuncid();
536 my $job_status;
537 my $output;
538 my $sql;
539 my @where_clauses;
540  
541 my $form_thorizon;
542 my $form_status;
543  
544 if ( $config->{dsn} =~ /\:oracle/i) {
545 $sql = q{
546 SELECT funcid, exitstatus, count(*)
547 FROM (
548 SELECT
549 jobid,
550 funcid,
551 exitstatus,
552 complete_time,
553 RANK() OVER (PARTITION BY jobid ORDER BY complete_time DESC) AS rank
554 FROM
555 helios_job_history_tb
556 WHERE
557 complete_time >= ?
558 ORDER BY jobid, complete_time DESC
559 )
560 WHERE rank < 2
561 GROUP BY funcid, exitstatus
562 };
563 } else {
564 # default db is MySQL
565  
566 $sql = q{
567 select funcid, if(exitstatus,1,0) as exitstatus, count(*) as count
568 from (select
569 if (@jid = jobid,
570 if (@time = complete_time,
571 @rnk := @rnk + least(0, @inc := @inc + 1),
572 @rnk := @rnk + greatest(@inc, @inc := 1)
573 + least(0, @time := complete_time)
574 ),
575 @rnk := 1 + least(0, @jid := jobid)
576 + least(0, @time := complete_time)
577 + least(0, @inc := 1)
578 ) rank,
579 jobid,
580 funcid,
581 run_after,
582 exitstatus,
583 complete_time
584 from helios_job_history_tb,
585 (select (@jid := 0)) as x
586 where complete_time >= ?
587 order by jobid, complete_time desc
588 ) as y
589 where rank < 2
590 GROUP BY funcid, if(exitstatus,1,0)
591 };
592  
593 }
594  
595 # form values
596 if ( defined($q->param('time')) ) {
597 if ( $q->param('time') =~ /\D/ || !($q->param('time')) ) {
598 $form_thorizon = 300;
599 } else {
600 $form_thorizon = $q->param('time');
601 }
602 }
603  
604 #t print $q->header();
605 #t print $sql,"<br>\n";
606 #t print $now - $time_horizon,"<br>\n";
607  
608 my $sth = $dbh->prepare_cached($sql);
609 $sth->execute($now - $form_thorizon);
610  
611 my @job_types;
612 my $current_funcid;
613 my $current_success_jobs = 0;
614 my $current_failed_jobs = 0;
615 my $last_funcid;
616 my $first_result = 1;
617  
618 while ( my $result = $sth->fetchrow_arrayref() ) {
619 # print join("|",@$result),"<br>\n"; #p
620 if ($first_result) {
621 $last_funcid = $result->[0];
622 $current_funcid = $result->[0];
623 $first_result = 0;
624 }
625  
626 if ($current_funcid ne $result->[0] ) {
627 # flush
628 push(@job_types,
629 {
630 JOB_CLASS => $funcmap{$current_funcid},
631 JOB_COUNT => $current_success_jobs + $current_failed_jobs,
632 JOB_COUNT_FAILED => $current_failed_jobs
633 }
634 );
635 $last_funcid = $result->[0];
636 $current_success_jobs = 0;
637 $current_failed_jobs = 0;
638 }
639 $current_funcid = $result->[0];
640 if ($result->[1] == 0) {
641 $current_success_jobs = $result->[2];
642 } else {
643 $current_failed_jobs = $result->[2];
644 }
645 }
646 push(@job_types,
647 {
648 JOB_CLASS => $funcmap{$current_funcid},
649 JOB_COUNT => $current_success_jobs + $current_failed_jobs,
650 JOB_COUNT_FAILED => $current_failed_jobs
651 }
652 );
653 @job_types = sort { $a->{JOB_CLASS} cmp $b->{JOB_CLASS} } @job_types;
654  
655 # (re)create form
656 my $time_list = $q->popup_menu(
657 -name => 'time',
658 -values => [0, 60, 300, 900, 1800, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 259200, 640800],
659 -labels => {
660 0 => 'All',
661 60 => '1 Minute',
662 300 => '5 Minutes',
663 900 => '15 Minutes',
664 1800 => '30 Minutes',
665 3600 => '1 Hour',
666 7200 => '2 Hours',
667 14400 => '4 Hours',
668 28800 => '8 Hours',
669 57600 => '16 Hours',
670 86400 => '1 Day',
671 172800 => '2 Days',
672 259200 => '3 Days',
673 640800 => '1 Week'
674 },
675 -default => $form_thorizon
676 );
677
678 my $status_list = $q->popup_menu(
679 -name => 'status',
680 -values => ['run', 'wait', 'done'],
681 -labels => { 'run' => 'Running Jobs', 'wait' => 'Waiting Jobs', 'done' => 'Completed Jobs'},
682 -default => 'done'
683 );
684  
685 my $tmpl = $self->load_tmpl('jobmanager.html', die_on_bad_params => 0);
686 $tmpl->param(TITLE => 'Helios - Job History');
687 $tmpl->param(STATUS_LIST => $status_list);
688 $tmpl->param(TIME_LIST => $time_list);
689 $tmpl->param(JOB_DETAIL_CHECKED => 0);
690 $tmpl->param(JOB_CLASSES => \@job_types);
691 return $tmpl->output();
692 }
693  
694  
695  
696 1;
697 __END__