openfl icon indicating copy to clipboard operation
openfl copied to clipboard

Director / Envoy option to prompt user for experiment review before execution

Open psfoley opened this issue 2 years ago • 2 comments

The interactive API is currently intended for environments where the user wishes to do frequent experimentation without needing to redistribute the workload manually. To make the interactive API safer for production environments, there should be an option to deploy the envoy and director in such a way that users can review the contents of the workload prior to execution.

psfoley avatar Mar 16 '22 23:03 psfoley

We can try to use inspect module to get a source code from pickle object. https://docs.python.org/3/library/inspect.html#inspect.getsource

dmitryagapov avatar Mar 18 '22 15:03 dmitryagapov

Unfortunately both inspect.getsource and dill.source.getsource are not a reliable way to regenerate the code in many cases (especially when the code is created in a jupyter notebook / ipython session). Here are some examples:

# 1. Start Director, Envoy
# 2. Launch Experiment via Jupyter Notebook
# 3. From a python terminal in the workspace directory, run the following:
model_obj = restore_object('model_obj.pkl')
inspect.getsource(model.model)
# fails
[print(line) for line in dill.source.getsource(model_obj.model).splitlines()]
# Prints model __init__ function, not entirety of model definition
tasks_obj = restore_object('tasks_obj.pkl')
dill.source.getsource(tasks_obj.task_registry['validate'])
# Returns wrapper decorator definition, not actual validation function

An alternative could be serializing and sending the jupyter notebook (or python script) that launches the experiment for review, but the remote user needs a way to verify that the serialized workload was produced by that script, and this may not be deterministic operation if the remote participants wanted to reserialize the workload to verify its integrity independently.

psfoley avatar Mar 22 '22 23:03 psfoley

Closed by https://github.com/intel/openfl/pull/489

psfoley avatar Dec 12 '22 17:12 psfoley