Search in sources :

Example 1 with RuntimeJobInfo

use of io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobInfo in project cdap by caskdata.

the class RuntimeJobTwillPreparer method launch.

@Override
protected void launch(TwillRuntimeSpecification twillRuntimeSpec, RuntimeSpecification runtimeSpec, JvmOptions jvmOptions, Map<String, String> environments, Map<String, LocalFile> localFiles, TimeoutChecker timeoutChecker) throws Exception {
    try (RuntimeJobManager jobManager = jobManagerSupplier.get()) {
        timeoutChecker.throwIfTimeout();
        Map<String, LocalFile> localizeFiles = new HashMap<>(localFiles);
        for (Map.Entry<String, Location> secretFile : secretFiles.entrySet()) {
            Location secretFileLocation = secretFile.getValue();
            localizeFiles.put(secretFile.getKey(), new DefaultLocalFile(secretFile.getKey(), secretFileLocation.toURI(), secretFileLocation.lastModified(), secretFileLocation.length(), false, null));
        }
        RuntimeJobInfo runtimeJobInfo = createRuntimeJobInfo(runtimeSpec, localizeFiles, jvmOptions.getRunnableExtraOptions(runtimeSpec.getName()));
        LOG.info("Starting runnable {} for runId {} with job manager.", runtimeSpec.getName(), getProgramRunId());
        // launch job using job manager
        jobManager.launch(runtimeJobInfo);
    }
}
Also used : DefaultLocalFile(org.apache.twill.internal.DefaultLocalFile) LocalFile(org.apache.twill.api.LocalFile) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) RuntimeJobManager(io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobManager) DefaultRuntimeJobInfo(io.cdap.cdap.internal.app.runtime.distributed.runtimejob.DefaultRuntimeJobInfo) RuntimeJobInfo(io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobInfo) DefaultLocalFile(org.apache.twill.internal.DefaultLocalFile) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Location(org.apache.twill.filesystem.Location)

Aggregations

DefaultRuntimeJobInfo (io.cdap.cdap.internal.app.runtime.distributed.runtimejob.DefaultRuntimeJobInfo)1 RuntimeJobInfo (io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobInfo)1 RuntimeJobManager (io.cdap.cdap.runtime.spi.runtimejob.RuntimeJobManager)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 LocalFile (org.apache.twill.api.LocalFile)1 Location (org.apache.twill.filesystem.Location)1 DefaultLocalFile (org.apache.twill.internal.DefaultLocalFile)1