@@ -18,7 +18,6 @@ use std::sync::OnceLock;
18
18
19
19
use async_trait:: async_trait;
20
20
use enum_as_inner:: EnumAsInner ;
21
- use hyperactor:: ActorRef ;
22
21
use hyperactor:: ProcId ;
23
22
use hyperactor:: WorldId ;
24
23
use hyperactor:: channel;
@@ -31,7 +30,6 @@ use hyperactor::channel::Tx;
31
30
use hyperactor:: channel:: TxStatus ;
32
31
use hyperactor:: sync:: flag;
33
32
use hyperactor:: sync:: monitor;
34
- use hyperactor_state:: state_actor:: StateActor ;
35
33
use ndslice:: Shape ;
36
34
use nix:: sys:: signal;
37
35
use nix:: unistd:: Pid ;
@@ -53,7 +51,6 @@ use crate::bootstrap::Allocator2Process;
53
51
use crate :: bootstrap:: Process2Allocator ;
54
52
use crate :: bootstrap:: Process2AllocatorMessage ;
55
53
use crate :: log_source:: LogSource ;
56
- use crate :: log_source:: StateServerInfo ;
57
54
use crate :: shortuuid:: ShortUuid ;
58
55
59
56
/// The maximum number of log lines to tail keep for managed processes.
@@ -151,38 +148,29 @@ struct Child {
151
148
impl Child {
152
149
fn monitored (
153
150
mut process : tokio:: process:: Child ,
154
- state_server_info : StateServerInfo ,
151
+ log_channel : ChannelAddr ,
155
152
) -> ( Self , impl Future < Output = ProcStopReason > ) {
156
153
let ( group, handle) = monitor:: group ( ) ;
157
154
let ( exit_flag, exit_guard) = flag:: guarded ( ) ;
158
155
let stop_reason = Arc :: new ( OnceLock :: new ( ) ) ;
159
156
160
- // TODO(lky): enable state actor branch and remove this flag
161
- let use_state_actor = false ;
162
-
163
157
// Set up stdout and stderr writers
164
158
let mut stdout_tee: Box < dyn io:: AsyncWrite + Send + Unpin + ' static > =
165
159
Box :: new ( io:: stdout ( ) ) ;
166
160
let mut stderr_tee: Box < dyn io:: AsyncWrite + Send + Unpin + ' static > =
167
161
Box :: new ( io:: stderr ( ) ) ;
168
162
169
- // If state actor is enabled, try to set up LogWriter instances
170
- if use_state_actor {
171
- let state_actor_ref = ActorRef :: < StateActor > :: attest ( state_server_info. state_actor_id ) ;
172
- let state_actor_addr = state_server_info. state_proc_addr ;
173
- // Use the helper function to create both writers at once
174
- match hyperactor_state:: log_writer:: create_log_writers (
175
- state_actor_addr,
176
- state_actor_ref,
177
- process. id ( ) . unwrap_or ( 0 ) ,
178
- ) {
179
- Ok ( ( stdout_writer, stderr_writer) ) => {
180
- stdout_tee = stdout_writer;
181
- stderr_tee = stderr_writer;
182
- }
183
- Err ( e) => {
184
- tracing:: error!( "failed to create log writers: {}" , e) ;
185
- }
163
+ // Use the helper function to create both writers at once
164
+ match hyperactor_state:: log_writer:: create_log_writers (
165
+ log_channel,
166
+ process. id ( ) . unwrap_or ( 0 ) ,
167
+ ) {
168
+ Ok ( ( stdout_writer, stderr_writer) ) => {
169
+ stdout_tee = stdout_writer;
170
+ stderr_tee = stderr_writer;
171
+ }
172
+ Err ( e) => {
173
+ tracing:: error!( "failed to create log writers: {}" , e) ;
186
174
}
187
175
}
188
176
@@ -367,12 +355,14 @@ impl ProcessAlloc {
367
355
let mut cmd = self . cmd . lock ( ) . await ;
368
356
let index = self . index ;
369
357
self . index += 1 ;
358
+ let log_channel: ChannelAddr = ChannelAddr :: any ( ChannelTransport :: Unix ) ;
370
359
371
360
cmd. env (
372
361
bootstrap:: BOOTSTRAP_ADDR_ENV ,
373
362
self . bootstrap_addr . to_string ( ) ,
374
363
) ;
375
364
cmd. env ( bootstrap:: BOOTSTRAP_INDEX_ENV , index. to_string ( ) ) ;
365
+ cmd. env ( bootstrap:: BOOTSTRAP_LOG_CHANNEL , log_channel. to_string ( ) ) ;
376
366
cmd. stdout ( Stdio :: piped ( ) ) ;
377
367
cmd. stderr ( Stdio :: piped ( ) ) ;
378
368
@@ -398,8 +388,7 @@ impl ProcessAlloc {
398
388
None
399
389
}
400
390
Ok ( rank) => {
401
- let ( handle, monitor) =
402
- Child :: monitored ( process, self . log_source . server_info ( ) ) ;
391
+ let ( handle, monitor) = Child :: monitored ( process, log_channel) ;
403
392
self . children . spawn ( async move { ( index, monitor. await ) } ) ;
404
393
self . active . insert ( index, handle) ;
405
394
// Adjust for shape slice offset for non-zero shapes (sub-shapes).
0 commit comments