List of usage examples for weka.experiment TaskStatusInfo TaskStatusInfo
TaskStatusInfo
From source file:core.utils.ui.RemoteEngine.java
License:Open Source License
/** * Returns status information on a particular task * * @param taskId the ID of the task to check * @return a <code>TaskStatusInfo</code> encapsulating task status info * @exception Exception if an error occurs *//*from w w w . j a v a 2 s . co m*/ public Object checkStatus(Object taskId) throws Exception { TaskStatusInfo inf = (TaskStatusInfo) m_TaskStatus.get(taskId); if (inf == null) { throw new Exception("RemoteEngine (" + m_HostName + ") : Task not found."); } TaskStatusInfo result = new TaskStatusInfo(); result.setExecutionStatus(inf.getExecutionStatus()); result.setStatusMessage(inf.getStatusMessage()); result.setTaskResult(inf.getTaskResult()); if (inf.getExecutionStatus() == TaskStatusInfo.FINISHED || inf.getExecutionStatus() == TaskStatusInfo.FAILED) { System.err.println("Finished/failed Task id : " + taskId + " checked by client. Removing."); inf.setTaskResult(null); inf = null; m_TaskStatus.remove(taskId); } inf = null; return result; }
From source file:core.utils.ui.RemoteEngine.java
License:Open Source License
/** * Adds a new task to the queue.// ww w . j a v a2 s. co m * * @param t a <code>Task</code> value to be added * @param taskId the id of the task to be added */ private synchronized void addTaskToQueue(Task t, String taskId) { TaskStatusInfo newTask = t.getTaskStatus(); if (newTask == null) { newTask = new TaskStatusInfo(); } m_TaskQueue.push(t); m_TaskIdQueue.push(taskId); newTask.setStatusMessage( "RemoteEngine (" + m_HostName + ") : task " + taskId + " queued at postion: " + m_TaskQueue.size()); // add task status to HashTable m_TaskStatus.put(taskId, newTask); System.err.println("Task id : " + taskId + " Queued."); if (m_TaskRunning == false) { startTask(); } }
From source file:milk.experiment.MIRemoteExperimentSubTask.java
License:Open Source License
/** * Run the experiment// w w w .j a va 2 s . co m */ public void execute() { // FastVector result = new FastVector(); m_result = new TaskStatusInfo(); m_result.setStatusMessage("Running..."); String goodResult = "(sub)experiment completed successfully"; String subTaskType; if (m_experiment.getRunLower() != m_experiment.getRunUpper()) { subTaskType = "(datataset " + ((File) m_experiment.getDatasets().elementAt(0)).getName(); } else { subTaskType = "(exp run # " + m_experiment.getRunLower(); } try { System.err.println("Initializing " + subTaskType + ")..."); m_experiment.initialize(); System.err.println("Iterating " + subTaskType + ")..."); m_experiment.runExperiment(); System.err.println("Postprocessing " + subTaskType + ")..."); m_experiment.postProcess(); } catch (Exception ex) { ex.printStackTrace(); String badResult = "(sub)experiment " + subTaskType + ") failed : " + ex.toString(); m_result.setExecutionStatus(TaskStatusInfo.FAILED); // m_result.addElement(new Integer(RemoteExperiment.FAILED)); // m_result.addElement(badResult); m_result.setStatusMessage(badResult); m_result.setTaskResult("Failed"); // return m_result; return; } // m_result.addElement(new Integer(RemoteExperiment.FINISHED)); // m_result.addElement(goodResult); m_result.setExecutionStatus(TaskStatusInfo.FINISHED); m_result.setStatusMessage(goodResult + " " + subTaskType + ")."); m_result.setTaskResult("No errors"); // return m_result; }