/** * Copies the artifact jar to the given target file. * * @param artifactId artifact id of the artifact to be copied * @param artifactDetail detail information of the artifact to be copied * @param targetFile target file to copy to * @throws IOException if the copying failed */ protected void copyArtifact(ArtifactId artifactId, ArtifactDetail artifactDetail, File targetFile) throws IOException { Locations.linkOrCopy(artifactDetail.getDescriptor().getLocation(), targetFile); }
/** * Copies the artifact jar to the given target file. * * @param artifactId artifact id of the artifact to be copied * @param artifactDetail detail information of the artifact to be copied * @param targetFile target file to copy to * @throws IOException if the copying failed */ protected void copyArtifact(ArtifactId artifactId, ArtifactDetail artifactDetail, File targetFile) throws IOException { Locations.linkOrCopy(artifactDetail.getDescriptor().getLocation(), targetFile); }
@Override protected void copyArtifact(ArtifactId artifactId, final ArtifactDetail artifactDetail, final File targetFile) throws IOException { try { impersonator.doAs(artifactId, () -> { Locations.linkOrCopy(artifactDetail.getDescriptor().getLocation(), targetFile); return null; }); } catch (Exception e) { Throwables.propagateIfPossible(e, IOException.class); // should not happen throw Throwables.propagate(e); } }
@Override protected void copyArtifact(ArtifactId artifactId, final ArtifactDetail artifactDetail, final File targetFile) throws IOException { try { impersonator.doAs(artifactId, () -> { Locations.linkOrCopy(artifactDetail.getDescriptor().getLocation(), targetFile); return null; }); } catch (Exception e) { Throwables.propagateIfPossible(e, IOException.class); // should not happen throw Throwables.propagate(e); } }
/** * Creates a {@link Program} for the given {@link ProgramRunner} from the given program jar {@link Location}. */ protected Program createProgram(CConfiguration cConf, ProgramRunner programRunner, ProgramDescriptor programDescriptor, ArtifactDetail artifactDetail, final File tempDir) throws IOException { final Location programJarLocation = artifactDetail.getDescriptor().getLocation(); // Take a snapshot of the JAR file to avoid program mutation final File unpackedDir = new File(tempDir, "unpacked"); unpackedDir.mkdirs(); try { File programJar = Locations.linkOrCopy(programJarLocation, new File(tempDir, "program.jar")); // Unpack the JAR file BundleJarUtil.unJar(() -> Files.newInputStream(programJar.toPath()), unpackedDir); } catch (IOException ioe) { throw ioe; } catch (Exception e) { // should not happen throw Throwables.propagate(e); } return Programs.create(cConf, programRunner, programDescriptor, programJarLocation, unpackedDir); }
/** * Creates a {@link Program} for the given {@link ProgramRunner} from the given program jar {@link Location}. */ protected Program createProgram(CConfiguration cConf, ProgramRunner programRunner, ProgramDescriptor programDescriptor, ArtifactDetail artifactDetail, final File tempDir) throws IOException { final Location programJarLocation = artifactDetail.getDescriptor().getLocation(); // Take a snapshot of the JAR file to avoid program mutation final File unpackedDir = new File(tempDir, "unpacked"); unpackedDir.mkdirs(); try { File programJar = Locations.linkOrCopy(programJarLocation, new File(tempDir, "program.jar")); // Unpack the JAR file BundleJarUtil.unJar(programJar, unpackedDir); } catch (IOException ioe) { throw ioe; } catch (Exception e) { // should not happen throw Throwables.propagate(e); } return Programs.create(cConf, programRunner, programDescriptor, programJarLocation, unpackedDir); }
return scriptURI; return Locations.linkOrCopy(locationFactory.create(scriptURI), pythonFile).toURI(); return Locations.linkOrCopy(Locations.toLocation(new File(scriptURI.getPath())), pythonFile).toURI();
return scriptURI; return Locations.linkOrCopy(locationFactory.create(scriptURI), pythonFile).toURI(); return Locations.linkOrCopy(Locations.toLocation(new File(scriptURI.getPath())), pythonFile).toURI();
return scriptURI; return Locations.linkOrCopy(locationFactory.create(scriptURI), pythonFile).toURI(); return Locations.linkOrCopy(Locations.toLocation(new File(scriptURI.getPath())), pythonFile).toURI();
private File createPluginJar(Class<?> clz) throws IOException { LocalLocationFactory lf = new LocalLocationFactory(tmpFolder.newFolder()); Manifest manifest = new Manifest(); manifest.getMainAttributes().put(ManifestFields.EXPORT_PACKAGE, clz.getPackage().getName()); return Locations.linkOrCopy(PluginJarHelper.createPluginJar(lf, manifest, clz), new File(tmpFolder.newFolder(), clz.getSimpleName() + ".jar")); } }
private File createAppJar(Class<? extends Application> clz) throws IOException { LocalLocationFactory lf = new LocalLocationFactory(tmpFolder.newFolder()); return Locations.linkOrCopy(AppJarHelper.createDeploymentJar(lf, clz), new File(tmpFolder.newFolder(), clz.getSimpleName() + ".jar")); }
File programJar = Locations.linkOrCopy(runtimeContext.getProgram().getJarLocation(), new File(tempDir, SparkRuntimeContextProvider.PROGRAM_JAR_NAME)); File expandedProgramJar = Locations.linkOrCopy(runtimeContext.getProgram().getJarLocation(), new File(tempDir, SparkRuntimeContextProvider.PROGRAM_JAR_EXPANDED_NAME));
File programJar = Locations.linkOrCopy(runtimeContext.getProgram().getJarLocation(), new File(tempDir, SparkRuntimeContextProvider.PROGRAM_JAR_NAME)); File expandedProgramJar = Locations.linkOrCopy(runtimeContext.getProgram().getJarLocation(), new File(tempDir, SparkRuntimeContextProvider.PROGRAM_JAR_EXPANDED_NAME));
File programJar = Locations.linkOrCopy(runtimeContext.getProgram().getJarLocation(), new File(tempDir, SparkRuntimeContextProvider.PROGRAM_JAR_NAME)); File expandedProgramJar = Locations.linkOrCopy(runtimeContext.getProgram().getJarLocation(), new File(tempDir, SparkRuntimeContextProvider.PROGRAM_JAR_EXPANDED_NAME));