cortex.client package¶
Subpackages¶
Submodules¶
cortex.client.client module¶
-
cortex.client.client.project_client_should_send(available_parsers)¶ This is a function that defines the context of the client, wether he should send data to the server or not, according to the available parsers infromation he received from the server (or any other potentional information that might develop in the future) for our project purposes, this always returns True cause we’re always sending snapshots no matter. FOR_DEVELOPERS: if things change, wanting clients sending specific params only, this function must be implemented. only supports state-less contexts for now
-
cortex.client.client.proto_prepare_snapshot_for_takeoff(snapshot)¶ this functions serializes the snapshot that was read by the Reader, in a format that is appropriate for the server. here we don’t do anything since the server is expecitng a format that is identical to the one that we read the file from.
-
cortex.client.client.proto_prepare_user_for_takeoff(user)¶ this functions takes the User struct that has been read and de-serialized by our Reader and serializes them in the format that the server is expecting. in this specific case (our project case), the format read is identical to the one the server is expecting since I used the same protobuf, so all we need to do is Re-serialize the struct before takeoff PROJECT_EXPLANATION: lets say, we need to change the reading format from protobuf to STUPID. in this case, we need to take the StupidUser() that was generated by the Reader and serialize them to the proto format the server is expecting, that way the server goes uninterrupted by future changes
-
cortex.client.client.upload_sample(host, port, path, client_context=<function project_client_should_send>)¶