Skip to content

Commit 1706f3e

Browse files
JakobDegenfacebook-github-bot
authored andcommitted
timeouts: Use Duration type for re queue time more
Summary: Types are good Reviewed By: IanChilds Differential Revision: D78309455 fbshipit-source-id: 3fd938966b1612bce8f5823d108e286b8a53e790
1 parent daba555 commit 1706f3e

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

app/buck2_build_api/src/interpreter/rule_defs/command_executor_config.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
use std::sync::Arc;
12+
use std::time::Duration;
1213

1314
use allocative::Allocative;
1415
use buck2_core::execution_types::executor_config::CacheUploadBehavior;
@@ -111,7 +112,7 @@ pub fn register_command_executor_config(builder: &mut GlobalsBuilder) {
111112
#[starlark(default = NoneOr::None, require = named)]
112113
remote_execution_max_input_files_mebibytes: NoneOr<i32>,
113114
#[starlark(default = NoneOr::None, require = named)]
114-
remote_execution_queue_time_threshold_s: NoneOr<i32>,
115+
remote_execution_queue_time_threshold_s: NoneOr<u64>,
115116
#[starlark(default = NoneType, require = named)] remote_execution_use_case: Value<'v>,
116117
#[starlark(default = false, require = named)] use_limited_hybrid: bool,
117118
#[starlark(default = false, require = named)] allow_limited_hybrid_fallbacks: bool,
@@ -211,15 +212,12 @@ pub fn register_command_executor_config(builder: &mut GlobalsBuilder) {
211212
.buck_error_context("remote_execution_max_input_files_mebibytes is negative")?
212213
.map(|b| b * 1024 * 1024);
213214

214-
let re_max_queue_time_ms = remote_execution_queue_time_threshold_s
215-
.map(u64::try_from)
216-
.transpose()
217-
.buck_error_context("remote_execution_queue_time_threshold_s is negative")?
218-
.map(|t| t * 1000);
215+
let re_max_queue_time =
216+
remote_execution_queue_time_threshold_s.map(Duration::from_secs);
219217

220218
Some(RemoteExecutorOptions {
221219
re_max_input_files_bytes,
222-
re_max_queue_time_ms,
220+
re_max_queue_time,
223221
re_resource_units,
224222
})
225223
} else {

app/buck2_core/src/execution_types/executor_config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::hash::Hash;
1313
use std::hash::Hasher;
1414
use std::str::FromStr;
1515
use std::sync::Arc;
16+
use std::time::Duration;
1617

1718
use allocative::Allocative;
1819
use buck2_error::BuckErrorContext;
@@ -145,7 +146,7 @@ impl FromStr for RemoteExecutorUseCase {
145146
#[derive(Debug, Default, Eq, PartialEq, Clone, Hash, Allocative)]
146147
pub struct RemoteExecutorOptions {
147148
pub re_max_input_files_bytes: Option<u64>,
148-
pub re_max_queue_time_ms: Option<u64>,
149+
pub re_max_queue_time: Option<Duration>,
149150
pub re_resource_units: Option<i64>,
150151
}
151152

app/buck2_execute_impl/src/executors/re.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub struct ReExecutor {
7676
pub knobs: ExecutorGlobalKnobs,
7777
pub skip_cache_read: bool,
7878
pub skip_cache_write: bool,
79-
pub re_max_queue_time_ms: Option<u64>,
79+
pub re_max_queue_time: Option<Duration>,
8080
pub re_resource_units: Option<i64>,
8181
pub paranoid: Option<ParanoidDownloader>,
8282
pub materialize_failed_inputs: bool,
@@ -173,7 +173,7 @@ impl ReExecutor {
173173
&mut manager,
174174
self.skip_cache_read,
175175
self.skip_cache_write,
176-
self.re_max_queue_time_ms.map(Duration::from_millis),
176+
self.re_max_queue_time,
177177
self.re_resource_units,
178178
&self.knobs,
179179
meta_internal_extra_params,

app/buck2_server/src/daemon/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl HasCommandExecutor for CommandExecutorFactory {
225225
materializer: self.materializer.dupe(),
226226
re_client: self.get_prepared_re_client(*re_use_case),
227227
re_action_key: re_action_key.clone(),
228-
re_max_queue_time_ms: options.re_max_queue_time_ms,
228+
re_max_queue_time: options.re_max_queue_time,
229229
re_resource_units: options.re_resource_units,
230230
knobs: self.executor_global_knobs.dupe(),
231231
skip_cache_read: self.skip_cache_read || !remote_cache_enabled,

0 commit comments

Comments
 (0)