private void copyBlobstore ( List < String > blobStoreResources , File rootDataDir , File pipelineDir ) throws IOException { if ( blobStoreResources == null ) { return ; } File blobstoreDir = new File ( runtimeInfo . getDataDir ( ) , BLOBSTORE_BASE_DIR ) ; File stagingBlobstoreDir = new File ( rootDataDir , BLOBSTORE_BASE_DIR ) ; if ( ! stagingBlobstoreDir . exists ( ) ) { if ( ! stagingBlobstoreDir . mkdirs ( ) ) { throw new RuntimeException ( "Failed to create blobstore directory: " + pipelineDir . getPath ( ) ) ; } } for ( String blobstoreFile : blobStoreResources ) { File srcFile = new File ( blobstoreDir , blobstoreFile ) ; if ( srcFile . exists ( ) ) { final File dstFile = new File ( stagingBlobstoreDir , srcFile . getName ( ) ) ; if ( srcFile . canRead ( ) ) { // ignore files which cannot be read try ( InputStream in = new FileInputStream ( ( srcFile ) ) ) { try ( OutputStream out = new FileOutputStream ( ( dstFile ) ) ) { IOUtils . copy ( in , out ) ; } } } } } }
Copy BlobStore resources to data directory