Search in sources :

Example 1 with GATScriptExecutor

use of es.bsc.compss.gat.master.utils.GATScriptExecutor in project compss by bsc-wdc.

the class GATWorkerNode method initWorkingDir.

private void initWorkingDir() throws InitNodeException {
    LinkedList<URI> traceScripts = new LinkedList<>();
    LinkedList<String> traceParams = new LinkedList<>();
    String host = getHost();
    String installDir = getInstallDir();
    String workingDir = getWorkingDir();
    String user = getUser();
    if (user == null || user.isEmpty()) {
        user = "";
    } else {
        user += "@";
    }
    try {
        String initScriptPath = Protocol.ANY_URI.getSchema() + user + host + File.separator + installDir + GAT_SCRIPT_PATH + INIT_SCRIPT_NAME;
        traceScripts.add(new URI(initScriptPath));
    } catch (URISyntaxException e) {
        new InitNodeException("Error addind initScript");
    }
    String pars = workingDir;
    traceParams.add(pars);
    // Use cleaner to run the trace script and generate the package
    LOGGER.debug("Initializing working dir " + workingDir + "  in host " + getName());
    boolean result = new GATScriptExecutor(this).executeScript(traceScripts, traceParams, "init_" + host);
    if (!result) {
        throw new InitNodeException("Error executing init script for initializing working dir " + workingDir + " in host " + getName());
    }
}
Also used : InitNodeException(es.bsc.compss.exceptions.InitNodeException) URISyntaxException(java.net.URISyntaxException) URI(org.gridlab.gat.URI) MultiURI(es.bsc.compss.types.uri.MultiURI) SimpleURI(es.bsc.compss.types.uri.SimpleURI) GATScriptExecutor(es.bsc.compss.gat.master.utils.GATScriptExecutor) LinkedList(java.util.LinkedList)

Example 2 with GATScriptExecutor

use of es.bsc.compss.gat.master.utils.GATScriptExecutor in project compss by bsc-wdc.

the class GATWorkerNode method deleteTemporary.

@Override
public void deleteTemporary() {
    LinkedList<URI> traceScripts = new LinkedList<URI>();
    LinkedList<String> traceParams = new LinkedList<String>();
    String host = getHost();
    String installDir = getInstallDir();
    String workingDir = getWorkingDir();
    String user = getUser();
    if (user == null) {
        user = "";
    } else {
        user += "@";
    }
    try {
        traceScripts.add(new URI(Protocol.ANY_URI.getSchema() + user + host + File.separator + installDir + GAT_SCRIPT_PATH + CLEANER_SCRIPT_NAME));
    } catch (URISyntaxException e) {
        LOGGER.error("Error deleting working dir " + workingDir + " in host " + getName(), e);
        return;
    }
    String pars = workingDir;
    traceParams.add(pars);
    // Use cleaner to run the trace script and generate the package
    LOGGER.debug("Deleting working dir " + workingDir + "  in host " + getName());
    boolean result = new GATScriptExecutor(this).executeScript(traceScripts, traceParams, "clean_" + host);
    if (!result) {
        LOGGER.error("Error executing clean script for deleting working dir " + workingDir + " in host " + getName());
    }
}
Also used : URISyntaxException(java.net.URISyntaxException) URI(org.gridlab.gat.URI) MultiURI(es.bsc.compss.types.uri.MultiURI) SimpleURI(es.bsc.compss.types.uri.SimpleURI) GATScriptExecutor(es.bsc.compss.gat.master.utils.GATScriptExecutor) LinkedList(java.util.LinkedList)

Example 3 with GATScriptExecutor

use of es.bsc.compss.gat.master.utils.GATScriptExecutor in project compss by bsc-wdc.

the class GATTracer method generatePackage.

public static boolean generatePackage(GATWorkerNode node) {
    LinkedList<URI> traceScripts = new LinkedList<>();
    LinkedList<String> traceParams = new LinkedList<>();
    String host = node.getHost();
    String installDir = node.getInstallDir();
    String workingDir = node.getWorkingDir();
    String user = node.getUser();
    if (user == null || user.isEmpty()) {
        user = "";
    } else {
        user += "@";
    }
    try {
        traceScripts.add(new URI(Protocol.ANY_URI.getSchema() + user + host + File.separator + installDir + TRACE_SCRIPT_PATH));
    } catch (URISyntaxException e) {
        LOGGER.error("Error deleting tracing host", e);
        return false;
    }
    String pars = "package " + workingDir + " " + host;
    traceParams.add(pars);
    // Use cleaner to run the trace script and generate the package
    return new GATScriptExecutor(node).executeScript(traceScripts, traceParams, "trace_packaging_" + host);
}
Also used : URISyntaxException(java.net.URISyntaxException) URI(org.gridlab.gat.URI) GATScriptExecutor(es.bsc.compss.gat.master.utils.GATScriptExecutor) LinkedList(java.util.LinkedList)

Aggregations

GATScriptExecutor (es.bsc.compss.gat.master.utils.GATScriptExecutor)3 URISyntaxException (java.net.URISyntaxException)3 LinkedList (java.util.LinkedList)3 URI (org.gridlab.gat.URI)3 MultiURI (es.bsc.compss.types.uri.MultiURI)2 SimpleURI (es.bsc.compss.types.uri.SimpleURI)2 InitNodeException (es.bsc.compss.exceptions.InitNodeException)1