-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[K/N][tests] Set timeout for
gsutil
and try repeating if it hits
This command (used for copying the iOS device test execution results from the cloud) sometimes just hangs on certain CI agents. This commit sets the timeout for it, and tries to repeat the execution a couple of times to mitigate this. In a simple experiment, this little trick proved to work. ^KT-72581 Fixed
- Loading branch information
1 parent
667d623
commit 0b9b7dd
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
native/executors/src/main/kotlin/org/jetbrains/kotlin/native/executors/ExecutorUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. | ||
*/ | ||
|
||
package org.jetbrains.kotlin.native.executors | ||
|
||
import kotlin.time.Duration | ||
|
||
fun Executor.executeWithRepeatOnTimeout(request: ExecuteRequest, timeouts: List<Duration>): ExecuteResponse { | ||
require(timeouts.isNotEmpty()) | ||
lateinit var response: ExecuteResponse | ||
|
||
for (timeout in timeouts) { | ||
response = execute(request.copying { | ||
this.timeout = timeout | ||
}) | ||
if (response.exitCode != null) { | ||
return response | ||
} else { | ||
// It was killed by a timeout, let's repeat. | ||
} | ||
} | ||
|
||
return response | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters