forked from lix-project/hydra
* Merge the GC branch.
This commit is contained in:
parent
14f9260a27
commit
738712fca0
|
@ -167,3 +167,8 @@
|
|||
* Find the builds with the highest number of build steps:
|
||||
|
||||
select id, (select count(*) from buildsteps where build = x.id) as n from builds x order by n desc;
|
||||
|
||||
|
||||
* Evaluating the NixOS Hydra jobs:
|
||||
|
||||
$ ./hydra_eval_jobs ~/Dev/nixos-wc/release.nix --arg nixpkgs '{outPath = /home/eelco/Dev/nixpkgs-wc;}' --arg nixosSrc '{outPath = /home/eelco/Dev/nixos-wc; rev = 1234;}' --arg services '{outhPath = /home/eelco/services-wc;}' --argstr system i686-linux --argstr system x86_64-linux --arg officialRelease false
|
||||
|
|
|
@ -21,8 +21,9 @@ void printHelp()
|
|||
static Path gcRootsDir;
|
||||
|
||||
|
||||
typedef std::map<Symbol, std::pair<unsigned int, Value> > ArgsUsed;
|
||||
typedef std::map<Symbol, list<Value> > AutoArgs;
|
||||
typedef std::map<Symbol, std::pair<unsigned int, Value *> > ArgsUsed;
|
||||
typedef std::list<Value *, traceable_allocator<Value *> > ValueList;
|
||||
typedef std::map<Symbol, ValueList> AutoArgs;
|
||||
|
||||
|
||||
static void findJobs(EvalState & state, XMLWriter & doc,
|
||||
|
@ -38,10 +39,10 @@ static void tryJobAlts(EvalState & state, XMLWriter & doc,
|
|||
const Bindings & actualArgs)
|
||||
{
|
||||
if (cur == last) {
|
||||
Value v, arg;
|
||||
state.mkAttrs(arg);
|
||||
*arg.attrs = actualArgs;
|
||||
mkApp(v, fun, arg);
|
||||
Value v, * arg = state.allocValue();
|
||||
state.mkAttrs(*arg, 0);
|
||||
*arg->attrs = actualArgs;
|
||||
mkApp(v, fun, *arg);
|
||||
findJobs(state, doc, argsUsed, argsLeft, v, attrPath);
|
||||
return;
|
||||
}
|
||||
|
@ -55,12 +56,13 @@ static void tryJobAlts(EvalState & state, XMLWriter & doc,
|
|||
Formals::Formals_::iterator next = cur; ++next;
|
||||
|
||||
int n = 0;
|
||||
foreach (list<Value>::const_iterator, i, a->second) {
|
||||
foreach (ValueList::const_iterator, i, a->second) {
|
||||
Bindings actualArgs2(actualArgs); // !!! inefficient
|
||||
ArgsUsed argsUsed2(argsUsed);
|
||||
AutoArgs argsLeft2(argsLeft);
|
||||
actualArgs2[cur->name].value = *i;
|
||||
argsUsed2[cur->name] = std::pair<unsigned int, Value>(n, *i);
|
||||
actualArgs2.push_back(Attr(cur->name, *i));
|
||||
actualArgs2.sort(); // !!! inefficient
|
||||
argsUsed2[cur->name] = std::pair<unsigned int, Value *>(n, *i);
|
||||
argsLeft2.erase(cur->name);
|
||||
tryJobAlts(state, doc, argsUsed2, argsLeft2, attrPath, fun, next, last, actualArgs2);
|
||||
++n;
|
||||
|
@ -73,7 +75,7 @@ static void showArgsUsed(XMLWriter & doc, const ArgsUsed & argsUsed)
|
|||
foreach (ArgsUsed::const_iterator, i, argsUsed) {
|
||||
XMLAttrs xmlAttrs2;
|
||||
xmlAttrs2["name"] = i->first;
|
||||
xmlAttrs2["value"] = (format("%1%") % i->second.second).str();
|
||||
xmlAttrs2["value"] = (format("%1%") % *i->second.second).str();
|
||||
xmlAttrs2["altnr"] = int2String(i->second.first);
|
||||
doc.writeEmptyElement("arg", xmlAttrs2);
|
||||
}
|
||||
|
@ -162,8 +164,8 @@ static void findJobsWrapped(EvalState & state, XMLWriter & doc,
|
|||
|
||||
else {
|
||||
foreach (Bindings::iterator, i, *v.attrs)
|
||||
findJobs(state, doc, argsUsed, argsLeft, i->second.value,
|
||||
(attrPath.empty() ? "" : attrPath + ".") + (string) i->first);
|
||||
findJobs(state, doc, argsUsed, argsLeft, *i->value,
|
||||
(attrPath.empty() ? "" : attrPath + ".") + (string) i->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,11 +214,11 @@ void run(Strings args)
|
|||
string name = *i++;
|
||||
if (i == args.end()) throw UsageError("missing argument");
|
||||
string value = *i++;
|
||||
Value v;
|
||||
Value * v = state.allocValue();
|
||||
if (arg == "--arg")
|
||||
state.eval(parseExprFromString(state, value, absPath(".")), v);
|
||||
state.eval(parseExprFromString(state, value, absPath(".")), *v);
|
||||
else
|
||||
mkString(v, value);
|
||||
mkString(*v, value);
|
||||
autoArgs[state.symbols.create(name)].push_back(v);
|
||||
}
|
||||
else if (arg == "--gc-roots-dir") {
|
||||
|
@ -239,6 +241,7 @@ void run(Strings args)
|
|||
Value v;
|
||||
state.mkThunk_(v, e);
|
||||
|
||||
std::cout.setf(std::ios::unitbuf);
|
||||
XMLWriter doc(true, std::cout);
|
||||
XMLOpenElement root(doc, "jobs");
|
||||
findJobs(state, doc, ArgsUsed(), autoArgs, v, "");
|
||||
|
|
|
@ -36,18 +36,27 @@ sub keepBuild {
|
|||
|
||||
foreach my $project ($db->resultset('Projects')->all) {
|
||||
|
||||
# Go over all jobs in this project.
|
||||
# Go over all jobsets in this project.
|
||||
foreach my $jobset ($project->jobsets->all) {
|
||||
my $keepnr = $jobset->keepnr;
|
||||
|
||||
foreach my $job ($project->jobs->all) {
|
||||
# If the jobset has been disabled for more than one week, than
|
||||
# don't keep its builds anymore.
|
||||
if ($jobset->enabled == 0 && (time() - $jobset->lastcheckedtime > (7 * 24 * 3600))) {
|
||||
print STDERR "*** skipping disabled jobset ", $project->name, ":", $jobset->name, "\n";
|
||||
next;
|
||||
}
|
||||
|
||||
# Go over all jobs in this jobset.
|
||||
foreach my $job ($jobset->jobs->all) {
|
||||
print STDERR "*** looking for builds to keep in job ",
|
||||
$project->name, ":", $job->jobset->name, ":", $job->name, "\n";
|
||||
|
||||
# Keep the N most recent successful builds for each job and
|
||||
# platform.
|
||||
# !!! Take time into account? E.g. don't delete builds that
|
||||
# are younger than N days.
|
||||
# Keep the N most recent successful builds for each job
|
||||
# and platform.
|
||||
# !!! Take time into account? E.g. don't delete builds
|
||||
# that are younger than N days.
|
||||
my @systems = $job->builds->search({ }, { select => ["system"], distinct => 1 })->all;
|
||||
my $keepnr = $job->jobset->keepnr ;
|
||||
foreach my $system (@systems) {
|
||||
my @recentBuilds = $job->builds->search(
|
||||
{ finished => 1
|
||||
|
@ -61,9 +70,9 @@ foreach my $project ($db->resultset('Projects')->all) {
|
|||
keepBuild $_ foreach @recentBuilds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Go over all views in this project.
|
||||
|
||||
foreach my $view ($project->views->all) {
|
||||
print STDERR "*** looking for builds to keep in view ", $project->name, ":", $view->name, "\n";
|
||||
|
||||
|
|
Loading…
Reference in a new issue