bug fixes to make webgui work with the wre demo system

This commit is contained in:
JT Smith 2006-05-15 00:23:54 +00:00
parent b3eff9623d
commit a3b9509090
7 changed files with 14 additions and 8 deletions

View file

@ -187,7 +187,7 @@ sub runTests {
my $userAgent = new LWP::UserAgent;
$userAgent->agent("Spectre");
$userAgent->timeout(30);
my $url = "http://".$configs->{$config}->get("sitename")->[0].":".$self->config->get("webguiPort")."/?op=spectreTest";
my $url = "http://".$configs->{$config}->get("sitename")->[0].":".$self->config->get("webguiPort").$configs->{$config}->get("gateway")."?op=spectreTest";
my $request = new HTTP::Request (GET => $url);
my $response = $userAgent->request($request);
if ($response->is_error) {

View file

@ -140,6 +140,7 @@ sub addJob {
$self->{_jobs}{$params->{config}}{$params->{taskId}} = {
taskId=>$params->{taskId},
config=>$params->{config},
gateway=>$params->{gateway},
sitename=>$params->{sitename},
schedule=>join(" ", $params->{minuteOfHour}, $params->{hourOfDay}, $params->{dayOfMonth}, $params->{monthOfYear}, $params->{dayOfWeek}),
runOnce=>$params->{runOnce},
@ -311,6 +312,7 @@ sub loadSchedule {
my $params = JSON::jsonToObj($data->{parameters});
$data->{parameters} = $params->{parameters};
$data->{config} = $config;
$data->{gateway} = $session->config->get("gateway");
$data->{sitename} = $session->config->get("sitename")->[0];
$kernel->yield("addJob", $data);
}
@ -373,7 +375,7 @@ sub runJob {
$self->error("Warning: A scheduled task has corrupt information and is nat able to be run. Skipping execution.");
$kernel->yield("deleteJob",{config=>$job->{config}, taskId=>$job->{taskId}}) if ($job->{config} ne "" && $job->{taskId} ne "");
} else {
my $url = "http://".$job->{sitename}.':'.$self->config->get("webguiPort").'/';
my $url = "http://".$job->{sitename}.':'.$self->config->get("webguiPort").$job->{gateway};
my $request = POST $url, [op=>"runCronJob", taskId=>$job->{taskId}];
my $cookie = $self->{_cookies}{$job->{sitename}};
$request->header("Cookie","wgSession=".$cookie) if (defined $cookie);
@ -395,7 +397,7 @@ This method is called when the response from the runJob() method is received.
=cut
sub runJobResponse {
my ($self, $kernel) = @_[OBJECT, KERNEL];
my ($self, $kernel) = @_[OBJECT, KERNEL];
$self->debug("Retrieving response from scheduled job.");
my ($request, $response, $entry) = @{$_[ARG1]};
my $taskId = $request->header("X-taskId"); # got to figure out how to get this from the request, cuz the response may die

View file

@ -87,6 +87,7 @@ sub addInstance {
$self->{_instances}{$params->{instanceId}} = {
sitename=>$params->{sitename},
instanceId=>$params->{instanceId},
gateway => $params->{gateway},
status=>"waiting",
priority=>$params->{priority}
};
@ -261,7 +262,7 @@ sub loadWorkflows {
my $session = WebGUI::Session->open($config->getWebguiRoot, $config->getFilename);
my $result = $session->db->read("select instanceId,priority from WorkflowInstance");
while (my ($id, $priority) = $result->array) {
$kernel->yield("addInstance", {sitename=>$config->get("sitename")->[0], instanceId=>$id, priority=>$priority});
$kernel->yield("addInstance", {gateway=>$config->get("gateway"), sitename=>$config->get("sitename")->[0], instanceId=>$id, priority=>$priority});
}
$session->close;
}
@ -333,7 +334,7 @@ sub runWorker {
my ($kernel, $self, $instance, $session) = @_[KERNEL, OBJECT, ARG0, SESSION];
$self->debug("Preparing to run workflow instance ".$instance->{instanceId}.".");
POE::Component::Client::UserAgent->new;
my $url = "http://".$instance->{sitename}.':'.$self->config->get("webguiPort").'/';
my $url = "http://".$instance->{sitename}.':'.$self->config->get("webguiPort").$instance->{gateway};
my $request = POST $url, [op=>"runWorkflow", instanceId=>$instance->{instanceId}];
my $cookie = $self->{_cookies}{$instance->{sitename}};
$request->header("Cookie","wgSession=".$cookie) if (defined $cookie);