コード例 #1
0
ファイル: submit.php プロジェクト: CalvinZhu/boinc
function handle_query_job($user)
{
    $wuid = get_int('wuid');
    $wu = BoincWorkunit::lookup_id($wuid);
    if (!$wu) {
        error_page("no such job");
    }
    page_head("Job {$wuid}");
    echo "\n        <a href=workunit.php?wuid={$wuid}>Workunit details</a> &middot;\n        <a href=submit.php?action=query_batch&batch_id={$wu->batch}>Batch {$wu->batch}</a>\n    ";
    // show input files
    //
    echo "<h2>Input files</h2>\n";
    $x = "<in>" . $wu->xml_doc . "</in>";
    $x = simplexml_load_string($x);
    start_table();
    table_header("Logical name<br><p class=\"text-muted\">(click to view)</p>", "Size (bytes)", "MD5");
    foreach ($x->workunit->file_ref as $fr) {
        $pname = (string) $fr->file_name;
        $lname = (string) $fr->open_name;
        foreach ($x->file_info as $fi) {
            if ((string) $fi->name == $pname) {
                table_row("<a href={$fi->url}>{$lname}</a>", $fi->nbytes, $fi->md5_cksum);
                break;
            }
        }
    }
    end_table();
    echo "<h2>Instances</h2>\n";
    start_table();
    table_header("Instance ID<br><p class=\"text-muted\">click for result page</p>", "State", "Output files<br><p class=\"text-muted\">click to view the file</p>");
    $results = BoincResult::enum("workunitid={$wuid}");
    $upload_dir = parse_config(get_config(), "<upload_dir>");
    $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
    foreach ($results as $result) {
        echo "<tr>\n            <td><a href=result.php?resultid={$result->id}>{$result->id} &middot; {$result->name} </a></td>\n            <td>" . state_string($result) . "</td>\n            <td>\n";
        $i = 0;
        if ($result->server_state == 5) {
            $names = get_outfile_names($result);
            $i = 0;
            foreach ($names as $name) {
                $url = boinc_get_output_file_url($user, $result, $i++);
                $path = dir_hier_path($name, $upload_dir, $fanout);
                $s = stat($path);
                $size = $s['size'];
                echo "<a href={$url}>{$name} </a> (" . number_format($size) . " bytes)<br/>";
            }
            $i++;
        }
        echo "</td></tr>\n";
    }
    end_table();
    echo "<p><a href=submit.php>Return to job control page</a>\n";
    page_tail();
}
コード例 #2
0
ファイル: submit_rpc_handler.php プロジェクト: brevilo/boinc
function query_job($r)
{
    xml_start_tag("query_job");
    list($user, $user_submit) = authenticate_user($r, null);
    $job_id = (int) $r->job_id;
    $wu = BoincWorkunit::lookup_id($job_id);
    if (!$wu) {
        xml_error(-1, "no such job");
    }
    $batch = BoincBatch::lookup_id($wu->batch);
    if ($batch->user_id != $user->id) {
        xml_error(-1, "not owner");
    }
    $results = BoincResult::enum("workunitid={$job_id}");
    foreach ($results as $result) {
        echo "    <instance>\n        <name>{$result->name}</name>\n        <id>{$result->id}</id>\n        <state>" . state_string($result) . "</state>\n";
        if ($result->server_state == 5) {
            // over?
            $paths = get_outfile_paths($result);
            foreach ($paths as $path) {
                if (is_file($path)) {
                    $size = filesize($path);
                    echo "        <outfile>\n            <size>{$size}</size>\n        </outfile>\n";
                }
            }
        }
        echo "</instance>\n";
    }
    echo "</query_job>\n";
}
コード例 #3
0
ファイル: submit.php プロジェクト: nicolas17/boincgit-test
function handle_query_job($user)
{
    $wuid = get_int('wuid');
    page_head("Job {$wuid}");
    echo "<a href=workunit.php?wuid={$wuid}>View workunit page</a>\n";
    // show input files
    //
    echo "<h2>Input files</h2>\n";
    $wu = BoincWorkunit::lookup_id($wuid);
    $x = "<in>" . $wu->xml_doc . "</in>";
    $x = simplexml_load_string($x);
    start_table();
    table_header("Logical name<br><span class=note>(click to view)</span>", "Size (bytes)", "MD5");
    $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
    foreach ($x->workunit->file_ref as $fr) {
        $pname = (string) $fr->file_name;
        $lname = (string) $fr->open_name;
        $dir = filename_hash($pname, $fanout);
        $path = "../../download/{$dir}/{$pname}";
        $md5 = md5_file($path);
        $s = stat($path);
        $size = $s['size'];
        table_row("<a href=/download/{$dir}/{$pname}>{$lname}</a>", $size, $md5);
    }
    end_table();
    echo "<h2>Instances</h2>\n";
    start_table();
    table_header("Instance ID<br><span class=note>click for result page</span>", "State", "Output files<br><span class=note>click to view the file</span>");
    $results = BoincResult::enum("workunitid={$wuid}");
    foreach ($results as $result) {
        echo "<tr>\n            <td><a href=result.php?resultid={$result->id}>{$result->id} | {$result->name} </a></td>\n            <td>" . state_string($result) . "</td>\n            <td>\n";
        $i = 0;
        if ($result->server_state == 5) {
            $names = get_outfile_names($result);
            $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
            $i = 0;
            foreach ($names as $name) {
                $url = boinc_get_output_file_url($user, $result, $i++);
                $path = dir_hier_path($name, "../../upload", $fanout);
                $s = stat($path);
                $size = $s['size'];
                echo "<a href={$url}>{$name} </a> (" . number_format($size) . " bytes)<br/>";
            }
            $i++;
        }
        echo "</td></tr>\n";
    }
    end_table();
    echo "<p><a href=submit.php>Return to job control page</a>\n";
    page_tail();
}