@@ -257,7 +257,7 @@ CoreWorker::CoreWorker(CoreWorkerOptions options, const WorkerID &worker_id)
257
257
worker_context_(options_.worker_type, worker_id, GetProcessJobID(options_)),
258
258
io_work_(io_service_),
259
259
client_call_manager_(new rpc::ClientCallManager(io_service_)),
260
- periodical_runner_(io_service_),
260
+ periodical_runner_(PeriodicalRunner::Create( io_service_) ),
261
261
task_queue_length_(0 ),
262
262
num_executed_tasks_(0 ),
263
263
resource_ids_(new ResourceMappingType()),
@@ -327,7 +327,7 @@ CoreWorker::CoreWorker(CoreWorkerOptions options, const WorkerID &worker_id)
327
327
options_.raylet_ip_address , options_.node_manager_port , *client_call_manager_);
328
328
329
329
if (options_.worker_type != WorkerType::DRIVER) {
330
- periodical_runner_. RunFnPeriodically (
330
+ periodical_runner_-> RunFnPeriodically (
331
331
[this ] { ExitIfParentRayletDies (); },
332
332
RayConfig::instance ().raylet_death_check_interval_milliseconds (),
333
333
" CoreWorker.ExitIfParentRayletDies" );
@@ -451,11 +451,11 @@ CoreWorker::CoreWorker(CoreWorkerOptions options, const WorkerID &worker_id)
451
451
});
452
452
453
453
object_info_publisher_ = std::make_unique<pubsub::Publisher>(
454
- /* channels=*/ std::vector<
455
- rpc::ChannelType>{rpc::ChannelType::WORKER_OBJECT_EVICTION,
456
- rpc::ChannelType::WORKER_REF_REMOVED_CHANNEL,
457
- rpc::ChannelType::WORKER_OBJECT_LOCATIONS_CHANNEL},
458
- /* periodical_runner=*/ & periodical_runner_,
454
+ /* channels=*/
455
+ std::vector< rpc::ChannelType>{rpc::ChannelType::WORKER_OBJECT_EVICTION,
456
+ rpc::ChannelType::WORKER_REF_REMOVED_CHANNEL,
457
+ rpc::ChannelType::WORKER_OBJECT_LOCATIONS_CHANNEL},
458
+ /* periodical_runner=*/ * periodical_runner_,
459
459
/* get_time_ms=*/ []() { return absl::GetCurrentTimeNanos () / 1e6 ; },
460
460
/* subscriber_timeout_ms=*/ RayConfig::instance ().subscriber_timeout_ms (),
461
461
/* publish_batch_size_=*/ RayConfig::instance ().publish_batch_size (),
@@ -791,7 +791,7 @@ CoreWorker::CoreWorker(CoreWorkerOptions options, const WorkerID &worker_id)
791
791
const auto event_stats_print_interval_ms =
792
792
RayConfig::instance ().event_stats_print_interval_ms ();
793
793
if (event_stats_print_interval_ms != -1 && RayConfig::instance ().event_stats ()) {
794
- periodical_runner_. RunFnPeriodically (
794
+ periodical_runner_-> RunFnPeriodically (
795
795
[this ] {
796
796
RAY_LOG (INFO) << " Event stats:\n\n "
797
797
<< io_service_.stats ().StatsString () << " \n\n "
@@ -811,7 +811,7 @@ CoreWorker::CoreWorker(CoreWorkerOptions options, const WorkerID &worker_id)
811
811
ray::rpc::Event_SourceType::Event_SourceType_CORE_WORKER,
812
812
{{" worker_id" , worker_id.Hex ()}});
813
813
814
- periodical_runner_. RunFnPeriodically (
814
+ periodical_runner_-> RunFnPeriodically (
815
815
[this ] {
816
816
const auto lost_objects = reference_counter_->FlushObjectsToRecover ();
817
817
if (!lost_objects.empty ()) {
@@ -836,17 +836,17 @@ CoreWorker::CoreWorker(CoreWorkerOptions options, const WorkerID &worker_id)
836
836
100 ,
837
837
" CoreWorker.RecoverObjects" );
838
838
839
- periodical_runner_. RunFnPeriodically (
839
+ periodical_runner_-> RunFnPeriodically (
840
840
[this ] { InternalHeartbeat (); },
841
841
RayConfig::instance ().core_worker_internal_heartbeat_ms (),
842
842
" CoreWorker.InternalHeartbeat" );
843
843
844
- periodical_runner_. RunFnPeriodically (
844
+ periodical_runner_-> RunFnPeriodically (
845
845
[this ] { RecordMetrics (); },
846
846
RayConfig::instance ().metrics_report_interval_ms () / 2 ,
847
847
" CoreWorker.RecordMetrics" );
848
848
849
- periodical_runner_. RunFnPeriodically (
849
+ periodical_runner_-> RunFnPeriodically (
850
850
[this ] { TryDeleteObjectRefStreams (); },
851
851
RayConfig::instance ().local_gc_min_interval_s () * 1000 ,
852
852
" CoreWorker.GCStreamingGeneratorMetadata" );
@@ -3014,9 +3014,9 @@ std::unique_ptr<worker::ProfileEvent> CoreWorker::CreateProfileEvent(
3014
3014
}
3015
3015
3016
3016
void CoreWorker::RunTaskExecutionLoop () {
3017
- PeriodicalRunner signal_checker (task_execution_service_);
3017
+ auto signal_checker = PeriodicalRunner::Create (task_execution_service_);
3018
3018
if (options_.check_signals ) {
3019
- signal_checker. RunFnPeriodically (
3019
+ signal_checker-> RunFnPeriodically (
3020
3020
[this ] {
3021
3021
// / The overhead of this is only a single digit microsecond.
3022
3022
auto status = options_.check_signals ();
0 commit comments