|
1
|
|
|
#! /usr/bin/env php |
|
2
|
|
|
|
|
|
|
|
|
|
3
|
|
|
<?php |
|
|
|
|
|
|
4
|
|
|
// This file is part of BOINC. |
|
5
|
|
|
// https://boinc.berkeley.edu |
|
6
|
|
|
// Copyright (C) 2025 University of California |
|
7
|
|
|
// |
|
8
|
|
|
// BOINC is free software; you can redistribute it and/or modify it |
|
9
|
|
|
// under the terms of the GNU Lesser General Public License |
|
10
|
|
|
// as published by the Free Software Foundation, |
|
11
|
|
|
// either version 3 of the License, or (at your option) any later version. |
|
12
|
|
|
// |
|
13
|
|
|
// BOINC is distributed in the hope that it will be useful, |
|
14
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
16
|
|
|
// See the GNU Lesser General Public License for more details. |
|
17
|
|
|
// |
|
18
|
|
|
// You should have received a copy of the GNU Lesser General Public License |
|
19
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>. |
|
20
|
|
|
|
|
21
|
|
|
// delete retired batches with no WUs |
|
22
|
|
|
|
|
23
|
|
|
require_once('../inc/boinc_db.inc'); |
|
24
|
|
|
require_once('../inc/submit_db.inc'); |
|
25
|
|
|
|
|
26
|
|
|
function main() { |
|
27
|
|
|
$batches = BoincBatch::enum(sprintf('state=%d', BATCH_STATE_RETIRED)); |
|
28
|
|
|
foreach ($batches as $batch) { |
|
29
|
|
|
$wus = BoincWorkunit::enum_fields( |
|
30
|
|
|
'id', |
|
31
|
|
|
"batch=$batch->id" |
|
32
|
|
|
); |
|
33
|
|
|
if (!$wus) { |
|
34
|
|
|
echo "deleting batch $batch->id\n"; |
|
35
|
|
|
$batch->delete(); |
|
36
|
|
|
} |
|
37
|
|
|
} |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
// clean up results/. |
|
41
|
|
|
// In theory should have to do this just once. |
|
42
|
|
|
// |
|
43
|
|
|
function cleanup_results() { |
|
44
|
|
|
foreach (scandir('../../results') as $d) { |
|
45
|
|
|
if ($d[0] == '.') continue; |
|
46
|
|
|
if (!is_numeric($d)) continue; |
|
47
|
|
|
$id = (int)$d; |
|
48
|
|
|
if (!$id) continue; |
|
49
|
|
|
$batch = BoincBatch::lookup_id($id); |
|
50
|
|
|
if ($batch) { |
|
51
|
|
|
if ($batch->state != BATCH_STATE_RETIRED) continue; |
|
52
|
|
|
} |
|
53
|
|
|
$dir = "../../results/$d"; |
|
54
|
|
|
echo "deleting $dir\n"; |
|
55
|
|
|
system("/bin/rm -rf $dir"); |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
main(); |
|
60
|
|
|
//cleanup_results(); |
|
61
|
|
|
|
|
62
|
|
|
?> |
|
63
|
|
|
|