use of gov.sandia.n2a.backend.internal.InternalBackend in project n2a by frothga.
the class PanelEquations method launchJob.
public void launchJob() {
if (record == null)
return;
prepareForTabChange();
String jobKey = new SimpleDateFormat("yyyy-MM-dd-HHmmss", Locale.ROOT).format(new Date());
MDoc job = (MDoc) AppData.runs.childOrCreate(jobKey);
NodeJob.collectJobParameters(root.source, record.key(), job);
// Force directory (and job file) to exist, so Backends can work with the dir.
job.save();
NodeJob.saveSnapshot(record, job);
MainTabbedPane mtp = (MainTabbedPane) MainFrame.instance.tabs;
mtp.setPreferredFocus(PanelRun.instance, PanelRun.instance.tree);
mtp.selectTab("Runs");
NodeJob node = PanelRun.instance.addNewRun(job, true);
// Hack to allow local jobs to bypass the wait-for-host queue.
// It would be better for all jobs to check for resources before starting.
// However, the time cost for the local check could be as long as the job itself
// (for very simple models). There is some expectation that the user knows
// the state of their own system when they choose to hit the play button.
Backend backend = Backend.getBackend(job.get("backend"));
String backendName = backend.getName().toLowerCase();
Host h = Host.get(job);
boolean internal = backend instanceof InternalBackend;
boolean localhost = !(h instanceof Remote);
boolean forbidden = h.config.get("backend", backendName).equals("0");
if (// use of Internal overrides host selection
internal || (localhost && !forbidden)) {
// In case it was "internal" but not "localhost", set host to correct value.
job.set("localhost", "host");
backend.start(job);
h.monitor(node);
return;
}
Host.waitForHost(node);
}
Aggregations