use of es.bsc.compss.nio.NIOTask in project compss by bsc-wdc.
the class NIOJob method prepareJob.
public NIOTask prepareJob() {
AbstractMethodImplementation absMethodImpl = (AbstractMethodImplementation) this.impl;
// This is a workarround for Python
if (absMethodImpl.getMethodType().equals(MethodType.METHOD)) {
MethodImplementation mImpl = (MethodImplementation) absMethodImpl;
String methodName = mImpl.getAlternativeMethodName();
if (methodName == null || methodName.isEmpty()) {
mImpl.setAlternativeMethodName(taskParams.getName());
}
}
boolean hasTarget = taskParams.hasTargetObject();
boolean hasReturn = taskParams.hasReturnValue();
LinkedList<NIOParam> params = addParams();
MethodResourceDescription reqs = absMethodImpl.getRequirements();
int numParams = params.size();
if (taskParams.hasReturnValue()) {
numParams--;
}
// Create NIOTask
NIOTask nt = new NIOTask(LANG, debug, absMethodImpl, hasTarget, hasReturn, params, numParams, reqs, this.slaveWorkersNodeNames, this.taskId, this.taskParams.getId(), this.jobId, this.history, this.transferId);
return nt;
}
use of es.bsc.compss.nio.NIOTask in project compss by bsc-wdc.
the class NIOWorkerNode method submitTask.
public void submitTask(NIOJob job, List<String> obsolete) throws UnstartedNodeException {
if (node == null) {
throw new UnstartedNodeException();
}
NIOTask t = job.prepareJob();
CommandNewTask cmd = new CommandNewTask(t, obsolete);
Connection c = NIOAgent.getTransferManager().startConnection(node);
c.sendCommand(cmd);
c.finishConnection();
}
use of es.bsc.compss.nio.NIOTask in project compss by bsc-wdc.
the class Executor method processRequests.
private void processRequests() {
NIOTask nt;
while (true) {
// Get tasks until there are no more tasks pending
nt = queue.dequeue();
if (nt == null) {
LOGGER.debug("Dequeued job is null");
break;
}
if (WORKER_DEBUG) {
LOGGER.debug("Dequeuing job " + nt.getJobId());
}
boolean success = executeTask(nt);
if (WORKER_DEBUG) {
LOGGER.debug("Job " + nt.getJobId() + " finished (success: " + success + ")");
}
nw.sendTaskDone(nt, success);
}
}
Aggregations