# Fatal Error. Report to the user, even though there is not much he can # do with the error. Also reports to tbops. # if ($retval < 0) { SUEXECERROR(SUEXEC_ACTION_CONTINUE); } # User error. Tell user and exit. SUEXECERROR(SUEXEC_ACTION_USERERROR); return; } # # Parse the last line of output. Ick. # if (preg_match("/^Template\\s+(\\w+)\\/(\\w+)\\s+is being/", $suexec_output_array[count($suexec_output_array) - 1], $matches)) { $guid = $matches[1]; $vers = $matches[2]; $template = Template::Lookup($guid, $vers); if (!$template) { TBERROR("Could not lookup template object for {$guid}/{$vers}", 1); return; } echo $template->PageHeader(); echo "<br><br>\n"; STARTLOG($template); } else { SUEXECERROR(SUEXEC_ACTION_DIE); } # # Standard Testbed Footer # PAGEFOOTER();
function DOIT($instance, $action, $command_options) { global $guid, $vers, $pid, $unix_pid, $unix_gid, $eid, $uid; global $deletexmlfile, $parameter_xmlfile; $message = ""; $template = $instance->GetTemplate(); $experiment = $instance->GetExperiment(); $command_options = "-e {$eid} " . $command_options; if ($action == "start") { PAGEHEADER("Start new Run"); $message = "Starting new experiment run"; $command_options = "-a start " . $command_options; } elseif ($action == "abort") { PAGEHEADER("Abort Run"); $message = "Aborting experiment run"; $command_options = "-a abort " . $command_options; } elseif ($action == "modify") { PAGEHEADER("Modify Run Resources"); $message = "Modifying resources for run"; $command_options = "-a modify " . $command_options; } else { PAGEHEADER("Stop current Run"); $message = "Stopping current run"; $command_options = "-a stop " . $command_options; } # # Avoid SIGPROF in child. # set_time_limit(0); echo $instance->ExpPageHeader(); echo "<br><br>\n"; echo "<script type='text/javascript' language='javascript' " . " src='template_sup.js'>\n"; echo "</script>\n"; STARTBUSY($message); # # Run the backend script. # $retval = SUEXEC($uid, "{$unix_pid},{$unix_gid}", "webtemplate_exprun {$command_options} {$guid}/{$vers}", SUEXEC_ACTION_IGNORE); HIDEBUSY(); if ($deletexmlfile) { unlink($parameter_xmlfile); } # # Fatal Error. Report to the user, even though there is not much he can # do with the error. Also reports to tbops. # if ($retval < 0) { SUEXECERROR(SUEXEC_ACTION_CONTINUE); } # User error. Tell user and exit. if ($retval) { SUEXECERROR(SUEXEC_ACTION_USERERROR); return; } STARTLOG($experiment); }
echo "<blockquote><pre>{$suexec_output}<pre></blockquote>"; PAGEFOOTER(); exit; } # Display a useful message. $message = ""; if ($nonsfile) { $message = "Since you did not provide an NS script, no nodes have been\n allocated. You will not be able to modify or swap this experiment,\n nor do most other neat things you can do with a real experiment."; } elseif ($exp_preload) { $message = "Since you are only pre-loading the experiment, this will typically\n take less than one minute. If you do not receive email notification\n within a reasonable amount of time, please contact {$TBMAILADDR}."; } elseif ($exp_batched) { $message = "Batch Mode experiments will be run when enough resources become\n available. This might happen immediately, or it may take hours\n\t or days. You will be notified via email when the experiment has\n been run. If you do not receive email notification within a\n reasonable amount of time, please contact {$TBMAILADDR}."; } else { $message = "You will be notified via email when the experiment has been fully\n\t configured and you are able to proceed. This typically takes less\n than 10 minutes, depending on the number of nodes you have requested.\n If you do not receive email notification within a reasonable amount\n of time, please contact {$TBMAILADDR}."; } # Map to the actual experiment and show the log. if ($experiment = Experiment::LookupByPidEid($formfields["exp_pid"], $formfields["exp_id"])) { echo $experiment->PageHeader(); echo "<br>\n"; echo "<b>Starting experiment configuration!</b> " . $message; echo "<br><br>\n"; STARTLOG($experiment); } else { echo "<br>\n"; echo "<b>Starting experiment configuration!</b> " . $message; echo "<br>\n"; } # # Standard Testbed Footer # PAGEFOOTER();
# Fatal Error. Report to the user, even though there is not much he can # do with the error. Also reports to tbops. # if ($retval < 0) { SUEXECERROR(SUEXEC_ACTION_CONTINUE); } # User error. Tell user and exit. SUEXECERROR(SUEXEC_ACTION_USERERROR); return; } # # We need to locate this instance for STARTLOG() below. # if (!preg_match("/^Instance\\s+[-\\w]+\\/[-\\w]+\\s+\\((\\d*)\\)/", $suexec_output_array[count($suexec_output_array) - 1], $matches)) { TBERROR("Could not locate instance object for {$pid}/{$eid}", 1); } $instance = TemplateInstance::LookupByIdx($matches[1]); if (!$instance) { TBERROR("Could not map instance idx " . $matches[1] . " to its object!", 1); } # # This does both the log output, and the state change watcher popup # if ($batchmode && !$preload) { echo "You template instantation has been queued and will run when\n enough resources become available. This might happen\n immediately, or it may take hours or days; you will be\n notified via email when insantiation is complete, and again when\n your experiment has completed.\n"; } STARTLOG($instance->GetLogfile()); # # Standard Testbed Footer # PAGEFOOTER();