openfl.component.assigner.assigner.Assigner

class openfl.component.assigner.assigner.Assigner(tasks, authorized_cols, rounds_to_train, **kwargs)

Bases: object

The task assigner maintains a list of tasks.

Also it decides the policy for which collaborator should run those tasks. There may be many types of policies implemented, but a natural place to start is with a:

  • RandomGroupedTaskAssigner :

    Given a set of task groups, and a percentage, assign that task group to that percentage of collaborators in the federation. After assigning the tasks to collaborator, those tasks should be carried out each round (no reassignment between rounds).

  • GroupedTaskAssigner :

    Given task groups and a list of collaborators that belong to that task group, carry out tasks for each round of experiment.

Class Attributes:
  • tasks* (list of object) – List of tasks to assign.

  • authorized_cols (list of str) – Collaborators.

  • rounds (int) – Number of rounds to train.

  • all_tasks_in_groups (list) – All tasks in groups.

  • task_group_collaborators (dict) – Task group collaborators.

  • collaborators_for_task (dict) – Collaborators for each task.

  • collaborator_tasks (dict) – Tasks for each collaborator.

Note

* - tasks argument is taken from tasks section of FL plan YAML file.

Methods

define_task_assignments

Abstract method.

get_aggregation_type_for_task

Extract aggregation type from self.tasks.

get_all_tasks_for_round

Return tasks for the current round.

get_collaborators_for_task

Abstract method.

get_tasks_for_collaborator

Abstract method.

define_task_assignments()

Abstract method.

get_aggregation_type_for_task(task_name)

Extract aggregation type from self.tasks.

Parameters:

task_name (str) – Name of the task.

Returns:

str – Aggregation type for the task.

get_all_tasks_for_round(round_number)

Return tasks for the current round.

Currently all tasks are performed on each round, But there may be a reason to change this.

Parameters:

round_number (int) – Round number.

Returns:

list – List of tasks for the current round.

get_collaborators_for_task(task_name, round_number)

Abstract method.

get_tasks_for_collaborator(collaborator_name, round_number)

Abstract method.