mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 09:49:36 +01:00
Show downloads
This commit is contained in:
parent
208425bd12
commit
f90b12098d
2 changed files with 64 additions and 21 deletions
|
|
@ -61,6 +61,7 @@ private:
|
||||||
uint64_t failed = 0;
|
uint64_t failed = 0;
|
||||||
std::map<ActivityType, uint64_t> expectedByType;
|
std::map<ActivityType, uint64_t> expectedByType;
|
||||||
bool visible = true;
|
bool visible = true;
|
||||||
|
bool ignored = false;
|
||||||
ActivityId parent;
|
ActivityId parent;
|
||||||
std::optional<std::string> name;
|
std::optional<std::string> name;
|
||||||
std::optional<std::chrono::time_point<std::chrono::steady_clock>> startTime;
|
std::optional<std::chrono::time_point<std::chrono::steady_clock>> startTime;
|
||||||
|
|
@ -93,6 +94,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto & j : act.its) {
|
for (auto & j : act.its) {
|
||||||
|
if (j.second->ignored) continue;
|
||||||
stats.done += j.second->done;
|
stats.done += j.second->done;
|
||||||
stats.expected += j.second->expected;
|
stats.expected += j.second->expected;
|
||||||
stats.running += j.second->running;
|
stats.running += j.second->running;
|
||||||
|
|
@ -108,6 +110,7 @@ private:
|
||||||
enum StatusLineGroup {
|
enum StatusLineGroup {
|
||||||
idHelp,
|
idHelp,
|
||||||
idEvaluate,
|
idEvaluate,
|
||||||
|
idDownload,
|
||||||
idCopyPaths,
|
idCopyPaths,
|
||||||
idBuilds,
|
idBuilds,
|
||||||
idStatus
|
idStatus
|
||||||
|
|
@ -391,9 +394,15 @@ public:
|
||||||
i->s = fmt("querying " ANSI_BOLD "%s" ANSI_NORMAL " on %s", name, getS(fields, 1));
|
i->s = fmt("querying " ANSI_BOLD "%s" ANSI_NORMAL " on %s", name, getS(fields, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type == actFileTransfer && hasAncestor(*state, actCopyPath, parent))
|
if (type == actFileTransfer) {
|
||||||
|| (type == actFileTransfer && hasAncestor(*state, actQueryPathInfo, parent))
|
i->s = getS(fields, 0);
|
||||||
|| (type == actCopyPath && hasAncestor(*state, actSubstitute, parent))
|
if (hasAncestor(*state, actCopyPath, parent)
|
||||||
|
|| hasAncestor(*state, actQueryPathInfo, parent))
|
||||||
|
i->ignored = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == actFileTransfer
|
||||||
|
|| (type == actCopyPath && hasAncestor(*state, actSubstitute, parent)) // FIXME?
|
||||||
|| type == actBuild
|
|| type == actBuild
|
||||||
|| type == actSubstitute)
|
|| type == actSubstitute)
|
||||||
i->visible = false;
|
i->visible = false;
|
||||||
|
|
@ -425,11 +434,14 @@ public:
|
||||||
if (i != state->its.end()) {
|
if (i != state->its.end()) {
|
||||||
|
|
||||||
auto & actByType = state->activitiesByType[i->second->type];
|
auto & actByType = state->activitiesByType[i->second->type];
|
||||||
actByType.done += i->second->done;
|
|
||||||
actByType.failed += i->second->failed;
|
|
||||||
|
|
||||||
for (auto & j : i->second->expectedByType)
|
if (!i->second->ignored) {
|
||||||
state->activitiesByType[j.first].expected -= j.second;
|
actByType.done += i->second->done;
|
||||||
|
actByType.failed += i->second->failed;
|
||||||
|
|
||||||
|
for (auto & j : i->second->expectedByType)
|
||||||
|
state->activitiesByType[j.first].expected -= j.second;
|
||||||
|
}
|
||||||
|
|
||||||
actByType.its.erase(act);
|
actByType.its.erase(act);
|
||||||
state->activities.erase(i->second);
|
state->activities.erase(i->second);
|
||||||
|
|
@ -487,23 +499,27 @@ public:
|
||||||
auto i = state->its.find(act);
|
auto i = state->its.find(act);
|
||||||
assert(i != state->its.end());
|
assert(i != state->its.end());
|
||||||
ActInfo & actInfo = *i->second;
|
ActInfo & actInfo = *i->second;
|
||||||
actInfo.done = getI(fields, 0);
|
if (!actInfo.ignored) {
|
||||||
actInfo.expected = getI(fields, 1);
|
actInfo.done = getI(fields, 0);
|
||||||
actInfo.running = getI(fields, 2);
|
actInfo.expected = getI(fields, 1);
|
||||||
actInfo.failed = getI(fields, 3);
|
actInfo.running = getI(fields, 2);
|
||||||
update(*state);
|
actInfo.failed = getI(fields, 3);
|
||||||
|
update(*state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type == resSetExpected) {
|
else if (type == resSetExpected) {
|
||||||
auto i = state->its.find(act);
|
auto i = state->its.find(act);
|
||||||
assert(i != state->its.end());
|
assert(i != state->its.end());
|
||||||
ActInfo & actInfo = *i->second;
|
ActInfo & actInfo = *i->second;
|
||||||
auto type = (ActivityType) getI(fields, 0);
|
if (!actInfo.ignored) {
|
||||||
auto & j = actInfo.expectedByType[type];
|
auto type = (ActivityType) getI(fields, 0);
|
||||||
state->activitiesByType[type].expected -= j;
|
auto & j = actInfo.expectedByType[type];
|
||||||
j = getI(fields, 1);
|
state->activitiesByType[type].expected -= j;
|
||||||
state->activitiesByType[type].expected += j;
|
j = getI(fields, 1);
|
||||||
update(*state);
|
state->activitiesByType[type].expected += j;
|
||||||
|
update(*state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -538,7 +554,7 @@ public:
|
||||||
} else {
|
} else {
|
||||||
// FIXME: evaluation could fail...
|
// FIXME: evaluation could fail...
|
||||||
state.statusLines.insert_or_assign({idEvaluate, 0},
|
state.statusLines.insert_or_assign({idEvaluate, 0},
|
||||||
fmt(ANSI_GREEN "✓ Evaluated"));
|
fmt(ANSI_GREEN "✓ Evaluating"));
|
||||||
state.statusLines.insert_or_assign({idEvaluate, 1}, "");
|
state.statusLines.insert_or_assign({idEvaluate, 1}, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -560,6 +576,32 @@ public:
|
||||||
ANSI_NORMAL + repeat("▒", barLength - chars3);
|
ANSI_NORMAL + repeat("▒", barLength - chars3);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto fileTransfer = getActivityStats(state.activitiesByType[actFileTransfer]);
|
||||||
|
|
||||||
|
if (fileTransfer.done || fileTransfer.expected) {
|
||||||
|
removeStatusLines(state, idDownload);
|
||||||
|
|
||||||
|
size_t n = 0;
|
||||||
|
state.statusLines.insert_or_assign({idDownload, n++},
|
||||||
|
fmt("%s Downloaded %.1f / %.1f MiB",
|
||||||
|
fileTransfer.running || fileTransfer.done < fileTransfer.expected
|
||||||
|
? ANSI_BOLD "•"
|
||||||
|
: ANSI_GREEN "✓",
|
||||||
|
//copyPaths.done, copyPaths.expected,
|
||||||
|
fileTransfer.done / MiB, fileTransfer.expected / MiB));
|
||||||
|
|
||||||
|
state.statusLines.insert_or_assign({idDownload, n++},
|
||||||
|
fmt(" %s", renderBar(fileTransfer.done, 0, fileTransfer.left, fileTransfer.expected)));
|
||||||
|
|
||||||
|
for (auto & build : state.activitiesByType[actFileTransfer].its) {
|
||||||
|
if (build.second->ignored) continue;
|
||||||
|
state.statusLines.insert_or_assign({idDownload, n++},
|
||||||
|
fmt(ANSI_BOLD " ‣ %s", build.second->s));
|
||||||
|
}
|
||||||
|
|
||||||
|
state.statusLines.insert_or_assign({idDownload, n++}, "");
|
||||||
|
}
|
||||||
|
|
||||||
auto copyPath = getActivityStats(state.activitiesByType[actCopyPath]);
|
auto copyPath = getActivityStats(state.activitiesByType[actCopyPath]);
|
||||||
auto copyPaths = getActivityStats(state.activitiesByType[actCopyPaths]);
|
auto copyPaths = getActivityStats(state.activitiesByType[actCopyPaths]);
|
||||||
|
|
||||||
|
|
@ -570,12 +612,13 @@ public:
|
||||||
|
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
state.statusLines.insert_or_assign({idCopyPaths, n++},
|
state.statusLines.insert_or_assign({idCopyPaths, n++},
|
||||||
fmt("%s Fetched %d / %d paths, %.1f / %.1f MiB",
|
fmt("%s Fetched %d / %d store paths, %.1f / %.1f MiB",
|
||||||
copyPaths.running || copyPaths.done < copyPaths.expected
|
copyPaths.running || copyPaths.done < copyPaths.expected
|
||||||
? ANSI_BOLD "•"
|
? ANSI_BOLD "•"
|
||||||
: ANSI_GREEN "✓",
|
: ANSI_GREEN "✓",
|
||||||
copyPaths.done, copyPaths.expected,
|
copyPaths.done, copyPaths.expected,
|
||||||
copyPath.done / MiB, copyPath.expected / MiB));
|
copyPath.done / MiB, copyPath.expected / MiB));
|
||||||
|
|
||||||
state.statusLines.insert_or_assign({idCopyPaths, n++},
|
state.statusLines.insert_or_assign({idCopyPaths, n++},
|
||||||
fmt(" %s", renderBar(copyPath.done, 0, copyPath.left, copyPath.expected)));
|
fmt(" %s", renderBar(copyPath.done, 0, copyPath.left, copyPath.expected)));
|
||||||
|
|
||||||
|
|
@ -604,6 +647,7 @@ public:
|
||||||
builds.done, builds.expected)
|
builds.done, builds.expected)
|
||||||
+ (builds.running ? fmt(", %d running", builds.running) : "")
|
+ (builds.running ? fmt(", %d running", builds.running) : "")
|
||||||
+ (builds.failed ? fmt(", %d failed", builds.failed) : ""));
|
+ (builds.failed ? fmt(", %d failed", builds.failed) : ""));
|
||||||
|
|
||||||
state.statusLines.insert_or_assign({idBuilds, n++},
|
state.statusLines.insert_or_assign({idBuilds, n++},
|
||||||
fmt(" %s",
|
fmt(" %s",
|
||||||
renderBar(builds.done, builds.failed, builds.running, builds.expected)));
|
renderBar(builds.done, builds.failed, builds.running, builds.expected)));
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,6 @@ public:
|
||||||
{
|
{
|
||||||
actDerivations.progress(doneBuilds, expectedBuilds + doneBuilds, runningBuilds, failedBuilds);
|
actDerivations.progress(doneBuilds, expectedBuilds + doneBuilds, runningBuilds, failedBuilds);
|
||||||
actSubstitutions.progress(doneSubstitutions, expectedSubstitutions + doneSubstitutions, runningSubstitutions, failedSubstitutions);
|
actSubstitutions.progress(doneSubstitutions, expectedSubstitutions + doneSubstitutions, runningSubstitutions, failedSubstitutions);
|
||||||
act.setExpected(actFileTransfer, expectedDownloadSize + doneDownloadSize);
|
|
||||||
act.setExpected(actCopyPath, expectedNarSize + doneNarSize);
|
act.setExpected(actCopyPath, expectedNarSize + doneNarSize);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue