/usr/share/perl5/OAR/Monika/OARJob.pm is in oar-web-status 2.5.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | ## Created on November 2007 by Joseph.Emeras@imag.fr
## this package handles a OAR job description
package OAR::Monika::OARJob;
use strict;
#use warnings;
use OAR::Monika::monikaCGI;
use File::Basename;
use Data::Dumper;
my $bestEffortColor = "#dddddd";
## class constructor
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
my $jobId = shift;
defined $jobId or die "missing jobId !";
$self->{job_id} = $jobId;
bless ($self,$class);
return $self;
}
sub jobId {
my $self = shift;
return $self->{job_id};
}
sub owner {
my $self = shift;
my $owner = $self->get("job_user");
$owner =~ s/@.+//;
return $owner;
}
sub set {
my $self = shift;
my $key = shift;
defined $key or die "which key ?";
my $value = shift;
# for best effort jobs
my $cgi = shift;
# for best effort jobs
#defined $value or die "which value for $key ?";
#unless (exists $self->{$key}) {
#$self->{$key} = [];
$self->{$key} = $value;
#}
#push @{$self->{$key}},$value;
# for best effort jobs
if ($self->get("queue_name") eq "besteffort"){
$cgi->setColor($self->jobId(),$bestEffortColor);
}
# for best effort jobs
return 1;
}
sub get {
my $self = shift;
my $key = shift;
defined $key or die "which key ?";
if (exists $self->{$key}) {
#return $self->{$key}->[0];
return $self->{$key};
} else {
return undef;
}
}
sub getList {
my $self = shift;
my $key = shift;
defined $key or die "which key ?";
exists $self->{$key} or die "Unknown key: ".$key;
return $self->{$key};
}
sub htmlTableRow {
my $self = shift;
my $cgi = shift;
my $output = "";
$output .= $cgi->start_Tr();
my $cgiName = File::Basename::basename($cgi->self_url(-query=>0));
$output .= $cgi->colorTd($self->jobId(),undef,$cgiName."?job=".$self->jobId(), "click to see job details");
if (OAR::Monika::Conf::myself()->server_do_mail()) {
$output .= $cgi->td({-align => "center"},
$cgi->a({
-href => "mailto:".$self->get("job_user"),
-title => "click to send mail"
}, $self->owner()));
} elsif (OAR::Monika::Conf::myself()->user_infos() ne "") {
$output .= $cgi->td({-align => "center"},
$cgi->a({
-href => OAR::Monika::Conf::myself()->user_infos().$self->get("job_user"),
-title => "click for more informations"
}, $self->owner()));
} else {
$output .= $cgi->td({-align => "center"},$self->owner());
}
#Until now, we've displayed jobId and User...
my $wanted_resources=$self->get("wanted_resources");
my $walltime=$self->get("walltime");
my $state= $self->get("state");
my $queue= $self->get("queue_name");
my $name= $self->get("job_name");
my $type= $self->get("job_type");
my $properties= $self->get("properties");
my $reservation= $self->get("reservation");
my $submission_time = $self->get("submission_time");
my $start_time = $self->get("start_time");
my $scheduled_start = $self->get("scheduled_start");
my $initial_request = $self->get("initial_request");
if($initial_request =~ / -t container/){
$type.=" - container";
}
elsif($initial_request =~ / -t inner=(\d+)/){
$type.=" - inner job (container=$1)";
}
elsif($initial_request =~ / -t timesharing/){
$type.=" - timesharing";
}
$output .= $cgi->td({-align => "center"},$state);
$output .= $cgi->td({-align => "center"},$queue);
$output .= $cgi->td({-align => "center"},$name);
$output .= $cgi->td({-align => "center"},$wanted_resources);
$output .= $cgi->td({-align => "center"},$type);
$output .= $cgi->td({-align => "center"},$properties);
$output .= $cgi->td({-align => "center"},$reservation);
$output .= $cgi->td({-align => "center"},$walltime);
$output .= $cgi->td({-align => "center"},$submission_time);
$output .= $cgi->td({-align => "center"},$start_time);
$output .= $cgi->td({-align => "center"},$scheduled_start);
$output .= $cgi->end_Tr();
return $output;
}
sub htmlStatusTable {
my $self = shift;
my $cgi = shift;
my $output = "";
$output .= $cgi->start_table({-border=>"1",
-align => "center"
});
$output .= $cgi->start_Tr();
$output .= $cgi->th({-align => "left", bgcolor => "#c0c0c0"}, $cgi->i("Job Id"));
$output .= $cgi->th({-align => "left"}, $self->jobId());
$output .= $cgi->end_Tr();
my @keylist = keys %{$self};
foreach my $key (sort @keylist) {
if(($key eq "job_id")){
#if(($key eq "job_id") or ($key eq "initial_request")){
next;
}
$output .= $cgi->start_Tr();
$output .= $cgi->td({-valign => "top", bgcolor=> "#c0c0c0"}, $cgi->i($key));
my $list = $self->getList($key);
my $val = join $cgi->br(),$list;
#$val =~ s/([+,]\s*)/\1<BR>/g;
$output .= $cgi->td($val);
$output .= $cgi->end_Tr();
}
$output .= $cgi->end_table();
return $output;
}
## that's all.
return 1;
|