Beispiel #1
0
    def test_docker_run_girder_file_to_named_pipe_on_temp_vol(self, params):
        """
        This is a simplified version of test_docker_run_girder_file_to_named_pipe
        it uses the TemporaryVolume, rather than having to setup the volumes
        'manually', this is the approach we should encourage.
        """
        file_id = params.get('fileId')
        pipe_name = 'input_pipe'

        connect = Connect(GirderFileIdToStream(file_id), NamedInputPipe(pipe_name))

        result = docker_run.delay(
            TEST_IMAGE, pull_image=True, container_args=['read', '-p', connect],
            remove_container=True)

        return result.job
Beispiel #2
0
    def test_docker_run_girder_file_to_named_pipe(self, params):
        tmp_dir = params.get('tmpDir')
        file_id = params.get('fileId')
        mount_dir = '/mnt/girder_worker/data'
        pipe_name = 'input_pipe'

        volumes = {tmp_dir: {'bind': mount_dir, 'mode': 'rw'}}

        connect = Connect(GirderFileIdToStream(file_id),
                          NamedInputPipe(pipe_name, mount_dir, tmp_dir))

        result = docker_run.delay(TEST_IMAGE,
                                  pull_image=True,
                                  container_args=['read', '-p', connect],
                                  remove_container=True,
                                  volumes=volumes)

        return result.job
def test_GirderFileIdToStream_calls_GirderFileStreamReader_correctly():
    gfis = GirderFileIdToStream('BOGUS_ID', gc='BOGUS_GC')
    with mock.patch('girder_worker.docker.io.girder.GirderFileStreamReader'
                    ) as mock_class_gfsr:
        gfis.transform()
        mock_class_gfsr.assert_called_with('BOGUS_GC', 'BOGUS_ID')
def test_GirderFileIdToStream_returns_GirderFileStreamReader():
    gfis = GirderFileIdToStream('BOGUS_ID', gc='BOGUS_GC')
    assert isinstance(gfis.transform(), GirderFileStreamReader)