Ejemplo n.º 1
0
def main() -> None:
    """Entry point to start a participant."""
    parser = argparse.ArgumentParser(description="Prepare data for regression")
    parser.add_argument(
        "--data-directory",
        type=str,
        help="path to the directory that contains the data",
    )
    parser.add_argument(
        "--coordinator-url",
        type=str,
        required=True,
        help="URL of the coordinator",
    )
    args = parser.parse_args()

    # pylint: disable=invalid-name
    logging.basicConfig(
        format="%(asctime)s.%(msecs)03d %(levelname)8s %(message)s",
        level=logging.DEBUG,
        datefmt="%b %d %H:%M:%S",
    )

    participant = spawn_participant(args.coordinator_url,
                                    Participant,
                                    args=(args.data_directory, ))

    try:
        participant.join()
    except KeyboardInterrupt:
        participant.stop()
Ejemplo n.º 2
0
def main() -> None:
    logging.basicConfig(
        format="%(asctime)s.%(msecs)03d %(levelname)8s %(message)s",
        level=logging.DEBUG,
        datefmt="%b %d %H:%M:%S",
    )

    participant = xaynet_sdk.spawn_participant(
        "http://127.0.0.1:8081",
        Participant,
        args=(
            1,
            [0.1, 0.2, 0.345, 0.3],
        ),
    )

    participant_2 = xaynet_sdk.spawn_participant(
        "http://127.0.0.1:8081",
        Participant,
        args=(
            2,
            [0.3, 0.4, 0.45, 0.1],
        ),
    )

    participant_3 = xaynet_sdk.spawn_participant(
        "http://127.0.0.1:8081",
        Participant,
        args=(
            3,
            [0.123, 0.1567, 0.123, 0.46, 0.24],
        ),
    )

    try:
        participant.join()
        participant_2.join()
        participant_3.join()
    except KeyboardInterrupt:
        participant.stop()
        participant_2.stop()
        participant_3.stop()