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

Clean workers too from the clean command #3579

Merged
merged 6 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
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
Next Next commit
NIT Refactoring for readability
alexarchambault committed Sep 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 3e6a101fe8c5e50903416dcb13a821cc815ae02b
43 changes: 21 additions & 22 deletions main/eval/src/mill/eval/GroupEvaluator.scala
Original file line number Diff line number Diff line change
@@ -364,28 +364,27 @@ private[mill] trait GroupEvaluator {
inputsHash: Int,
labelled: Terminal.Labelled[_]
): Unit = {
labelled.task.asWorker match {
case Some(w) =>
workerCache.synchronized {
workerCache.update(w.ctx.segments, (workerCacheHash(inputsHash), v))
}
case None =>
val terminalResult = labelled
.task
.writerOpt
.asInstanceOf[Option[upickle.default.Writer[Any]]]
.map { w => upickle.default.writeJs(v.value)(w) }

for (json <- terminalResult) {
os.write.over(
metaPath,
upickle.default.stream(
Evaluator.Cached(json, hashCode, inputsHash),
indent = 4
),
createFolders = true
)
}
for (w <- labelled.task.asWorker)
workerCache.synchronized {
workerCache.update(w.ctx.segments, (workerCacheHash(inputsHash), v))
}

val terminalResult = labelled
.task
.writerOpt
.map { w =>
upickle.default.writeJs(v.value)(w.asInstanceOf[upickle.default.Writer[Any]])
}

for (json <- terminalResult) {
os.write.over(
metaPath,
upickle.default.stream(
Evaluator.Cached(json, hashCode, inputsHash),
indent = 4
),
createFolders = true
)
}
}