예제 #1
0
function pbsutils_save($filename, $jobinfo)
{
    if (!($handle = fopen($filename, 'wb'))) {
        error_page("Error opening file {$filename}");
        exit;
    } else {
        // file opened, create the jobscript
        $script_str = pbsutils_script($jobinfo);
        //Write the jobscript to the file
        if (!fwrite($handle, $script_str)) {
            fclose($handle);
            error_page("Error writing to file {$filename}");
            exit;
        }
        fclose($handle);
    }
}
예제 #2
0
    $directory = $_REQUEST['directory'];
}
// setup the $jobinfo array, see pbsutils.php for format
$jobinfo = array();
$jobinfo['mail'] = $username . "@" . "{$host}";
$jobinfo['maxtime'] = "00:00:00";
// collect data from $_POST
pbsutils_collect($jobinfo, $_POST);
// create local job file, then copy to server
$jobfile = $jobinfo['name'] . ".pbs";
$localfile = $PBSWEBTEMPUPLOADDIR . "/" . $username . "/" . $jobfile;
pbsutils_save($localfile, $jobinfo);
$remote_file = $username . "@" . $host . ":~/";
$remote_file .= $PBSWEBUSERDIR . "/" . $directory . "/" . $jobfile;
$scp_result = `scp "{$localfile}" "{$remote_file}" 2>&1`;
$jobscript_str = pbsutils_script($jobinfo);
// submit the job and get the jobid
$qsub_cmd = $PBSWEBHOSTLIST[$host]['qsub'];
if ($qsub_cmd == "") {
    error_page("Error: can't retrieve command for qsub.");
    exit;
}
if ($jobinfo['type'] == "array") {
    $qsub_cmd .= " -t " . $_POST['arroption'];
}
$qsub_result = `ssh -l {$username} {$host} 'cd ~/{$PBSWEBUSERDIR}/{$directory}; {$qsub_cmd} {$jobfile}; exit' 2>&1`;
$tmparray = explode(".", trim($qsub_result));
$jobid = $tmparray[0];
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">