Search in sources :

Example 11 with BlobServer

use of org.apache.flink.runtime.blob.BlobServer in project flink by apache.

the class DefaultExecutionGraphDeploymentWithBlobServerTest method setupBlobServer.

@Before
public void setupBlobServer() throws IOException {
    Configuration config = new Configuration();
    // always offload the serialized job and task information
    config.setInteger(BlobServerOptions.OFFLOAD_MINSIZE, 0);
    blobServer = Mockito.spy(new BlobServer(config, TEMPORARY_FOLDER.newFolder(), new VoidBlobStore()));
    blobWriter = blobServer;
    blobCache = blobServer;
    seenHashes.clear();
    // verify that we do not upload the same content more than once
    doAnswer(invocation -> {
        PermanentBlobKey key = (PermanentBlobKey) invocation.callRealMethod();
        assertTrue(seenHashes.add(key.getHash()));
        return key;
    }).when(blobServer).putPermanent(any(JobID.class), Matchers.<byte[]>any());
    blobServer.start();
}
Also used : VoidBlobStore(org.apache.flink.runtime.blob.VoidBlobStore) Configuration(org.apache.flink.configuration.Configuration) PermanentBlobKey(org.apache.flink.runtime.blob.PermanentBlobKey) BlobServer(org.apache.flink.runtime.blob.BlobServer) JobID(org.apache.flink.api.common.JobID) Before(org.junit.Before)

Example 12 with BlobServer

use of org.apache.flink.runtime.blob.BlobServer in project flink by apache.

the class BlobServerResource method before.

protected void before() throws Throwable {
    temporaryFolder.create();
    Configuration config = new Configuration();
    blobServer = new BlobServer(config, temporaryFolder.newFolder(), new VoidBlobStore());
    blobServer.start();
}
Also used : VoidBlobStore(org.apache.flink.runtime.blob.VoidBlobStore) Configuration(org.apache.flink.configuration.Configuration) BlobServer(org.apache.flink.runtime.blob.BlobServer)

Example 13 with BlobServer

use of org.apache.flink.runtime.blob.BlobServer in project flink by apache.

the class DispatcherTest method testOnlyRecoveredJobsAreRetainedInTheBlobServer.

@Test
public void testOnlyRecoveredJobsAreRetainedInTheBlobServer() throws Exception {
    final JobID jobId1 = new JobID();
    final JobID jobId2 = new JobID();
    final byte[] fileContent = { 1, 2, 3, 4 };
    final BlobServer blobServer = getBlobServer();
    final PermanentBlobKey blobKey1 = blobServer.putPermanent(jobId1, fileContent);
    final PermanentBlobKey blobKey2 = blobServer.putPermanent(jobId2, fileContent);
    dispatcher = createTestingDispatcherBuilder().setRecoveredJobs(Collections.singleton(new JobGraph(jobId1, "foobar"))).build();
    Assertions.assertThat(blobServer.getFile(jobId1, blobKey1)).hasBinaryContent(fileContent);
    Assertions.assertThatThrownBy(() -> blobServer.getFile(jobId2, blobKey2)).isInstanceOf(NoSuchFileException.class);
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) PermanentBlobKey(org.apache.flink.runtime.blob.PermanentBlobKey) BlobServer(org.apache.flink.runtime.blob.BlobServer) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 14 with BlobServer

use of org.apache.flink.runtime.blob.BlobServer in project flink by apache.

the class ClientUtilsTest method setup.

@BeforeClass
public static void setup() throws IOException {
    Configuration config = new Configuration();
    blobServer = new BlobServer(config, temporaryFolder.newFolder(), new VoidBlobStore());
    blobServer.start();
}
Also used : VoidBlobStore(org.apache.flink.runtime.blob.VoidBlobStore) Configuration(org.apache.flink.configuration.Configuration) BlobServer(org.apache.flink.runtime.blob.BlobServer) BeforeClass(org.junit.BeforeClass)

Example 15 with BlobServer

use of org.apache.flink.runtime.blob.BlobServer in project flink by apache.

the class JobSubmitHandlerTest method setup.

@Before
public void setup() throws IOException {
    Configuration config = new Configuration(configuration);
    blobServer = new BlobServer(config, TEMPORARY_FOLDER.newFolder(), new VoidBlobStore());
    blobServer.start();
}
Also used : VoidBlobStore(org.apache.flink.runtime.blob.VoidBlobStore) Configuration(org.apache.flink.configuration.Configuration) BlobServer(org.apache.flink.runtime.blob.BlobServer) Before(org.junit.Before)

Aggregations

BlobServer (org.apache.flink.runtime.blob.BlobServer)21 Configuration (org.apache.flink.configuration.Configuration)18 VoidBlobStore (org.apache.flink.runtime.blob.VoidBlobStore)13 InetSocketAddress (java.net.InetSocketAddress)7 JobID (org.apache.flink.api.common.JobID)7 PermanentBlobKey (org.apache.flink.runtime.blob.PermanentBlobKey)7 Before (org.junit.Before)7 Test (org.junit.Test)7 PermanentBlobCache (org.apache.flink.runtime.blob.PermanentBlobCache)6 File (java.io.File)4 ArrayList (java.util.ArrayList)4 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)4 IOException (java.io.IOException)3 UUID (java.util.UUID)3 URL (java.net.URL)2 Duration (java.time.Duration)2 Collection (java.util.Collection)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 ExecutorService (java.util.concurrent.ExecutorService)2 Time (org.apache.flink.api.common.time.Time)2