Skip to content
This repository has been archived by the owner on Feb 20, 2020. It is now read-only.

Commit

Permalink
Merge pull request #75 from taskcluster/bug1441482
Browse files Browse the repository at this point in the history
Bug 1441482 - free up disk space between tasks, not after task claim
  • Loading branch information
petemoore committed Mar 2, 2018
2 parents 6da7e9b + 8e41727 commit af05f50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
12 changes: 10 additions & 2 deletions main.go
Expand Up @@ -624,10 +624,18 @@ func RunWorker() (exitCode ExitCode) {
return NONCURRENT_DEPLOYMENT_ID
}
}
// make sure at least 5 seconds passes between iterations
wait5Seconds := time.NewTimer(time.Second * 5)

// Ensure there is enough disk space *before* claiming a task
err := garbageCollection()
if err != nil {
panic(err)
}

task := ClaimWork()

// make sure at least 5 seconds pass between queue.claimWork API calls
wait5Seconds := time.NewTimer(time.Second * 5)

if task != nil {
errors := task.Run()
if errors.Occurred() {
Expand Down
11 changes: 1 addition & 10 deletions mounts.go
Expand Up @@ -308,18 +308,9 @@ func (taskMount *TaskMount) Start() *CommandExecutionError {
if taskMount.payloadError != nil {
return MalformedPayloadError(taskMount.payloadError)
}
// Let's perform a garbage collection here before running the task. In
// taskcluster-worker this will run in its own thread, and here it only
// works as we have a single job running at a time, so we don't need to
// worry about concurrency etc. But it is ugly to do it here, but
// sufficient for generic worker.
err := garbageCollection()
if err != nil {
panic(err)
}
// Check if any caches need to be purged. See:
// https://docs.taskcluster.net/reference/core/purge-cache
err = taskMount.purgeCaches()
err := taskMount.purgeCaches()
// Two possible strategies if we can't reach purgecache service:
//
// 1) be optimistic, assume caches are ok, and don't purge them
Expand Down

0 comments on commit af05f50

Please sign in to comment.