use of com.twosigma.beakerx.NamespaceClient in project beakerx by twosigma.
the class GroovyWorkerThread method call.
@Override
public TryResult call() throws Exception {
NamespaceClient nc = null;
TryResult r;
try {
if (!GroovyEvaluator.LOCAL_DEV) {
nc = NamespaceClient.getBeaker(groovyEvaluator.getSessionId());
nc.setOutputObj(j.outputObject);
}
j.outputObject.started();
String code = j.codeToBeExecuted;
r = groovyEvaluator.executeTask(new GroovyCodeRunner(groovyEvaluator, code, j.outputObject));
if (nc != null) {
nc.setOutputObj(null);
nc = null;
}
} catch (Throwable e) {
if (e instanceof GroovyNotFoundException) {
logger.warn(e.getLocalizedMessage());
r = TryResult.createError(e.getLocalizedMessage());
} else {
e.printStackTrace();
r = TryResult.createError(e.getLocalizedMessage());
}
} finally {
if (nc != null) {
nc.setOutputObj(null);
nc = null;
}
}
return r;
}
Aggregations