@@ -21,17 +21,18 @@ use std::collections::HashMap;
2121use std:: env;
2222use std:: process:: Stdio ;
2323use std:: sync:: { Arc , Weak } ;
24+ use std:: time:: Instant ;
2425use futures:: future:: BoxFuture ;
2526use futures:: stream:: FuturesUnordered ;
2627use futures:: { Future , FutureExt , StreamExt , TryFutureExt , select} ;
27- use nativelink_config:: cas_server:: { EnvironmentSource , LocalWorkerConfig } ;
28+ use nativelink_config:: cas_server:: { EnvironmentSource , ExecutionCompletionBehaviour , LocalWorkerConfig } ;
2829use nativelink_error:: { Code , Error , ResultExt , make_err, make_input_err} ;
2930use nativelink_metric:: { MetricsComponent , RootMetricsComponent } ;
3031use nativelink_proto:: com:: github:: trace_machina:: nativelink:: remote_execution:: update_for_worker:: Update ;
3132use nativelink_proto:: com:: github:: trace_machina:: nativelink:: remote_execution:: worker_api_client:: WorkerApiClient ;
3233use nativelink_proto:: com:: github:: trace_machina:: nativelink:: remote_execution:: {
33- execute_result , ExecuteComplete , ExecuteResult , GoingAwayRequest , KeepAliveRequest ,
34- UpdateForWorker ,
34+ ExecuteComplete , ExecuteResult , GoingAwayRequest , KeepAliveRequest , UpdateForWorker ,
35+ execute_result ,
3536} ;
3637use nativelink_store:: fast_slow_store:: FastSlowStore ;
3738use nativelink_util:: action_messages:: { ActionResult , ActionStage , OperationId } ;
@@ -43,47 +44,19 @@ use nativelink_util::store_trait::Store;
4344use nativelink_util:: { spawn, tls_utils} ;
4445use opentelemetry:: context:: Context ;
4546use tokio:: process;
46- use tokio:: sync:: { broadcast, mpsc} ;
4747use tokio:: sync:: broadcast:: { Receiver , Sender } ;
48+ use tokio:: sync:: { broadcast, mpsc} ;
4849use tokio:: time:: sleep;
4950use tokio_stream:: wrappers:: UnboundedReceiverStream ;
5051use tonic:: Streaming ;
5152use tracing:: { Level , debug, error, event, info, info_span, instrument, trace, warn} ;
52-
53+ use nativelink_util :: metrics :: { WorkerMetricAttrs , LOCAL_WORKER_METRICS } ;
5354use crate :: running_actions_manager:: {
5455 ExecutionConfiguration , Metrics as RunningActionManagerMetrics , RunningAction ,
5556 RunningActionsManager , RunningActionsManagerArgs , RunningActionsManagerImpl ,
5657} ;
5758use crate :: worker_api_client_wrapper:: { WorkerApiClientTrait , WorkerApiClientWrapper } ;
5859use crate :: worker_utils:: make_connect_worker_request;
59- use futures:: future:: BoxFuture ;
60- use futures:: stream:: FuturesUnordered ;
61- use futures:: { Future , FutureExt , StreamExt , TryFutureExt , select} ;
62- use nativelink_config:: cas_server:: { ExecutionCompletionBehaviour , LocalWorkerConfig } ;
63- use nativelink_error:: { Code , Error , ResultExt , make_err, make_input_err} ;
64- use nativelink_proto:: com:: github:: trace_machina:: nativelink:: remote_execution:: update_for_worker:: Update ;
65- use nativelink_proto:: com:: github:: trace_machina:: nativelink:: remote_execution:: worker_api_client:: WorkerApiClient ;
66- use nativelink_proto:: com:: github:: trace_machina:: nativelink:: remote_execution:: {
67- ExecuteComplete , ExecuteResult , GoingAwayRequest , KeepAliveRequest , UpdateForWorker ,
68- execute_result,
69- } ;
70- use nativelink_store:: fast_slow_store:: FastSlowStore ;
71- use nativelink_util:: action_messages:: { ActionResult , ActionStage , OperationId } ;
72- use nativelink_util:: common:: fs;
73- use nativelink_util:: digest_hasher:: DigestHasherFunc ;
74- use nativelink_util:: metrics:: { LOCAL_WORKER_METRICS , WorkerMetricAttrs } ;
75- use nativelink_util:: shutdown_guard:: ShutdownGuard ;
76- use nativelink_util:: store_trait:: Store ;
77- use nativelink_util:: { spawn, tls_utils} ;
78- use opentelemetry:: context:: Context ;
79- use opentelemetry:: { InstrumentationScope , KeyValue , global, metrics} ;
80- use tokio:: process;
81- use tokio:: sync:: broadcast:: { Receiver , Sender } ;
82- use tokio:: sync:: mpsc;
83- use tokio:: time:: sleep;
84- use tokio_stream:: wrappers:: UnboundedReceiverStream ;
85- use tonic:: Streaming ;
86- use tracing:: { Level , debug, error, event, info, info_span, instrument, warn} ;
8760
8861/// Amount of time to wait if we have actions in transit before we try to
8962/// consider an error to have occurred.
@@ -338,7 +311,7 @@ impl<'a, T: WorkerApiClientTrait + 'static, U: RunningActionsManager> LocalWorke
338311 operation_id: operation_id. clone( ) ,
339312 } ;
340313 self . metrics. clone( ) . wrap( move |metrics| async move {
341- metrics. preconditions . wrap ( preconditions_met( precondition_script_cfg, & extra_envs) )
314+ metrics. wrap_preconditions ( preconditions_met( precondition_script_cfg, & extra_envs) )
342315 . and_then( |( ) | running_actions_manager. create_and_add_action( worker_id, start_execute) )
343316 . map( move |r| {
344317 // Now that we either failed or registered our action, we can
0 commit comments