boinc/tools/demo_submit

46 lines
1.0 KiB
PHP
Executable File

#! /usr/bin/env php
<?php
// submit a job for existing application
//
// usage: demo_submit appname infile
//
// Submit a job and show its name.
// Use demo_query to query its status and get output file.
//
// This is for demo use, not production. It assumes:
// - template files are appname_in and appname_out
// - the app uses sample_trivial_validator
// - the app uses sample_assimilator
// (which puts output files in sample_results/)
// - app has 1 input file and 1 output file
if ($argc != 3) die("usage: demo_submit appname infile\n");
$appname = $argv[1];
chdir("html/ops");
require_once("../inc/boinc_db.inc");
$app = BoincApp::lookup("name='$appname'");
chdir("../..");
if (!$app) {
die("no such application: $appname\n");
}
$fname = $argv[2];
if (!is_file($fname)) {
die("no such file: $fname\n");
}
system("cp $fname `bin/dir_hier_path $fname`");
$wu_name = $appname."_".$fname."_".(string)time();
system("bin/create_work --appname $appname --wu_name $wu_name $fname");
echo "Job name: $wu_name\n";
?>