ProcessTests($crawl); exit(0); } } // wait for the child processes to finish and the queue to empty do { $pending = PendingTestCount($crawl); $done = $total - $pending; $percent = number_format($done * 100.0 / floatval($total), 2); echo str_pad("\r{$percent}% complete ({$done} of {$total})...", 80); if ($pending) { sleep(5); } } while ($pending !== 0); echo str_pad("\rMarking crawl as done.", 80) . "\n"; MarkDone(); $exit = 0; echo "Done.\n"; } else { echo "{$crawl} has already been processed\n"; } } else { echo "{$crawl} had no available tests\n"; } } else { echo "{$crawl} is not a valid crawl ID (or is still running). Available crawls are:\n\n"; ShowAvailableCrawls(); } } else { echo "Usage: php harupload.php <crawlid>\nThe available crawl ID's are:\n\n"; ShowAvailableCrawls();
echo "{$id} : {$complete} of {$total} complete ({$pending} pending)\n"; if ($complete > 0 && !$pending) { // Write out the test and crawl information $tests = array('crawls' => $crawls, 'tests' => $finishedTests[$id]); file_put_contents("{$dir}/tests.json", json_encode($tests)); // mark it as complete file_put_contents("{$dir}/testing.complete", ''); } elseif (!$total) { // flag any groups that are not part of a crawl as complete file_put_contents("{$dir}/testing.complete", ''); } } // See if all of the individual processing steps are done. If so, mark mrocessing as complete. echo "Checking {$dir}\n"; if (is_file("{$dir}/testing.complete") && is_file("{$dir}/har.complete") && is_file("{$dir}/archive.dat") && ArchiveExists("{$dir}/archive.dat")) { MarkDone($dir); } else { if (!is_file("{$dir}/testing.complete")) { echo " Missing {$dir}/testing.complete\n"; } if (!is_file("{$dir}/har.complete")) { echo " Missing {$dir}/har.complete\n"; } if (!is_file("{$dir}/archive.dat")) { echo " Missing {$dir}/archive.dat\n"; } else { if (!ArchiveExists("{$dir}/archive.dat")) { echo " Archive not valid\n"; } } }