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