#!/usr/bin/perl -w use CGI qw/:standard/; use CGI::Pretty; $CGI::Pretty::INDENT = ""; use Batch; use BioC; use Site; use strict; # Create the global CGI instance our $cgi = new CGI; if ($cgi->param('name')) { canceljob(); } else { form(); } #### Subroutine: form # Print the show job results form #### sub form { print $cgi->header; site_header("Cancel Job"); print h1("Cancel Job"), start_form(-method=>'GET'), p("Enter the job name:"), p(textfield("name", "", 30)), submit("submit", "Cancel Job"), end_form; print <<'END';
This form allows you to cancel jobs currently running. You must know the job name to do so.
END site_footer(); } #### Subroutine: canceljob # Show job results #### sub canceljob { my ($job, $id); my $jobname = $cgi->param('name'); $jobname =~ s/^\s|\s$//g; grep(/[a-z]{1,6}-[a-zA-Z0-9]{8}/, $jobname) || error("Invalid job name"); opendir(DIR, "$RESULT_DIR/$jobname") || error("The results for that job name no longer exist"); closedir(DIR); open(ID, "$RESULT_DIR/$jobname/id") || error("That job is no longer running"); $job = new Batch; $job->type($BATCH_SYSTEM); $job->name($cgi->param('name')); $job->id(