Is it possible to reset a server job count using the api?
We have servers with MaxJobCount =1; Often, the job count will be set to "1" even when no job step is running on that server object. I am able to query all active jobs and determine that no active job step is using that server. I can use the api to query the job count, but I do not see a function to set or reset the job count.
perl or java would be ok, but I would prefer perl.
my $running = BuildForge::Services::DBO::Build->findRunning($connection); # all active jobs
foreach my $build (@$running) { # examine each job
my $rslts = $build->getResults(); # get all steps
foreach my $rslt (@$rslts) { # examine each step
my $result = $rslt->getResult(); # if "RUNNING" this step is active
my $server_uuid = $rslt->getServerUuid(); # determine what server it is running on
.....
my $servers = BuildForge::Services::DBO::Server->findAll($connection); # get all servers
foreach my $server (@$servers) {
my $jobs = $server->getCurrentJobs(); # get the job count
if ($jobs>0) {
# server thinks it has an active job
}
If the server job count is > 0 and no active job/step is using it I need something like:
$server->setCurrentJobs(0); or $server->resetCurrentJobs(); or equivalent.
perl or java would be ok, but I would prefer perl.
my $running = BuildForge::Services::DBO::Build->findRunning($connection); # all active jobs
foreach my $build (@$running) { # examine each job
my $rslts = $build->getResults(); # get all steps
foreach my $rslt (@$rslts) { # examine each step
my $result = $rslt->getResult(); # if "RUNNING" this step is active
my $server_uuid = $rslt->getServerUuid(); # determine what server it is running on
.....
my $servers = BuildForge::Services::DBO::Server->findAll($connection); # get all servers
foreach my $server (@$servers) {
my $jobs = $server->getCurrentJobs(); # get the job count
if ($jobs>0) {
# server thinks it has an active job
}
If the server job count is > 0 and no active job/step is using it I need something like:
$server->setCurrentJobs(0); or $server->resetCurrentJobs(); or equivalent.