Line data Source code
1 : #include "fdctl.h" 2 : 3 : #include "run/run.h" 4 : 5 : #include "../../tango/fd_tango.h" 6 : 7 : void 8 : ready_cmd_fn( args_t * args, 9 0 : config_t * const config ) { 10 0 : (void)args; 11 : 12 0 : ulong wksp_id = fd_topo_find_wksp( &config->topo, "metric_in" ); 13 0 : FD_TEST( wksp_id!=ULONG_MAX ); 14 : 15 0 : fd_topo_join_workspace( &config->topo, &config->topo.workspaces[ wksp_id ], FD_SHMEM_JOIN_MODE_READ_ONLY ); 16 0 : fd_topo_workspace_fill( &config->topo, &config->topo.workspaces[ wksp_id ] ); 17 : 18 0 : for( ulong i=0; i<config->topo.tile_cnt; i++) { 19 0 : fd_topo_tile_t * tile = &config->topo.tiles[i]; 20 : 21 : /* Don't wait for agave hosted tiles yet, they will take a 22 : long time, and aren't needed to start sending transactions 23 : anyway. */ 24 0 : if( FD_UNLIKELY( tile->is_agave ) ) continue; 25 : 26 : /* Don't wait for thread tiles, they will not report ready. */ 27 0 : if( strncmp( tile->name, "thread", 7 )==0 ) continue; 28 : 29 0 : long start = fd_log_wallclock(); 30 0 : int printed = 0; 31 0 : do { 32 0 : ulong status = fd_metrics_tile( tile->metrics )[ FD_METRICS_GAUGE_STEM_STATUS_OFF ]; 33 : 34 0 : if( FD_LIKELY( status==1UL ) ) break; 35 0 : else if( FD_UNLIKELY( status ) ) 36 0 : FD_LOG_ERR(( "status for tile %s:%lu is in bad state %lu", tile->name, tile->kind_id, status )); 37 : 38 0 : if( FD_UNLIKELY( !printed && (fd_log_wallclock()-start) > 2L*1000*1000*1000L ) ) { 39 0 : FD_LOG_NOTICE(( "waiting for tile %s:%lu to be ready", tile->name, tile->kind_id )); 40 0 : printed = 1; 41 0 : } 42 0 : } while(1); 43 0 : } 44 : 45 0 : fd_topo_leave_workspaces( &config->topo ); 46 0 : FD_LOG_NOTICE(( "all tiles ready" )); 47 0 : }