georgymh / decentralized-ml

Interoperable and decentralized machine learning.
Apache License 2.0
9 stars 5 forks source link

Communication job #31

Closed kiddyboots216 closed 5 years ago

kiddyboots216 commented 5 years ago

This PR currently

kiddyboots216 commented 5 years ago

"I would consider keeping the .travis.yml comments. They're useful." You...literally asked them to be removed in the Google doc...but sure.

"Since this PR is adding the Blockchain Gateway to the bootstrapper, can we have instructions on how to run the dml command locally and tinker with the BG? (Ideally we're able to replicate the demo you did during the last meeting.)" The instructions are already in the README on Master.

"Look into removing set_weights and set_keys in the DMLJob." Definitely should do this.

"Explain the rationale of adding do_nothing(), NEW_SESSION, and TERMINATE to the Optimizer." Rationale is already explained in the docstring.

"Can we do some error checking in the runner's _communicate() routine? What if the setter doesn't return a valid tx_receipt? Should that instead return a failed DMLResult?" tx_receipt contains errors in consensus, as for actual errors in the service that needs to be handled with the general changes to Runner error-handling. So I don't think so.

"Make L63 of the integration tests more explicit." Can you elaborate?

Everything else addressed with the exception of scheduling communication_job, which as it turns out doesn't work very well. I've tried debugging this for a while but can't make any headway.

georgymh commented 5 years ago

The instructions are already in the README on Master.

It's incomplete though. You should add instructions/snippets to submit DML requests through the Blockchain Gateway after running dml.

Rationale is already explained in the docstring.

I checked again and didn't see any rationale. I will just answer it here for documentation purposes (and so that other reviewers are aware of the whys):

"Make L63 of the integration tests more explicit." Can you elaborate?

Use something like:

function(arg1=a, arg2=b, arg3=c)

But properly indented.

kiddyboots216 commented 5 years ago

There is no such thing as "submitting DML requests through the Blockchain Gateway after running DML". Explora is the only interface for users to submit anything to the blockchain. The DML Service doesn't expose any such interface. Addressed your other comment.

georgymh commented 5 years ago

We should be able to mock that, no? Is there a way to have only one node in the network and do the same HTTP request that explora would be doing to set something on the blockchain?

I think on your demo you were starting with a blockchain that already had a job/DML request in it. That would work too. The point is to allow us to do more than just run dml and patiently wait for nothing.

kiddyboots216 commented 5 years ago

The easiest way is to create a pytest which sets exactly what you want to the chain, run that pytest only and then start the DML service without resetting the chain. I can make the process easier after the next blockchain PR is merged but it's not really feasible to add to this PR.

georgymh commented 5 years ago

Rather than a test, could we have a utils we could execute from command line? I'm also ok with calling curl manually. We just need instructions on the README.

kiddyboots216 commented 5 years ago

No, it's not feasible to do it from command line. You would have to make the model_json, make a DMLJob, serialize the job, make a session, put the session into ipfs, get the content hash, and then put that onto the blockchain. Calling curl is doable, sure, but the blockchain is going to change anyway, so this is not a good use of time for this PR. Anyways I've updated the README with instructions for this, I suppose.

georgymh commented 5 years ago

Ok, seems like you ended up updating the README anyways.

What's <your DML session here>? Can you put an example DML session there? Or make the function calls necessary to create one?

georgymh commented 5 years ago

Cool. Thanks for "wasting" your time in 2578551 as a way to avoid the team actually wasting its collective time trying to make code they didn't write work. In fact, let's "waste" our time more often.

On a more serious note though, a few of the points I put above weren't addressed (like the travis file one, the .gitignore one, removing the DMLJob functions/explaining why they should be there, and adding docstrings for the new properties in the DMLJob constructor). Please address them and I will take a look at the tests tomorrow. They look comprehensive, which is good.

neeleshdodda44 commented 5 years ago

Good work. Left some comments, I'll review again after you address those.

Please try to keep PRs smaller in the future! (195 commits before I started reviewing :( )

kiddyboots216 commented 5 years ago

Fixed the bug with Scheduler; it was using collections.deque which is not multiprocessing-safe or thread-safe.