HadoopProcessingService implements ProcessingService<JobID> { static float calculateProgress(org.apache.hadoop.mapreduce.JobStatus jobStatus, boolean hasReducer) { if (hasReducer) { return (9.0F * jobStatus.getMapProgress() + jobStatus.getReduceProgress()) / 10.0F; } else { return jobStatus.getMapProgress(); } } HadoopProcessingService(JobClientsMap jobClientsMap);  HadoopProcessingService(JobClientsMap jobClientsMap, String softwareDir); HadoopLaunchHandler getHadoopLaunchHandler(); @Override Timer getTimer(); @Override BundleDescriptor[] getBundles(final String username, final BundleFilter filter); @Override MaskDescriptor[] getMasks(final String username); MaskDescriptor[] getMaskDescriptorsImpl(String username); BundleDescriptor[] getBundleDescriptorsImpl(String username, BundleFilter filter); static BundleDescriptor readBundleDescriptor(FileSystem fileSystem, Path path); void addBundleToClassPath(Path bundlePath, Configuration configuration); static void addBundleToClassPathStatic(Path bundlePath, Configuration configuration, FileSystem fileSystem); final Configuration createJobConfig(String userName); Job createJob(String jobName, Configuration jobConfig); JobClient getJobClient(String username); void clearCache(); @Override JobIdFormat<JobID> getJobIdFormat(); @Override void updateStatuses(String username); @Override ProcessStatus getJobStatus(JobID jobId); @Override boolean killJob(String username, JobID jobId); @Override void close(); @Override String[][] loadRegionDataInfo(String username, String url); FileSystem getFileSystem(String userName); FileSystem getFileSystem(String userName, String path); FileSystem getFileSystem(String userName, Configuration conf, Path path); static void addBundleArchives(Path bundlePath, FileSystem fs, Configuration conf); static boolean isArchive(Path archivePath); static void addBundleLibs(Path bundlePath, FileSystem fs, Configuration conf); static boolean isLib(Path libPath); static InputStream openUrlAsStream(String url, Configuration conf); @Override void invalidateBundleCache(); static final String CALVALUS_SOFTWARE_PATH; static final String DEFAULT_CALVALUS_BUNDLE; static final String DEFAULT_SNAP_BUNDLE; static final String BUNDLE_DESCRIPTOR_XML_FILENAME; }
@Test public void testCalculateProgress() { assertEquals((9 * 0.8f + 0.1f) / 10, calcProgress(0.8f, 0.1f, true), 1e-5f); assertEquals(0.8f, calcProgress(0.8f, 0.0f, false), 1e-5f); assertEquals(1f, calcProgress(1f, 1f, true), 1e-5f); }