worker.coordinator.coordinator¶
TaskState¶
Coordinator¶
- class ding.worker.coordinator.coordinator.Coordinator(cfg: dict)[source]¶
- Overview:
the coordinator will manage parallel tasks and data
- Interface:
__init__, start, close, __del__, state_dict, load_state_dict, deal_with_collector_send_data, deal_with_collector_finish_task, deal_with_learner_get_data, deal_with_learner_send_info, deal_with_learner_finish_task
- Property:
system_shutdown_flag
- __init__(cfg: dict) None [source]¶
- Overview:
init method of the coordinator
- Arguments:
cfg (
dict
): the config file to init the coordinator
- close() None [source]¶
- Overview:
- Close the coordinator, including closing the interaction thread, the collector learner threads and the
buffers.
- deal_with_collector_finish_task(task_id: str, finished_task: dict) None [source]¶
- Overview:
finish the collector task
- Arguments:
task_id (
str
): the collector task_idfinished_task (
dict
): the finished_task
- deal_with_collector_send_data(task_id: str, buffer_id: str, data_id: str, data: dict) None [source]¶
- Overview:
deal with the data send from collector
- Arguments:
task_id (
str
): the collector task_idbuffer_id (
str
): the buffer_iddata_id (
str
): the data_iddata (
str
): the data to dealt with
- deal_with_learner_finish_task(task_id: str, finished_task: dict) None [source]¶
- Overview:
finish the learner task, close the corresponding buffer
- Arguments:
task_id (
str
): the learner task_idfinished_task (
dict
): the dict of task to finish
- deal_with_learner_get_data(task_id: str, buffer_id: str, batch_size: int, cur_learner_iter: int) List[dict] [source]¶
- Overview:
learner get the data from buffer
- Arguments:
task_id (
str
): the learner task_idbuffer_id (
str
): the buffer_idbatch_size (
int
): the batch_size to samplecur_learn_iter (
int
): the current learner iter num
- deal_with_learner_send_info(task_id: str, buffer_id: str, info: dict) None [source]¶
- Overview:
the learner send the info and update the priority in buffer
- Arguments:
task_id (
str
): the learner task idbuffer_id (
str
): the buffer_id of buffer to add info toinfo (
dict
): the info to add
- info(s: str) None [source]¶
- Overview:
Return the info
- Arguments:
s (
str
): the string to print in info
- start() None [source]¶
- Overview:
Start the coordinator, including lunching the interaction thread and the collector learner threads.
- property system_shutdown_flag: bool¶
- Overview:
Return whether the system is shutdown
- Returns:
system_shutdown_flag (
bool
): whether the system is shutdown