Conversation
| user_id, source, activity, | ||
| event['blob'] | ||
| ) | ||
| elif event['event'] == 'fetch_blob': |
There was a problem hiding this comment.
@bradley-erickson I am wondering how this will play with client-side code. Ideally, this would be spent back before we're done with metadata / init / headers / auth (before the events start streaming).
We should chat in the morning about whether the client should request this when opening the websocket or whether this should be automatically sent.
| ''' | ||
| key = _make_key(user_id, source, activity) | ||
| kvs = learning_observer.kvs.KVS() | ||
| return await kvs[key] |
There was a problem hiding this comment.
What happens if the key is missing from the kvs? Should probably return that there was nothing (empty object or None).
There was a problem hiding this comment.
That's fine for now. null and not None.
$ json.dumps(None)
'null'
In the long term, we should support having a default value. In the long term, I would envision this being part of a module rather than the core. But we've got a long way before we're ready for that.
(Also, note that's different from json.dumps("null") which is '"null"')
|
To get the code to work properly, you'll need to include both the redux and websocket logger as well as a locked field specifying the activity. lo_event.init(
"org.ets.sba",
"0.0.1",
[consoleLogger(), reduxLogger.reduxLogger([], {}), websocketLogger.websocketLogger('ws://localhost:8888/wsapi/in/')],
// ...
);
lo_event.setFieldSet([{ activity: 'toy-sba' }]);
lo_event.go();
lo_event.logEvent('fetch_blob', {}); |
* code compiling for deployment of toy-sba * state sync implemented, state load backed out * persist redux store in local storage * removed unused npm packages * added draft of server side blob storage * blob loading functionality passed to Brad * updated lo event to allow for fetching/retrieving state * change to handleLoadState to return IS_LOADED in state * added lo_toy_sba module * change to how state is returned in redux logger * changing reset logic * handle save_setting event in redux logger * code cleanup * toy sba module cleanup * small styling changes * debug logic for save state added * save_blob fix * cleaned up console statements and linted reduxlogger --------- Co-authored-by: Paul Brost <pbrost@ets.org>
* code compiling for deployment of toy-sba * state sync implemented, state load backed out * persist redux store in local storage * removed unused npm packages * added draft of server side blob storage * blob loading functionality passed to Brad * updated lo event to allow for fetching/retrieving state * change to handleLoadState to return IS_LOADED in state * added lo_toy_sba module * change to how state is returned in redux logger * changing reset logic * handle save_setting event in redux logger * code cleanup * toy sba module cleanup * small styling changes * debug logic for save state added * save_blob fix * cleaned up console statements and linted reduxlogger --------- Co-authored-by: Paul Brost <pbrost@ets.org>
This pull request implements the ability to save and load state within LO Event. This includes both clientside and server-side storage.
Branch: Pbrost/coglabs deployment