/** * JobTracker.submitJob() kicks off a new job. * * <p>Create a 'JobInProgress' object, which contains both JobProfile and JobStatus. Those two * sub-objects are sometimes shipped outside of the JobTracker. But JobInProgress adds info that's * useful for the JobTracker alone. * * <p>We add the JIP to the jobInitQueue, which is processed asynchronously to handle * split-computation and build up the right TaskTracker/Block mapping. */ public synchronized JobStatus submitJob(String jobFile) throws IOException { totalSubmissions++; JobInProgress job = new JobInProgress(jobFile, this, this.conf); synchronized (jobs) { synchronized (jobsByArrival) { synchronized (jobInitQueue) { jobs.put(job.getProfile().getJobId(), job); jobsByArrival.add(job); jobInitQueue.add(job); jobInitQueue.notifyAll(); } } } return job.getStatus(); }
public void doLayout() { selections.clear(); if (points == null) { points = new Vector<ExprPoint>(); } points.clear(); for (Pair<Integer, Double> p : watsonProbes) { ExprPoint ep = new ExprPoint(p.getFirst(), p.getLast(), '+'); points.add(ep); } for (Pair<Integer, Double> p : crickProbes) { ExprPoint ep = new ExprPoint(p.getFirst(), p.getLast(), '-'); points.add(ep); } }
public void addString(String str) { char[] array = str.toCharArray(); strings.add(new TreeString(strings.size(), array)); logger.log(Level.INFO, String.format("Adding string \"%s\"", str)); ukkonenExtendSuffixTree(strings.size() - 1); // naiveExtendSuffixTree(strings.size()-1); }
public synchronized TaskReport[] getReduceTaskReports(String jobid) { JobInProgress job = (JobInProgress) jobs.get(jobid); if (job == null) { return new TaskReport[0]; } else { Vector reports = new Vector(); Vector completeReduceTasks = job.reportTasksInProgress(false, true); for (Iterator it = completeReduceTasks.iterator(); it.hasNext(); ) { TaskInProgress tip = (TaskInProgress) it.next(); reports.add(tip.generateSingleReport()); } Vector incompleteReduceTasks = job.reportTasksInProgress(false, false); for (Iterator it = incompleteReduceTasks.iterator(); it.hasNext(); ) { TaskInProgress tip = (TaskInProgress) it.next(); reports.add(tip.generateSingleReport()); } return (TaskReport[]) reports.toArray(new TaskReport[reports.size()]); } }
public Vector completedJobs() { Vector v = new Vector(); for (Iterator it = jobs.values().iterator(); it.hasNext(); ) { JobInProgress jip = (JobInProgress) it.next(); JobStatus status = jip.getStatus(); if (status.getRunState() == JobStatus.SUCCEEDED) { v.add(jip); } } return v; }
public Vector runningJobs() { Vector v = new Vector(); for (Iterator it = jobs.values().iterator(); it.hasNext(); ) { JobInProgress jip = (JobInProgress) it.next(); JobStatus status = jip.getStatus(); if (status.getRunState() == JobStatus.RUNNING) { v.add(jip); } } return v; }
public void loadNetwork() throws IOException { logger.log(Level.INFO, "Loading metabolism network..."); File file = props.getNetworkFile(); Mapper<String, MetabolicEntry> entryMapper = new MetabolicEntry.MetabolicMapper(); Parser<MetabolicEntry> parser = new Parser<MetabolicEntry>(file, entryMapper); while (parser.hasNext()) { MetabolicEntry entry = parser.next(); entries.add(entry); Rxn rxn = new Rxn( props, entry.getReaction(), entry.getAbbreviation(), entry.getReactionName(), entry.getORF()); reactions.put(entry.getAbbreviation(), rxn); locations.add(rxn.getLocation()); LogicalORFTree lot = new LogicalORFTree(entry.getORF()); ORFSet os = new ORFSet(entry.getORF()); totalORFs.addAll(os.getORFs()); orfSets.put(entry.getAbbreviation(), lot); } logger.log(Level.FINE, String.format("Loaded %d entries.", entries.size())); abbrevs = new MetabolismAbbreviations(props); abbrevs.loadAbbreviations(); logger.log(Level.FINEST, "Loaded abbrevations."); }
public void testStatelessSearch() throws org.jzkit.configuration.api.ConfigurationException, org.jzkit.search.SearchException, org.jzkit.search.util.ResultSet.IRResultSetException, org.jzkit.search.util.QueryModel.InvalidQueryException { Logger log = Logger.getLogger(TestService.class.getName()); log.info("Starting jzkit2 server..."); RecordFormatSpecification request_spec = new ArchetypeRecordFormatSpecification("F"); ExplicitRecordFormatSpecification display_spec = new ExplicitRecordFormatSpecification("text:html:F"); ApplicationContext app_context = new ClassPathXmlApplicationContext("TestApplicationContext.xml"); log.info("JZKit server startup completed"); Vector collection_ids = new Vector(); collection_ids.add("LC/BOOKS"); QueryModel qm = new PrefixString("@attrset bib-1 @attr 1=4 Science"); System.err.println("Processing search......"); try { Map additional_properties = new HashMap(); additional_properties.put("base_dir", "/a/b/c/d"); StatelessQueryService stateless_query_service = (StatelessQueryService) app_context.getBean("StatelessQueryService"); org.jzkit.search.landscape.SimpleLandscapeSpecification landscape = new org.jzkit.search.landscape.SimpleLandscapeSpecification(collection_ids); // Test 1 - Kick off a search StatelessSearchResultsPageDTO rp = stateless_query_service.getResultsPageFor( null, qm, landscape, 1, 5, request_spec, display_spec, additional_properties); if (rp != null) { System.err.println( "Result Set Size....." + rp.total_hit_count + " records - result contains " + rp.number_of_records + " records"); System.err.println("Result Set ID : " + rp.result_set_id); } else { System.err.println("Results page was null"); } if (rp.records != null) { for (int i = 0; ((i < rp.records.length) && (i < 25)); i++) { System.err.println( "Getting next record (" + i + " out of " + rp.number_of_records + ")....."); InformationFragment frag = rp.records[i]; System.err.println(frag); } } // Test 2 - use the result set ID to get a page of requests rp = stateless_query_service.getResultsPageFor( rp.result_set_id, qm, landscape, 6, 5, request_spec, display_spec, additional_properties); if (rp.records != null) { for (int i = 0; ((i < rp.records.length) && (i < 25)); i++) { System.err.println( "Getting next record (" + i + " out of " + rp.number_of_records + ")....."); InformationFragment frag = rp.records[i]; System.err.println(frag); } } // Test 3 - Use the query to get a cache hit rp = stateless_query_service.getResultsPageFor( null, qm, landscape, 6, 5, request_spec, display_spec, additional_properties); if (rp.records != null) { for (int i = 0; ((i < rp.records.length) && (i < 25)); i++) { System.err.println( "Getting next record (" + i + " out of " + rp.number_of_records + ")....."); InformationFragment frag = rp.records[i]; System.err.println(frag); } } } catch (Exception e) { e.printStackTrace(); } }