IEnumerator PollNetwork() { Debug.Log("Starting poll"); var getJobIdRequest = new GetAvailableJobIdRequest(); yield return getJobIdRequest.RunRequest(); var jobId = getJobIdRequest.GetResponse().jobId; while (jobId == null || jobId == "") { Debug.Log("No available jobs. Trying again in 2 seconds"); yield return new WaitForSeconds(2); getJobIdRequest = new GetAvailableJobIdRequest(); yield return getJobIdRequest.RunRequest(); jobId = getJobIdRequest.GetResponse().jobId; } var getJobRequest = new GetJobRequest(jobId); yield return getJobRequest.RunRequest(); var jobHash = getJobRequest.GetResponse().jobAddress; var job = Ipfs.Ipfs.Get<IpfsJob>(jobHash); var controller = Camera.main.GetComponent<SyftServer>().controller; var grid = new OpenMined.Network.Controllers.Grid(controller); var result = grid.TrainModel(job); var response = new AddResultRequest(jobHash, result); yield return response.RunRequest(); Debug.Log("did a job"); yield return PollNetwork(); }
private void Start() { _netMqPublisher = new NetMqPublisher(HandleMessage); _netMqPublisher.Start(); controller = new SyftController(shader); var experiment = Ipfs.Get <IpfsExperiment>("QmVPQnsuks1cCbTMFGqpmHa4M45uUuKRomiqNvJEQAtcRS"); var job = Ipfs.Get <IpfsJob>(experiment.jobs[0]); var g = new OpenMined.Network.Controllers.Grid(controller); //g.TrainModel(this, experiment.input, experiment.target, job, 1); }
IEnumerator PollNetwork() { var getJobIdRequest = new GetAvailableJobIdRequest(); yield return(getJobIdRequest.RunRequest()); var jobId = getJobIdRequest.GetResponse().jobId; if (jobId == null) { yield return(new WaitForSeconds(10)); PollNext(); } else { var getJobRequest = new GetJobRequest(jobId); yield return(getJobRequest.RunRequest()); var jobHash = getJobRequest.GetResponse().jobAddress; var job = Ipfs.Get <IpfsJob>(jobHash); var controller = Camera.main.GetComponent <SyftServer>().controller; var grid = new OpenMined.Network.Controllers.Grid(controller); var result = grid.TrainModel(job); var response = new AddResultRequest(jobHash, result); yield return(response.RunRequest()); Debug.Log("did a job"); yield return(new WaitForSeconds(10)); PollNext(); } }