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