HTL6HIBMRGSX2H2H7KB4MC3H6UQ5C752VC3UHC43SRA7V66PQCRQC
R2PON6R7RJT63XVKGEXAIKB76RHIQL3WCDTZQM5JLKAZ7B5AZAFQC
V6S6OYIAW3ZCBP6UHUYAZGG4P237WBB6HDG5NQIF3E5YFDTQRA4AC
U5ZWDBW3XRWDWMMPSSXEZ3DT47FPX5WH74AZ4URVQHHAD7ZOB46AC
J5UVLXOK6EDIL5I7VKWH4V2QDS4DPD7FHRK6XBWSXFRQS4JKXFZQC
VH5ZABDRP565VZIG55YHNYYPST53NQ2J6YM362NSLXCAHI5WPH4AC
2GK5DOU7ODF4WBSN3QTD3WIO52VTL2LOAXKGCDEMMAQPTEO4A4HAC
BDSD2JLV4V4I52SE7MCZLYNDC4XU27ZNH7TYKLT7CA7YR5WRMQBAC
PMNWRTGJ4GVSMSSAWSUD57B26PCRAHMZIQ5SIWJIK7A74ENKEQLAC
ZWCTAZGLJZQNTYWTC2XQUKMILJF6JGDL5IND6QNYWK4FIGMLRFXAC
SMCOU72FKTPFNCDXFJAILVUWFE4DY33CJJE4436H5POKENFFDFFAC
$c->stash->{machines} = [$c->model('DB::BuildMachines')->search(
{},
{ order_by => ["enabled DESC", "hostname"]
, '+select' => ["(select bs.stoptime from buildsteps as bs where bs.machine = (me.username || '\@' || me.hostname) and not bs.stoptime is null order by bs.stoptime desc limit 1)"]
, '+as' => ['idle']
})];
my $machines = getMachines;
my $idles = $c->model('DB::BuildSteps')->search(
{ stoptime => { '!=', undef } },
{ select => [ 'machine', { max => 'stoptime', -as => 'max_stoptime' }], group_by => "machine" });
while (my $idle = $idles->next) {
${$machines}{$idle->machine}{'idle'} = $idle->max_stoptime;
}
$c->stash->{machines} = $machines;
}
sub getMachines {
my $machinesConf = $ENV{"NIX_REMOTE_SYSTEMS"} || "/etc/nix.machines";
# Read the list of machines.
my %machines = ();
if (-e $machinesConf) {
open CONF, "<$machinesConf" or die;
while (<CONF>) {
chomp;
s/\#.*$//g;
next if /^\s*$/;
my @tokens = split /\s/, $_;
my @supportedFeatures = split(/,/, $tokens[5] || "");
my @mandatoryFeatures = split(/,/, $tokens[6] || "");
$machines{$tokens[0]} =
{ systemTypes => [ split(/,/, $tokens[1]) ]
, sshKeys => $tokens[2]
, maxJobs => int($tokens[3])
, speedFactor => 1.0 * (defined $tokens[4] ? int($tokens[4]) : 1)
, supportedFeatures => [ @supportedFeatures, @mandatoryFeatures ]
, mandatoryFeatures => [ @mandatoryFeatures ]
};
}
close CONF;
}
return \%machines;
<a class="btn btn-danger btn-mini" href="[% c.uri_for('/admin/machine' m.hostname 'enable' ) %]">Stopped</a>
[% END %] <tt>[% m.hostname %]</tt> (<tt>[% comma=0; FOREACH ms IN m.buildmachinesystemtypes %][% IF comma; %], [% ELSE; comma = 1; END; ms.system; END %])</tt>
Stopped
[% END %] <tt>[% m.key %]</tt> (<tt>[% comma=0; FOREACH system IN m.value.systemTypes %][% IF comma; %], [% ELSE; comma = 1; END; system; END %])</tt>
<tr><td colspan="5">Idle since [% INCLUDE renderDuration duration = curTime - m.get_column('idle') %]</td></tr>
[% IF m.value.idle %]
<tr><td colspan="5">Idle since [% INCLUDE renderDuration duration = curTime - m.value.idle %]</td></tr>
[% ELSE %]
<tr><td colspan="5">Never built</td></tr>
[% END %]