Closed genekogan closed 3 years ago
Something very similar (but not involving callbacks) is already happening in the host_block()
method. The results_dir = 'results'
arg specifies the name of the folder where eden should save all of the completed tasks as json files.
The files are stored as: <results_dir>/<token>.json
When the user comes back after a long time and runs fetch()
, eden simply reads the file from json and returns it. So in theory, no output is lost on eden's side unless the host deletes the results
folder.
But what if the user doesnt ever run fetch()
after running a task ? then that result remains on the eden host server until we build a mechanism which can fetch all of the new/unfetched results from eden into abraham's side.
For a prototype, we could build a new function await_outputs()
into the Client
wrapper which runs a while loop until it gets {'status':'complete'}
If it is the responsibility of the client (e.g. Abraham) to post-process the results (e.g. saving resulting images as static files), then in addition to
fetch
, there should be some way for the client to pass a callback function to the block, which is to be called at the end of therun
. This would prevent losing the results in case of a hangup on the browser side.