xain_sdk package

Provides xain package SDK

xain_sdk.configure_logging(log_http_requests=False)

Submodules

xain_sdk.http module

class xain_sdk.http.AggregatorClient(url, id, token)

Bases: object

download()
Return type

bytes

upload(data)
class xain_sdk.http.AnonymousCoordinatorClient(url)

Bases: object

rendez_vous()
exception xain_sdk.http.ApiError(response, *args, **kwargs)

Bases: Exception

class xain_sdk.http.Clients

Bases: object

class xain_sdk.http.CoordinatorClient(url, id)

Bases: object

heartbeat()
start_training()
class xain_sdk.http.HttpClient(url)

Bases: object

build_req(method, path, **kwargs)
static check_response(resp, status=200)
delete(path, status=204, **kwargs)
get(path, status=200, **kwargs)
static headers()
patch(path, status=200, **kwargs)
post(path, status=200, **kwargs)
put(path, status=200, **kwargs)
send(req, status=200)
url(path)
exception xain_sdk.http.StartTrainingRejected

Bases: Exception

xain_sdk.http.log_headers(headers)
xain_sdk.http.log_request(req)
xain_sdk.http.log_response(resp)

xain_sdk.participant module

exception xain_sdk.participant.DeserializationError

Bases: xain_sdk.participant.ParticipantError

class xain_sdk.participant.HeartBeatWorker(coordinator_client, state_record, exit_event, heartbeat_period)

Bases: threading.Thread

heartbeat()
run()

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class xain_sdk.participant.InternalParticipant(participant, coordinator_url, heartbeat_period)

Bases: object

rendez_vous()
run()
Return type

None

start_heartbeat()
train()
Return type

None

class xain_sdk.participant.ParticipantABC

Bases: abc.ABC

abstract deserialize_training_input(data)
Return type

~TrainingInput

abstract serialize_training_result(training_result)
Return type

bytes

abstract train_round(training_input)
Return type

~TrainingResult

exception xain_sdk.participant.ParticipantError

Bases: Exception

exception xain_sdk.participant.SerializationError

Bases: xain_sdk.participant.ParticipantError

class xain_sdk.participant.State

Bases: enum.Enum

An enumeration.

DONE = 3
TRAINING = 2
WAITING = 1
class xain_sdk.participant.StateRecord(state=<State.WAITING: 1>, round=-1)

Bases: object

assert_locked()
lookup()
Return type

Tuple[State, int]

set_round(round)
Return type

None

set_state(state)
Return type

None

wait_until_selected_or_done()
Return type

State

exception xain_sdk.participant.TrainingError

Bases: xain_sdk.participant.ParticipantError

xain_sdk.utils module

xain_sdk.utils.configure_logging(log_http_requests=False)