public void testWatchedJob_prepareRetryJob_singleItem() { final JobDispatcher dispatcher = new JobDispatcher(); final FunctionBlacklistMaintainer blacklist = Mockito.mock(FunctionBlacklistMaintainer.class); dispatcher.setFunctionBlacklistMaintainer(blacklist); final CalculationJob job = new CalculationJob( createJobSpecification(), 0, null, Arrays.asList(JOB_ITEM_A), CacheSelectHint.allShared()); final JobResultReceiver receiver = Mockito.mock(JobResultReceiver.class); final StandardJob standard = new StandardJob(dispatcher, job, receiver); final WatchedJob watched = new WatchedJob.Whole(standard, job, receiver); watched.prepareRetryJob(null); Mockito.verify(blacklist).failedJobItem(JOB_ITEM_A); }
public void testStandardJob_createWatchedJob_singleItem() { final JobDispatcher dispatcher = new JobDispatcher(); final FunctionBlacklistMaintainer blacklist = Mockito.mock(FunctionBlacklistMaintainer.class); dispatcher.setFunctionBlacklistMaintainer(blacklist); final CalculationJob job = new CalculationJob( createJobSpecification(), 0, null, Arrays.asList(JOB_ITEM_A), CacheSelectHint.allShared()); final StandardJob standard = new StandardJob(dispatcher, job, Mockito.mock(JobResultReceiver.class)); final WatchedJob watched = standard.createWatchedJob(); assertNull(watched); Mockito.verify(blacklist).failedJobItem(JOB_ITEM_A); }
@Override public synchronized void jobFinished(boolean success, NodeJob job) throws RemoteException { if (!success) { dispatcher.enqueue(job); } else { scheduler.jobFinished(job); } }
public EndpointResponse submitJob(SubmitJobRequest request) { try { jobDao.add(request.getJob()); jobDispatcher.notifyNewJobAdded(); return EndpointHelper.createResponse(EndpointResponse.class, request); } catch (Exception e) { return EndpointHelper.createErrorResponse(EndpointResponse.class, request, e); } }
public FacilityManagerMasterImpl(Config config) throws IOException, AlreadyBoundException, InterruptedException { super(config); currentNode = 0; String[] participants = config.getParticipantIps(); int expectedNumParticipants = participants.length; managers = new FacilityManager[expectedNumParticipants]; managers[getNodeId()] = this; clusterName = config.getClusterName(); rmiPort = config.getRmiPort(); /* FILESYSTEM INIT */ fsTable = Collections.synchronizedMap(new HashMap<String, Map<Integer, Set<Integer>>>()); Registry r = LocateRegistry.createRegistry(rmiPort); r.bind(clusterName + REGISTRY_MASTER_KEY, UnicastRemoteObject.exportObject(this, 0)); connectParticipants(); System.out.println("Waiting for slaves to connect..."); while (managers.length != expectedNumParticipants) { Thread.sleep(1000); } healthChecker = new HealthChecker(this, expectedNumParticipants); scheduler = new JobScheduler(this, config); dispatcher = new JobDispatcher(this, config); dispatcher.setScheduler(scheduler); scheduler.setDispatcher(dispatcher); scheduler.setHealthChecker(healthChecker); healthChecker.start(); dispatcher.start(); System.out.println("All slaves connected."); }