Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EC2 instance lifecycle #1624

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions www/ec2/ec2.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function EC2_TerminateIdleInstances() {
$lastWork = $tester['last'];
if (isset($tester['elapsed']) && $tester['elapsed'] < $lastCheck)
$lastCheck = $tester['elapsed'];
if (isset($tester['test']) && strlen($tester['test'])) {
if (!isset($tester['offline']) || !$tester['offline']) {
// don't terminate an instance that is busy with a test
$terminate = false;
}
Expand Down Expand Up @@ -297,7 +297,7 @@ function EC2_SendInstancesOffline() {
// See if we have any online testers that we need to make offline
$online_target = max($info['min'], intval($locations[$ami]['tests'] / ($scaleFactor / 2)));
foreach ($info['locations'] as $location) {
$testers = GetTesters($location);
$testers = GetTesters($location, true);
if (isset($testers) && is_array($testers) && isset($testers['testers']) && count($testers['testers'])) {
$online = 0;
foreach ($testers['testers'] as $tester) {
Expand Down Expand Up @@ -374,7 +374,7 @@ function EC2_StartNeededInstances() {
// See if we have any offline testers that we need to bring online
$online_target = max($target, intval($locations[$ami]['tests'] / ($scaleFactor / 2)));
foreach ($info['locations'] as $location) {
$testers = GetTesters($location);
$testers = GetTesters($location, true);
if (isset($testers) && is_array($testers) && isset($testers['testers']) && count($testers['testers'])) {
$online = 0;
foreach ($testers['testers'] as $tester) {
Expand Down
2 changes: 2 additions & 0 deletions www/getTesters.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
echo "<tr><th class=\"tester\">Tester</th><th>Busy?</th><th>Last Check (minutes)</th><th>Last Work (minutes)</th><th>Version</th><th>PC</th><th>EC2 Instance</th><th>CPU Utilization</th><th>Error Rate</th><th>Free Disk (GB)</th><th>uptime (minutes)</th><th>Screen Size</th>";
echo "<th>IP</th><th>DNS Server(s)</th>";
if ($admin) {
echo "<th>Flag as offline</th>";
echo "<th>Current Test</th>";
}
echo "</tr>\n";
Expand Down Expand Up @@ -91,6 +92,7 @@
echo "<td nowrap>" . @htmlspecialchars($tester['ip']) . "</td>";
echo "<td nowrap>" . @htmlspecialchars($tester['dns']) . "</td>";
if ($admin) {
echo "<td nowrap>" . @htmlspecialchars($tester['offline']) . "</td>";
echo "<td nowrap>" . @htmlspecialchars($tester['test']) . "</td>";
}
echo "</tr>";
Expand Down
50 changes: 25 additions & 25 deletions www/work/getwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ function GetTesterIndex($locInfo, &$testerIndex, &$testerCount, &$offline) {
if (strlen($ec2)) {
foreach($testers['testers'] as $index => $testerInfo) {
if (isset($testerInfo['ec2']) && $testerInfo['ec2'] == $ec2 &&
isset($testerInfo['offline']) && $testerInfo['offline'])
isset($testerInfo['offline']) && $testerInfo['offline']) {
$offline = true;
break;
}
}
}
foreach($testers['testers'] as $index => $testerInfo)
Expand Down Expand Up @@ -373,31 +374,30 @@ function GetJob() {
$ok = true;
}
}

// keep track of the last time this location reported in
$testerInfo = array();
$testerInfo['ip'] = $_SERVER['REMOTE_ADDR'];
$testerInfo['pc'] = $pc;
$testerInfo['ec2'] = $ec2;
$testerInfo['ver'] = array_key_exists('version', $_GET) ? $_GET['version'] : $_GET['ver'];
$testerInfo['freedisk'] = @$_GET['freedisk'];
$testerInfo['upminutes'] = @$_GET['upminutes'];
$testerInfo['ie'] = @$_GET['ie'];
$testerInfo['dns'] = $dnsServers;
$testerInfo['video'] = @$_GET['video'];
$testerInfo['GPU'] = @$_GET['GPU'];
$testerInfo['screenwidth'] = $screenwidth;
$testerInfo['screenheight'] = $screenheight;
$testerInfo['winver'] = $winver;
$testerInfo['isWinServer'] = $isWinServer;
$testerInfo['isWin64'] = $isWin64;
$testerInfo['test'] = '';
if (isset($browsers) && count(array_filter($browsers, 'strlen')))
$testerInfo['browsers'] = $browsers;
if (isset($testId))
$testerInfo['test'] = $testId;
UpdateTester($location, $tester, $testerInfo);
}
// keep track of the last time this location reported in
$testerInfo = array();
$testerInfo['ip'] = $_SERVER['REMOTE_ADDR'];
$testerInfo['pc'] = $pc;
$testerInfo['ec2'] = $ec2;
$testerInfo['ver'] = array_key_exists('version', $_GET) ? $_GET['version'] : $_GET['ver'];
$testerInfo['freedisk'] = @$_GET['freedisk'];
$testerInfo['upminutes'] = @$_GET['upminutes'];
$testerInfo['ie'] = @$_GET['ie'];
$testerInfo['dns'] = $dnsServers;
$testerInfo['video'] = @$_GET['video'];
$testerInfo['GPU'] = @$_GET['GPU'];
$testerInfo['screenwidth'] = $screenwidth;
$testerInfo['screenheight'] = $screenheight;
$testerInfo['winver'] = $winver;
$testerInfo['isWinServer'] = $isWinServer;
$testerInfo['isWin64'] = $isWin64;
$testerInfo['test'] = '';
if (isset($browsers) && count(array_filter($browsers, 'strlen')))
$testerInfo['browsers'] = $browsers;
if (isset($testId))
$testerInfo['test'] = $testId;
UpdateTester($location, $tester, $testerInfo);
}

return $is_done;
Expand Down
1 change: 0 additions & 1 deletion www/work/ping.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
$testerInfo['winver'] = $winver;
$testerInfo['isWinServer'] = $isWinServer;
$testerInfo['isWin64'] = $isWin64;
$testerInfo['test'] = $testId;
UpdateTester($location, $tester, $testerInfo, $cpu);
}
}
Expand Down