Exemple #1
0
function test_submit_batch($req)
{
    $req->app_name = "uppercase";
    $req->jobs = array();
    $f = new StdClass();
    $f->mode = "local_staged";
    $f->source = "input";
    $job = new StdClass();
    $job->input_files = array($f);
    for ($i = 10; $i < 20; $i++) {
        $job->rsc_fpops_est = $i * 1000000000.0;
        $job->command_line = "--t {$i}";
        $req->jobs[] = $job;
    }
    list($batch_id, $errmsg) = boinc_submit_batch($req);
    if ($errmsg) {
        echo "Error: {$errmsg}\n";
    } else {
        echo "Batch ID: {$batch_id}\n";
    }
}
function handle_create_action()
{
    global $project, $auth;
    $get_estimate = get_str('get_estimate', true);
    if ($get_estimate) {
        $req = form_to_request($project, $auth);
        list($e, $errmsg) = boinc_estimate_batch($req);
        if ($errmsg) {
            error_page(htmlentities($errmsg));
        }
        page_head("Batch estimate");
        echo sprintf("Estimate: %.0f seconds", $e);
        echo "<p><a href=submit_example.php>Return to job control page</a>\n";
        page_tail();
    } else {
        $req = form_to_request($project, $auth);
        list($id, $errmsg) = boinc_submit_batch($req);
        if ($errmsg) {
            error_page(htmlentities($errmsg));
        }
        page_head("Batch submitted");
        echo "Batch created, ID: {$id}\n";
        echo "<p><a href=submit_example.php>Return to job control page</a>\n";
        page_tail();
    }
}