File: workunit.php

package info (click to toggle)
boinc 7.14.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 111,132 kB
  • sloc: cpp: 163,589; php: 113,173; ansic: 49,284; pascal: 35,620; xml: 17,864; java: 13,521; python: 6,551; sh: 4,082; perl: 1,843; makefile: 1,796; objc: 1,543; sql: 959; csh: 126; lisp: 47
file content (106 lines) | stat: -rw-r--r-- 3,388 bytes parent folder | download | duplicates (4)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.

// show summary of a workunit

require_once("../inc/util.inc");
require_once("../inc/boinc_db.inc");
require_once("../inc/result.inc");
require_once("../inc/keywords.inc");

check_get_args(array("wuid"));

function keyword_string($kwds) {
    global $job_keywords;

    $ks = explode(" ", $kwds);
    $first = true;
    $x = "";
    foreach ($ks as $k) {
        if ($first) {
            $first = false;
        } else {
            $x .= ", ";
        }
        $x .= $job_keywords[$k]->name;
    }
    return $x;
}

function show_wu($wu) {
    page_head(tra("Workunit %1", $wu->id));
    $app = BoincApp::lookup_id($wu->appid);

    start_table();
    row2(tra("name"), $wu->name);
    row2(tra("application"), $app->user_friendly_name);
    row2(tra("created"), time_str($wu->create_time));
    if (isset($wu->keywords) && $wu->keywords) {
        row2(tra("keywords"), keyword_string($wu->keywords));
    }
    if ($wu->canonical_resultid) {
        row2(tra("canonical result"),
            "<a href=result.php?resultid=$wu->canonical_resultid>$wu->canonical_resultid</a>"
        );
        row2(tra("granted credit"), format_credit($wu->canonical_credit));
    }

    // if app is using adaptive replication and no canonical result yet,
    // don't show anything more
    // (so that bad guys can't tell if they have an unreplicated job)

    $config = get_config();
    if ($app->target_nresults>0 && !$wu->canonical_resultid && !$wu->error_mask && !parse_bool($config, "dont_suppress_pending")) {
        row2(tra("Tasks in progress"), tra("suppressed pending completion"));
        end_table();
    } else {
        row2(tra("minimum quorum"), $wu->min_quorum);
        row2(tra("initial replication"), $wu->target_nresults);
        row2(tra("max # of error/total/success tasks"),
            "$wu->max_error_results, $wu->max_total_results, $wu->max_success_results"
        );
        if ($wu->error_mask) {
            row2(tra("errors"), wu_error_mask_str($wu->error_mask));
        }
        if ($wu->need_validate) {
            row2(tra("validation"), tra("Pending"));
        }
        if (function_exists('project_workunit')) {
            project_workunit($wu);
        }
        end_table();

        result_table_start(false, true, null);
        $results = BoincResult::enum("workunitid=$wu->id");
        foreach ($results as $result) {
            show_result_row($result, false, true, false);
        }
        echo "</table>\n";
    }

    page_tail();
}

$wuid = get_int("wuid");
$wu = BoincWorkunit::lookup_id($wuid);
if (!$wu) {
    error_page(tra("can't find workunit"));
}
show_wu($wu);

?>