use of org.eclipse.scanning.api.event.status.StatusBean in project gda-core by openGDA.
the class SubmitScanToScriptSection method stopScan.
private void stopScan() {
logger.info("Stopping script & job");
// Stop the script
final JythonServerFacade jythonServerFacade = JythonServerFacade.getInstance();
jythonServerFacade.abortCommands();
try {
// Stop the currently-running job
final List<StatusBean> currentJobs = jobQueueProxy.getRunningAndCompleted();
for (StatusBean job : currentJobs) {
if (job.getStatus() == Status.RUNNING) {
jobQueueProxy.terminateJob(job);
}
}
} catch (EventException e) {
logger.error("Error accessing queue", e);
}
}
use of org.eclipse.scanning.api.event.status.StatusBean in project gda-core by openGDA.
the class StandardsScanView method stopScan.
private void stopScan() {
logger.info("Stopping standards scan script & job");
// Stop the script
final JythonServerFacade jythonServerFacade = JythonServerFacade.getInstance();
jythonServerFacade.abortCommands();
try {
// Stop the currently-running job
final List<StatusBean> currentJobs = jobQueueProxy.getRunningAndCompleted();
for (StatusBean job : currentJobs) {
if (job.getStatus() == Status.RUNNING) {
jobQueueProxy.terminateJob(job);
}
}
} catch (EventException e) {
logger.error("Error accessing queue", e);
}
}
use of org.eclipse.scanning.api.event.status.StatusBean in project gda-core by openGDA.
the class PlanOverview method scanListener.
/**
* We listen to scan updates in order to display the current status in the appropriate
* tree node.
*
* A special consideration is that a plan can end but a scan started by it is still running.
* When this final scan ends its trigger node should be updated (if the tree is still in the viewer)
*/
private void scanListener(BeanEvent<StatusBean> event) {
StatusBean bean = event.getBean();
final String scanId = bean.getUniqueId();
final Status scanStatus = bean.getStatus();
if (// this is a scan that's relevant to the plan
triggersInCurrentTree.containsKey(scanId) && triggersInCurrentTree.get(scanId).getStatus() != scanStatus) {
// the status of the scan has changed
triggersInCurrentTree.get(bean.getUniqueId()).setStatus(bean.getStatus());
Display.getDefault().asyncExec(() -> viewer.update(triggersInCurrentTree.get(scanId), new String[] { "status" }));
}
}
Aggregations