/// <summary> /// Inversely working method /// </summary> /// <param name="job"></param> /// <returns></returns> private bool CantAccept(CanAcceptJob job) { if (_nodeInfoList.Count == 0) { return(false); } foreach (var nodeInfo in _nodeInfoList) { //gets the first node that fits our requirements //easy way if ((nodeInfo.AvailableCores - (job._processInfo._requiredCores / 2.0)) >= 0.0) { //WARNING PLACE!!! nodeInfo.DecrementCoreAndProcess(_coreDelta: (job._processInfo._requiredCores / 2.0), _processDelta: job._processInfo._requiredCores); //self tell to dispath to one of available nodes Self.Tell(new DispatchTo(job._processInfo, nodeInfo.ActorPath)); return(false); } } return(true); }
private void Ready() { Receive <ValidateRepo>(repoAddress => { GetRepoStatusCoordinator().Tell(repoAddress); repoValidatorActor.Tell(repoAddress); }); // something went wrong while querying github Receive <InvalidRepo>(repo => GetRepoStatusCoordinator().Tell(repo)); // Octokit was able to retrieve this repository Receive <Repository>(repository => { GetRepoStatusCoordinator().Tell(new ValidRepo(repository.HtmlUrl)); //ask the GithubCommander if we can accept this job var canAccessJob = new CanAcceptJob(repository.Name, repository.Owner.Login); GetRepoStatusCoordinator().Tell(canAccessJob); githubCommanderActor.Tell(canAccessJob); }); // REPO is valid, but there already has job running Receive <UnableToAcceptJob>(job => GetRepoStatusCoordinator().Tell(job)); Receive <AbleToAcceptJob>(job => { GetRepoStatusCoordinator().Tell(job); var mainformActor = Context.ActorOf( Props.Create <MainFormActor>(), ActorNames.MainForm); mainformActor.Tell(new ProcessRepo(job)); }); }